| load("//bazel:macros.bzl", "py_binary") |
| load("//bazel:skia_rules.bzl", "exports_files_legacy", "skia_cc_library", "skia_objc_library") |
| |
| package( |
| default_applicable_licenses = ["//:license"], |
| ) |
| |
| licenses(["notice"]) |
| |
| exports_files_legacy(label_list = [ |
| "ToolUtils.h", |
| "ToolUtils.cpp", |
| "SkMetaData.h", |
| "SkMetaData.cpp", |
| "Registry.h", |
| "Resources.h", |
| "Resources.cpp", |
| "ResourceFactory.h", |
| ]) |
| |
| skia_cc_library( |
| name = "legacy_tool_utils", |
| testonly = True, |
| srcs = [ |
| "EncodeUtils.cpp", |
| "DecodeUtils.cpp", |
| "GpuToolUtils.cpp", |
| "Resources.cpp", |
| "ToolUtils.cpp", |
| "ResourceFactory.h", |
| "//tools/flags", |
| # TODO(kjlubick, bungeman): We should split out the font stuff into its own set of files |
| "//tools/fonts:test_font_manager_srcs", |
| "SkMetaData.cpp", |
| ], |
| hdrs = [ |
| "CodecUtils.h", |
| "DecodeUtils.h", |
| "EncodeUtils.h", |
| "GpuToolUtils.h", |
| "Resources.h", |
| "SkMetaData.h", |
| "ToolUtils.h", |
| ], |
| textual_hdrs = [ |
| "//tools/fonts:test_fonts", |
| ], |
| visibility = ["//:__subpackages__"], |
| deps = [ |
| "//:skia_internal", |
| ], |
| ) |
| |
| skia_cc_library( |
| name = "registry", |
| hdrs = ["Registry.h"], |
| visibility = [ |
| "//bench:__pkg__", |
| "//gm:__pkg__", |
| "//tests:__subpackages__", |
| "//tools/testrunners/benchmark:__pkg__", |
| "//tools/viewer:__pkg__", |
| ], |
| deps = ["//:core"], |
| ) |
| |
| skia_cc_library( |
| name = "hash_and_encode", |
| testonly = True, |
| srcs = ["HashAndEncode.cpp"], |
| hdrs = ["HashAndEncode.h"], |
| visibility = ["//gm:__pkg__"], |
| deps = [ |
| "//:core", |
| "//:png_encode_codec", |
| "//tools/flags:cmd_flags", |
| ], |
| ) |
| |
| py_binary( |
| name = "embed_resources", |
| srcs = ["embed_resources.py"], |
| visibility = ["//:__subpackages__"], |
| ) |
| |
| skia_cc_library( |
| name = "autorelease_pool", |
| hdrs = ["AutoreleasePool.h"], |
| visibility = [ |
| "//bench:__pkg__", |
| "//tools/gpu:__pkg__", |
| "//tools/testrunners/benchmark:__pkg__", |
| ], |
| ) |
| |
| skia_objc_library( |
| name = "autorelease_pool_objc", |
| srcs = ["AutoreleasePool.mm"], |
| hdrs = ["AutoreleasePool.h"], |
| visibility = ["//tools/gpu:__pkg__"], |
| ) |
| |
| skia_cc_library( |
| name = "url_data_manager", |
| srcs = ["UrlDataManager.cpp"], |
| hdrs = ["UrlDataManager.h"], |
| visibility = ["//tools/debugger:__pkg__"], |
| deps = ["//:core"], |
| ) |
| |
| skia_cc_library( |
| name = "sk_sharing_proc", |
| srcs = ["SkSharingProc.cpp"], |
| hdrs = ["SkSharingProc.h"], |
| visibility = ["//tools/debugger:__pkg__"], |
| deps = [ |
| "//:core", |
| "//:png_decode_codec", |
| "//:png_encode_codec", |
| ], |
| ) |
| |
| skia_cc_library( |
| name = "mskp_player", |
| srcs = ["MSKPPlayer.cpp"], |
| hdrs = ["MSKPPlayer.h"], |
| visibility = ["//tools/viewer:__pkg__"], |
| deps = [ |
| ":sk_sharing_proc", |
| "//:skia_internal", |
| ], |
| ) |
| |
| skia_cc_library( |
| name = "runtime_blend_utils", |
| srcs = ["RuntimeBlendUtils.cpp"], |
| hdrs = ["RuntimeBlendUtils.h"], |
| visibility = [ |
| "//tests:__pkg__", |
| "//tools/viewer:__pkg__", |
| ], |
| deps = ["//:skia_internal"], |
| ) |
| |
| skia_cc_library( |
| name = "get_executable_path", |
| srcs = select({ |
| "@platforms//os:windows": ["SkGetExecutablePath_win.cpp"], |
| "@platforms//os:macos": ["SkGetExecutablePath_mac.cpp"], |
| "@platforms//os:linux": ["SkGetExecutablePath_linux.cpp"], |
| }), |
| hdrs = ["SkGetExecutablePath.h"], |
| visibility = [ |
| "//src/sksl:__pkg__", |
| "//tools/sksl-minify:__pkg__", |
| ], |
| ) |
| |
| skia_cc_library( |
| name = "stats", |
| srcs = ["ProcStats.cpp"], |
| hdrs = [ |
| "ProcStats.h", |
| "Stats.h", |
| ], |
| visibility = [ |
| "//bench:__pkg__", |
| "//tools/testrunners/benchmark:__pkg__", |
| ], |
| deps = ["//:core"], |
| ) |
| |
| skia_cc_library( |
| name = "tool_utils", |
| testonly = True, |
| srcs = [ |
| "SkMetaData.cpp", |
| "ToolUtils.cpp", |
| ], |
| hdrs = [ |
| "SkMetaData.h", |
| "ToolUtils.h", |
| ], |
| visibility = [ |
| "//bench:__subpackages__", |
| "//gm:__subpackages__", |
| "//tools:__subpackages__", |
| ], |
| deps = [ |
| "//:core", |
| "//src/base", |
| "//src/core:core_priv", |
| ], |
| ) |
| |
| skia_cc_library( |
| name = "codec_utils", |
| testonly = True, |
| srcs = [ |
| "DecodeUtils.cpp", |
| "EncodeUtils.cpp", |
| ], |
| hdrs = [ |
| "DecodeUtils.h", |
| "EncodeUtils.h", |
| ], |
| visibility = [ |
| "//gm:__subpackages__", |
| ], |
| deps = [ |
| "//:core", |
| "//:png_decode_codec", |
| "//:png_encode_codec", |
| "//src/base", |
| "//src/core:core_priv", |
| "//tools:resources", |
| ], |
| ) |
| |
| skia_cc_library( |
| name = "resources", |
| testonly = True, |
| srcs = [ |
| "Resources.cpp", |
| ], |
| hdrs = [ |
| "Resources.h", |
| ], |
| visibility = [ |
| "//bench:__subpackages__", |
| "//tools:__subpackages__", |
| ], |
| deps = [ |
| "//:core", |
| "//src/base", |
| "//src/core:core_priv", |
| "//tools/flags:cmd_flags", |
| ], |
| ) |
| |
| # Regenerate workarounds with `bazel run //tools:generate_workarounds` |
| py_binary( |
| name = "generate_workarounds", |
| srcs = [":generate_workarounds.py"], |
| args = [ |
| "--output-file", |
| "include/gpu/GrDriverBugWorkaroundsAutogen.h", |
| "src/gpu/gpu_workaround_list.txt", |
| ], |
| data = [ |
| ":build_workaround_header", |
| ], |
| tags = ["no-remote"], |
| ) |
| |
| py_binary( |
| name = "build_workaround_header", |
| srcs = ["build_workaround_header.py"], |
| ) |
| |
| _GENERATE_WORKAROUNDS = """ |
| import os |
| import subprocess |
| import sys |
| |
| # https://bazel.build/docs/user-manual#running-executables |
| # Note: Bazel eats single quotes, so we must use double quotes. |
| os.chdir(os.environ["BUILD_WORKSPACE_DIRECTORY"]) |
| |
| # execpath returns the path to the given label relative to the Skia root. |
| # This will be something like: |
| # bazel-out/k8-opt-exec-81C6BA4F/bin/tools/build_workaround_header |
| # https://bazel.build/reference/be/make-variables#predefined_label_variables |
| generate_script = os.path.abspath("$(execpath :build_workaround_header)") |
| |
| result = subprocess.run( |
| [generate_script] + sys.argv[1:], capture_output=True, encoding="utf-8") |
| if result.returncode != 0: |
| print(result.stdout) |
| print(result.stderr) |
| sys.exit(result.returncode) |
| """ |
| |
| genrule( |
| name = "create_generate_workarounds_script", |
| outs = ["generate_workarounds.py"], |
| cmd = "echo '%s' > $@" % _GENERATE_WORKAROUNDS, |
| tools = [":build_workaround_header"], |
| ) |
| |
| skia_cc_library( |
| name = "full_build", |
| testonly = True, |
| srcs = [ |
| # These are *not* skia_cc_library targets because we'd have to set the deps |
| # for them, which is redundent. Thus we just compile them as a list of files |
| # and the deps specified below should be sufficient for them. |
| "//include/core:headers_to_compile", |
| "//include/effects:headers_to_compile", |
| "//include/encode:headers_to_compile", |
| "//include/gpu/ganesh:headers_to_compile", |
| "//include/gpu:headers_to_compile", |
| "//include/private/base:headers_to_compile", |
| "//include/private/chromium:headers_to_compile", |
| "//include/private/gpu/ganesh:headers_to_compile", |
| "//include/private:headers_to_compile", |
| "//src/base:headers_to_compile", |
| "//src/codec:headers_to_compile", |
| "//src/core:headers_to_compile", |
| "//src/encode:headers_to_compile", |
| "//src/gpu/ganesh/geometry:headers_to_compile", |
| "//src/gpu/ganesh/mock:headers_to_compile", |
| "//src/gpu/ganesh:headers_to_compile", |
| "//src/gpu/tessellate:headers_to_compile", |
| "//src/gpu:headers_to_compile", |
| #"//src/pdf:headers_to_compile", # TODO(kjlubick) add module for pdf |
| ], |
| copts = [ |
| # Since we are generating .cpp files for headers, some variables/functions which |
| # were properly declared static could be mis-interpreted to be unused. We don't |
| # want to fail on that. Therefore, we do not want warnings about those unused |
| # things to be flagged. |
| "-Wno-unused-function", |
| "-Wno-unused-template", |
| "-Wno-unused-const-variable", |
| ], |
| # This is not intended to be used for tests or anything, just for IWYU |
| visibility = ["//visibility:private"], |
| deps = [ |
| "//:bmp_decode_codec", |
| "//:core", |
| "//:fontmgr_data_freetype", |
| "//:fontmgr_directory_freetype", |
| "//:fontmgr_empty_freetype", |
| "//:gif_decode_codec", |
| "//:ico_decode_codec", |
| "//:jpeg_decode_codec", |
| "//:jpeg_encode_codec", |
| "//:jpegxl_decode_codec", |
| "//:pathops", |
| "//:png_decode_codec", |
| "//:png_encode_codec", |
| "//:skparagraph_harfbuzz_unicode", |
| "//:skresources", |
| "//:skshaper_core", |
| "//:skshaper_harfbuzz", |
| "//:skshaper_unicode", |
| "//:skunicode_core", |
| "//:skunicode_icu", |
| "//:svg_renderer", |
| "//:wbmp_decode_codec", |
| "//:webp_decode_codec", |
| "//:webp_encode_codec", |
| "//src/gpu/ganesh/gl:ganesh_gl_TEST_UTIL", |
| "//src/gpu/ganesh/vk:ganesh_vulkan_TEST_UTIL", |
| ], |
| ) |