1""" 2SkOpts is built differently than the rest of our source files. See //src/core/SkOpts.h for 3a bit more background about what SkOpts is for and how it works. 4 5Instead of bubbling all the headers and sources up to the top level where they are compiled in 6one large library, we only bubble up the headers, so the default implementations in those files 7can be built against the minimum version of Skia (which the whole library is compiled with). 8 9We create several libraries that contain a single source file and may need to access any of 10Skia's headers. These libraries are each compiled with a different set of compiler flags 11(e.g. architecture options) and linked into the final library or binary. 12""" 13 14load("@skia_user_config//:copts.bzl", "DEFAULT_COPTS") 15load("//bazel:flags.bzl", "selects") 16load("//bazel:skia_rules.bzl", "skia_cc_library", "skia_filegroup") 17 18package( 19 default_applicable_licenses = ["//:license"], 20 features = [ 21 # While the OPTS_HDRS are already pulled in as textual_headers, 22 # any implicit dependency on the system headers also needs to be textual. 23 "-use_header_modules", 24 ], 25) 26 27licenses(["notice"]) 28 29skia_cc_library( 30 name = "hsw", # https://en.wikipedia.org/wiki/Advanced_Vector_Extensions#Advanced_Vector_Extensions_2 31 srcs = [ 32 "SkOpts_hsw.cpp", 33 "//include/core:opts_srcs", 34 "//include/private:opts_srcs", 35 "//src/core:opts_srcs", 36 "//src/shaders:opts_srcs", 37 "//src/sksl/tracing:opts_srcs", 38 ], 39 copts = DEFAULT_COPTS + ["-march=haswell"], 40 textual_hdrs = [ 41 "SkRasterPipeline_opts.h", 42 ":textual_hdrs", 43 ], 44 deps = [ 45 "//modules/skcms", # Needed to implement SkRasterPipeline_opts.h 46 "//src/base", 47 "@skia_user_config//:user_config", 48 ], 49) 50 51skia_cc_library( 52 name = "skx", 53 srcs = [ 54 "SkOpts_skx.cpp", 55 "//include/core:opts_srcs", 56 "//include/private:opts_srcs", 57 "//src/core:opts_srcs", 58 "//src/shaders:opts_srcs", 59 "//src/sksl/tracing:opts_srcs", 60 ], 61 copts = DEFAULT_COPTS + ["-march=skylake-avx512"], 62 textual_hdrs = [ 63 "SkRasterPipeline_opts.h", 64 ":textual_hdrs", 65 ], 66 deps = [ 67 "//modules/skcms", # Needed to implement SkRasterPipeline_opts.h 68 "//src/base", 69 "@skia_user_config//:user_config", 70 ], 71) 72 73skia_cc_library( 74 name = "opts", 75 visibility = ["//src/core:__pkg__"], 76 deps = selects.with_or({ 77 ("@platforms//cpu:x86_64", "@platforms//cpu:x86_32"): [ 78 ":hsw", 79 ":skx", 80 ], 81 "//bazel/common_config_settings:cpu_wasm": [], 82 "//conditions:default": [], 83 }), 84) 85 86skia_filegroup( 87 name = "textual_hdrs", 88 srcs = [ 89 "SkBitmapProcState_opts.h", 90 "SkBlitMask_opts.h", 91 "SkBlitRow_opts.h", 92 "SkMemset_opts.h", 93 "SkOpts_RestoreTarget.h", 94 "SkOpts_SetTarget.h", 95 "SkRasterPipeline_opts.h", 96 "SkSwizzler_opts.inc", 97 ], 98 visibility = [ 99 "//src/core:__pkg__", 100 ], 101) 102