diff color_game/BUILD @ 179:8d17f6e6e290

[ThirdParty] Added emsdk bazel rules that can be supported by bazel 9.0.0
author MrJuneJune <me@mrjunejune.com>
date Thu, 22 Jan 2026 21:23:17 -0800
parents 655ea0b661fd
children
line wrap: on
line diff
--- a/color_game/BUILD	Thu Jan 22 20:10:30 2026 -0800
+++ b/color_game/BUILD	Thu Jan 22 21:23:17 2026 -0800
@@ -1,4 +1,10 @@
 load("//third_party/raylib:raylib.bzl", "raylib_binary")
+load("@emsdk//emscripten_toolchain:wasm_rules.bzl", "wasm_cc_binary")
+
+filegroup(
+  name = "wasm_html",
+  srcs = ["index.html"],
+)
 
 raylib_binary(
   name = "main",
@@ -7,5 +13,16 @@
     "//third_party/raylib:raylib",
     "//dowa:dowa",
   ],
+  linkopts_wasm = [
+      "-sUSE_GLFW=3",      # Tells Emscripten to provide GLFW3 compatibility
+      "-sUSE_WEBGL2=1",    # Enables WebGL2 support
+      "-sASYNCIFY",        # Often needed for Raylib's main loop if not using emscripten_set_main_loop
+  ],
+  data=[":wasm_html"],
   static = True
 )
+
+wasm_cc_binary(
+  name = "wasm",
+  cc_target = ":main",
+)