1load("@emsdk//emscripten_toolchain:wasm_rules.bzl", "wasm_cc_binary") 2load("//bazel:cc_binary_with_flags.bzl", "cc_binary_with_flags") 3load("//bazel:skia_rules.bzl", "exports_files_legacy") 4 5package( 6 default_applicable_licenses = ["//:license"], 7) 8 9licenses(["notice"]) 10 11exports_files_legacy() 12 13LINKOPTS = [ 14 "-sALLOW_MEMORY_GROWTH", 15 "-sUSE_PTHREADS=0", # Disable pthreads 16 "-sMODULARIZE", 17 "-sDISABLE_EXCEPTION_CATCHING", # Disable all exception catching 18 "-sWASM", 19 "-sMAX_WEBGL_VERSION=2", 20 "-sFORCE_FILESYSTEM=0", 21 "-sFILESYSTEM=0", 22 "-sASSERTIONS", # Turn on assertions 23 "-sGL_ASSERTIONS", 24 "-sEXPORT_NAME=HelloWorld", 25] 26 27cc_binary_with_flags( 28 name = "hello_world.webgl", 29 srcs = [ 30 "//example:HelloWorld.cpp", 31 ], 32 linkopts = LINKOPTS, 33 set_flags = { 34 "gpu_backend": [ 35 "gl_ganesh", 36 ], 37 "with_gl_standard": [ 38 "webgl_standard", 39 ], 40 }, 41 # This target won't build successfully on its own because of missing emscripten 42 # headers etc. Therefore, we hide it from wildcards. 43 tags = ["manual"], 44 deps = [ 45 "//:skia_public", 46 "//tools/sk_app:legacy_sk_app", 47 ], 48) 49 50wasm_cc_binary( 51 name = "hello_world_wasm", 52 cc_target = ":hello_world.webgl", 53) 54