skia2/tools
Kevin Lubick 1f8c31b101 [infra] Add initial Bazel rules and files
These rules can be used to build our GMs on WASM+WebGL and
libskia.a with just the CPU backend (and most other features
turned off).

This can be done with the following commands:
  - bazel build //modules/canvaskit:gm-bindings-wasm --gpu_backend=gl_backend --with_gl_standard=webgl_standard
  - bazel build :skia-core --config clang

This pivots slightly from http://review.skia.org/463517
by using config_settings [1] instead of platforms for
the optional features that we control. This pivot was
suggested in [2]

We have BUILD.bazel files in many of the subdirectories
that specify filegroups for the appropriate files. In
an effort to make //BUILD.bazel more readable, it is
the responsibility of these subfolders to deal with
conditionally including certain .h or .cpp files.
This is done using select statements and config_settings
or platform constraints as necessary.

For example, src/gpu/BUILD.bazel will different private
filegroups for each of the supported gpu backends [3]
and a more-visible filegroup called "srcs" that has
the right selection of the private files to be used
for compilation.

An effort has been made to avoid using glob() in our
BUILD.bazel files. These file lists were made by using
`ls -1` and some regex to add in quotes. We might want
to make a helper script to assist with that, if necessary.

To specify which options we have, the settings in
//bazel/common_config_settings/BUILD.bazel have been
redesigned. They make use of a macro `string_flag_with_values`
that removes the boilerplate. Patchset 36 shows what the
file looks like w/o the macro.

The top level BUILD.bazel file will still need to use
some logic to handle defines, because local_defines is
a list of strings, not a list of labels [4].

Suggested Review Order:
  - WORKSPACE.bazel to see the new dependencies on the
    emsdk toolchain and bazel_skylib
  - bazel/common_config_settings/* to see the few settings
    defined (we have more to define, see BUILD.gn and
    //gn/skia.gni for ideas)
  - BUILD.bazel to see the "skia-core" cc_library rule.
    See also "gms" and "tests"
  - modules/canvaskit/BUILD.bazel to see the use of
    the emscripten "wasm_cc_binary" rule, which depends
    on the "skia-core", "gms", and "tests" rule. Note that
    it only builds some of the gms as a proof of concept.
  - The other BUILD.bazel files. Some of these are not
    platform or feature dependent (e.g. pathops). Others
    are (e.g. gpu).
  - All other files.

[1] https://docs.bazel.build/versions/4.2.1/skylark/config.html#user-defined-build-settings
[2] https://github.com/emscripten-core/emsdk/pull/920
[3] In this CL, that's just the webgl one.
[4] https://docs.bazel.build/versions/main/be/c-cpp.html#cc_library.local_defines

Change-Id: Ieecf9c106d5e3a6ae97d13d66be06b4b3c207089
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/458637
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
Owners-Override: Kevin Lubick <kjlubick@google.com>
2021-11-09 12:32:25 +00:00
..
android Fix Python3 compatibility 2021-03-25 14:15:35 +00:00
calmbench Update references to master branch 2021-05-21 15:18:16 +00:00
copyright Fix Python3 compatibility 2021-03-25 14:15:35 +00:00
debugger Fix #ifdef SK_SUPPORT_GPU to be #if 2021-11-08 15:14:28 +00:00
doxygen Include svg module in Doxygen generated output. 2021-01-06 16:40:09 +00:00
fiddle Move sk_memset* from SkUtils to SkOpts 2021-11-03 17:03:21 +00:00
flags [graphite] Expand shader precompilation placeholder 2021-10-27 18:43:52 +00:00
fm Use CommonFlags namespace for other flags/functions 2021-10-14 14:34:21 +00:00
fonts Serialize foreground color caching requirement specialisation 2021-11-03 19:56:47 +00:00
gdb
gpu [graphite] Add IndexWriter and UniformWriter classes. 2021-10-27 00:20:38 +00:00
graphite [graphite] Fix commandqueue memory leak 2021-10-13 19:42:51 +00:00
infra
lottie-web-perf HTML typo egde => edge 2020-06-19 15:12:06 +00:00
lottiecap HTML typo egde => edge 2020-06-19 15:12:06 +00:00
malisc Fix Python3 compatibility 2021-03-25 14:15:35 +00:00
mdbviz
perf-canvaskit-puppeteer [canvaskit] Remove deprecated MakeTypefaceFromData and RefDefault 2021-10-21 16:45:42 +00:00
rebaseline Fix Python3 compatibility 2021-03-25 14:15:35 +00:00
run-wasm-gm-tests Reland "Purge ccpr" 2021-06-19 18:42:38 +00:00
sk_app Move UTF16 helpers from SkUtils to SkUTF 2021-11-03 17:03:21 +00:00
skdiff Fix cases of variable shadowing in /tools/. 2021-08-11 16:05:52 +00:00
skiaserve deprecate getTotalMatrix 2020-12-03 17:37:35 +00:00
skottie_ios_app roll gn to latest 2021-01-15 15:34:00 +00:00
skottie-wasm-perf Reland "[canvaskit] Change SkRects to be arrays, not objects." 2020-09-03 14:31:38 +00:00
skp Add skia_motionmarksuites_desktop.py 2021-07-29 19:16:05 +00:00
skpbench Use CommonFlags namespace for other flags/functions 2021-10-14 14:34:21 +00:00
skqp Name Test struct's member variables consistently 2021-10-13 17:37:39 +00:00
skui Enable ClangTidy check llvm-namespace-comment. 2020-08-06 19:07:52 +00:00
svg Fix Python3 compatibility 2021-03-25 14:15:35 +00:00
timer
trace Reland "Add format-specifier warnings to SkDebugf." 2021-06-25 17:57:43 +00:00
viewer Add disassembly to skvm debug panel 2021-11-05 17:09:44 +00:00
__init__.py
abandon_gerrit_cls.py
add_codereview_message.py
AndroidSkDebugToStdOut.cpp
AutoreleasePool.h
AutoreleasePool.mm
bloaty_treemap.py Update bloaty treemap to work on Python < 3.9. 2021-09-13 17:20:49 +00:00
blob_cache_sim.cpp
build_command_buffer.py
BUILD_simulator.py
build_workaround_header.py Correct a typo in build_workaround_header.py 2021-07-29 13:06:01 +00:00
BUILD.bazel [infra] Add initial Bazel rules and files 2021-11-09 12:32:25 +00:00
check-headers-self-sufficient
chrome_fuzz.cpp
clang-tidy.sh
compare_codereview.py
convert-to-nia.cpp Add convert-to-nia command-line program 2020-05-28 15:08:08 +00:00
cpu_modules.cpp
CrashHandler.cpp Reland "Add format-specifier warnings to SkDebugf." 2021-06-25 17:57:43 +00:00
CrashHandler.h
DDLPromiseImageHelper.cpp Reland "Remove GrBackendFormat's textureType use from isFormatTexturable call." 2021-08-13 22:37:13 +00:00
DDLPromiseImageHelper.h Only include SkJSONWriter when SK_ENABLE_DUMP_GPU defined 2021-11-02 16:17:17 +00:00
DDLTileHelper.cpp Reland "Remove GrBackendFormat's textureType use from isFormatTexturable call." 2021-08-13 22:37:13 +00:00
DDLTileHelper.h Move SkSpan to include/, for use in public API 2021-05-12 13:19:32 +00:00
doxygen_footer.txt
dump_record.cpp Fix cases of variable shadowing in /tools/. 2021-08-11 16:05:52 +00:00
embed_resources.py Tweak scripts to fix CK builds with python 3 2020-06-29 12:59:05 +00:00
find_run_binary.py
fix_pythonpath.py
force_older_glibc_math.h
gcov_shim
get_current_monitor_profile.cpp
get_images_from_skps.cpp
git-sync-deps fix git-sync-deps 2021-04-09 15:52:57 +00:00
HashAndEncode.cpp Reland "Add sRGB 8888 colortype" 2021-08-24 12:56:32 +00:00
HashAndEncode.h [canvaskit] POC bindings for testing gms 2020-10-08 16:03:08 +00:00
image_diff_metric.cpp
imgcvt.cpp
install_dependencies.sh Add optional --yes argument to tools/install_dependencies.sh. 2021-01-05 16:30:22 +00:00
ios_utils.h
ios_utils.m
jsondiff.py
list_gms.cpp
list_gpu_unit_tests.cpp Name Test struct's member variables consistently 2021-10-13 17:37:39 +00:00
LsanSuppressions.cpp stifle leaks in terminator_CreateDevice() 2020-04-08 15:28:48 +00:00
merge_static_libs.py Fix Python3 compatibility 2021-03-25 14:15:35 +00:00
milestone.py Update references to master branch 2021-05-21 15:18:16 +00:00
mirror-dev.sh
misc_utils.py
MSKPPlayer.cpp Move canvas helper structs to header 2021-08-10 17:53:16 +00:00
MSKPPlayer.h Move canvas helper structs to header 2021-08-10 17:53:16 +00:00
OverwriteLine.h
parse_llvm_coverage.py
pathops_sorter.htm
pathops_visualizer.htm
ProcStats.cpp Add heap usage of SkSL::Compiler to nanobench output 2020-07-09 00:05:28 +00:00
ProcStats.h Add heap usage of SkSL::Compiler to nanobench output 2020-07-09 00:05:28 +00:00
public_headers_warnings_check.cpp
random_parse_path.cpp Fix cases of variable shadowing in /tools/. 2021-08-11 16:05:52 +00:00
random_parse_path.h
reformat-json.py Fix Python3 compatibility 2021-03-25 14:15:35 +00:00
Registry.h
remote_demo.cpp Remove SkTextBlobDiffCanvas, use tracking device directly with base SkCanvas 2021-05-06 16:11:57 +00:00
ResourceFactory.h
Resources.cpp
Resources.h
retrieve_from_googlesource.py Update references to master branch 2021-05-21 15:18:16 +00:00
rewrite_includes.py Fix rewrite_includes to work in both Python 2 and 3. 2021-08-17 11:53:50 +00:00
RuntimeBlendUtils.cpp Convert internal SkSL to use .eval() 2021-09-03 15:54:54 +00:00
RuntimeBlendUtils.h Simplify GetRuntimeBlendForBlendMode. 2021-07-30 16:42:36 +00:00
sanitize_source_files.py Fix Python3 compatibility 2021-03-25 14:15:35 +00:00
serve_wasm.py [infra] Deduplicate serve.py 2021-10-12 11:42:50 +00:00
SkMetaData.cpp Move fontmgr_bounds labels to tight bounds 2020-08-24 15:02:44 +00:00
SkMetaData.h Move fontmgr_bounds labels to tight bounds 2020-08-24 15:02:44 +00:00
skottie2movie.cpp Fix skottie2movie gpu async crash 2021-09-11 15:49:19 +00:00
skp_parser.cpp
skpinfo.cpp Print out picture version even if its unsupported 2021-07-20 00:11:39 +00:00
SkSharingProc.cpp Support building on clang with -std=c++14 but no C++17 extension warning. 2021-10-12 16:34:30 +00:00
SkSharingProc.h Accept a callback used in MultiPictureDocument::endPage 2021-01-06 16:52:50 +00:00
Stats.h Update SkTQSort to use half-open ranges. 2020-07-14 22:13:59 +00:00
test_all.py Fix Python3 compatibility 2021-03-25 14:15:35 +00:00
test_pdfs.py
ToolUtils.cpp Extract ToolUtils::sniff_paths 2021-10-19 17:39:11 +00:00
ToolUtils.h Extract ToolUtils::sniff_paths 2021-10-19 17:39:11 +00:00
UrlDataManager.cpp
UrlDataManager.h Enable ClangTidy check readability-redundant-smartptr-get. 2020-08-16 15:56:48 +00:00
using_skia_and_harfbuzz.cpp Support building on clang with -std=c++14 but no C++17 extension warning. 2021-10-12 16:34:30 +00:00
valgrind.supp Add another make_get_error_with_random_oom valgrind suppression 2020-06-24 22:15:33 +00:00
win_dbghelp.cpp Remove "dummy" to comply with Android's inclusive language guidance 2020-07-31 19:11:23 +00:00
win_dbghelp.h
win_lcid.cpp
xsan.supp rename tools/xsan.blacklist 2020-07-24 18:12:31 +00:00