| load("//bazel:macros.bzl", "exports_files_legacy", "generate_cpp_files_for_headers", "skia_filegroup") |
| |
| licenses(["notice"]) |
| |
| exports_files_legacy() |
| |
| skia_filegroup( |
| name = "public_hdrs", |
| srcs = [ |
| "//include/android:public_hdrs", |
| "//include/codec:public_hdrs", |
| "//include/config:public_hdrs", |
| "//include/core:public_hdrs", |
| "//include/docs:public_hdrs", |
| "//include/effects:public_hdrs", |
| "//include/encode:public_hdrs", |
| "//include/pathops:public_hdrs", |
| "//include/ports:public_hdrs", |
| "//include/utils:public_hdrs", |
| ] + select({ |
| "//src/sksl:needs_sksl": ["//include/sksl:public_hdrs"], |
| "//conditions:default": [], |
| }) + select({ |
| "//src/gpu:has_gpu_backend": ["//include/gpu:public_hdrs"], |
| "//conditions:default": [], |
| }) + select({ |
| "//src/svg:enable_svg_canvas_true": ["//include/svg:public_hdrs"], |
| "//conditions:default": [], |
| }), |
| visibility = [ |
| "//:__pkg__", |
| "//src/opts:__pkg__", |
| ], |
| ) |
| |
| skia_filegroup( |
| name = "private_hdrs", |
| srcs = [ |
| "//include/private:private_hdrs", |
| ], |
| visibility = [ |
| "//:__pkg__", |
| "//src/opts:__pkg__", |
| ], |
| ) |
| |
| skia_filegroup( |
| name = "srcs", |
| srcs = select({ |
| # These sources are not checked in - Bazel generates them dynamically. We only want to |
| # generate and compile them when we are doing compile-time analysis, e.g. IWYU. |
| "//bazel/common_config_settings:compile_generated_cpp_files_for_headers_true": [ |
| ":generated_srcs", |
| ], |
| # If filegroups are empty and used in a cc_library, Bazel throws an error. So we have to |
| # put something here. |
| "//conditions:default": [":private_hdrs"], |
| }), |
| visibility = ["//:__pkg__"], |
| ) |
| |
| generate_cpp_files_for_headers( |
| name = "generated_srcs", |
| headers = [ |
| ":public_hdrs", |
| ":private_hdrs", |
| ], |
| # All headers listed here (using paths relative to the Skia root) will have a .cpp file |
| # generated that is a copy of the header file just with a .cpp suffix so Bazel will try to |
| # compile it. This allows us to run IWYU on these files. |
| to_generate = [ |
| "include/config/SkUserConfig.h", |
| "include/core/SkAlphaType.h", |
| "include/core/SkBlendMode.h", |
| "include/core/SkBlurTypes.h", |
| "include/core/SkCoverageMode.h", |
| "include/core/SkFontStyle.h", |
| "include/core/SkFontTypes.h", |
| "include/core/SkPathTypes.h", |
| "include/core/SkRefCnt.h", |
| "include/core/SkScalar.h", |
| "include/core/SkSize.h", |
| "include/core/SkTypes.h", |
| "include/gpu/GrTypes.h", |
| "include/private/SkFixed.h", |
| "include/private/SkIDChangeListener.h", |
| "include/private/SkWeakRefCnt.h", |
| ], |
| ) |