| 1 |
""" |
| 2 |
SkOpts is built differently than the rest of our source files. See //src/core/SkOpts.h for |
| 3 |
a bit more background about what SkOpts is for and how it works. |
| 4 |
|
| 5 |
Instead of bubbling all the headers and sources up to the top level where they are compiled in |
| 6 |
one large library, we only bubble up the headers, so the default implementations in those files |
| 7 |
can be built against the minimum version of Skia (which the whole library is compiled with). |
| 8 |
|
| 9 |
We create several libraries that contain a single source file and may need to access any of |
| 10 |
Skia'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 |
|
| 14 |
load("@skia_user_config//:copts.bzl", "DEFAULT_COPTS") |
| 15 |
load("//bazel:flags.bzl", "selects") |
| 16 |
load("//bazel:skia_rules.bzl", "skia_cc_library", "skia_filegroup") |
| 17 |
|
| 18 |
package( |
| 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 |
|
| 27 |
licenses(["notice"]) |
| 28 |
|
| 29 |
skia_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 |
"//src/core:opts_srcs", |
| 35 |
"//src/shaders:opts_srcs", |
| 36 |
"//src/sksl/tracing:opts_srcs", |
| 37 |
], |
| 38 |
copts = DEFAULT_COPTS + ["-march=haswell"], |
| 39 |
textual_hdrs = [ |
| 40 |
"SkRasterPipeline_opts.h", |
| 41 |
":textual_hdrs", |
| 42 |
], |
| 43 |
deps = [ |
| 44 |
"//modules/skcms", # Needed to implement SkRasterPipeline_opts.h |
| 45 |
"//src/base", |
| 46 |
"@skia_user_config//:user_config", |
| 47 |
], |
| 48 |
) |
| 49 |
|
| 50 |
skia_cc_library( |
| 51 |
name = "skx", |
| 52 |
srcs = [ |
| 53 |
"SkOpts_skx.cpp", |
| 54 |
"//include/core:opts_srcs", |
| 55 |
"//src/core:opts_srcs", |
| 56 |
"//src/shaders:opts_srcs", |
| 57 |
"//src/sksl/tracing:opts_srcs", |
| 58 |
], |
| 59 |
copts = DEFAULT_COPTS + ["-march=skylake-avx512"], |
| 60 |
textual_hdrs = [ |
| 61 |
"SkRasterPipeline_opts.h", |
| 62 |
":textual_hdrs", |
| 63 |
], |
| 64 |
deps = [ |
| 65 |
"//modules/skcms", # Needed to implement SkRasterPipeline_opts.h |
| 66 |
"//src/base", |
| 67 |
"@skia_user_config//:user_config", |
| 68 |
], |
| 69 |
) |
| 70 |
|
| 71 |
skia_cc_library( |
| 72 |
name = "opts", |
| 73 |
visibility = ["//src/core:__pkg__"], |
| 74 |
deps = selects.with_or({ |
| 75 |
("@platforms//cpu:x86_64", "@platforms//cpu:x86_32"): [ |
| 76 |
":hsw", |
| 77 |
":skx", |
| 78 |
], |
| 79 |
"//bazel/common_config_settings:cpu_wasm": [], |
| 80 |
"//conditions:default": [], |
| 81 |
}), |
| 82 |
) |
| 83 |
|
| 84 |
skia_filegroup( |
| 85 |
name = "textual_hdrs", |
| 86 |
srcs = [ |
| 87 |
"SkBitmapProcState_opts.h", |
| 88 |
"SkBlitMask_opts.h", |
| 89 |
"SkBlitRow_opts.h", |
| 90 |
"SkMemset_opts.h", |
| 91 |
"SkOpts_RestoreTarget.h", |
| 92 |
"SkOpts_SetTarget.h", |
| 93 |
"SkRasterPipeline_opts.h", |
| 94 |
"SkSwizzler_opts.inc", |
| 95 |
], |
| 96 |
visibility = [ |
| 97 |
"//src/core:__pkg__", |
| 98 |
], |
| 99 |
) |