Mercurial
view infinite_canvas/BUILD @ 277:1d99147f520c
Merge Qwen services and infinite canvas heads
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Mon, 17 Aug 2026 17:01:40 -0700 |
| parents | b55c22cff335 |
| children | 8d560f50ed4c |
line wrap: on
line source
load("@emsdk//emscripten_toolchain:wasm_rules.bzl", "wasm_cc_binary") load("@rules_cc//cc:cc_library.bzl", "cc_library") load("@rules_cc//cc:cc_test.bzl", "cc_test") load("@rules_shell//shell:sh_binary.bzl", "sh_binary") load("//gui_ze:gui_ze.bzl", "move_files_into_dir") load("//third_party/raylib:raylib.bzl", "raylib_binary") cc_library( name = "theme", srcs = ["theme.c"], hdrs = ["theme.h"], deps = [ "//dowa:dowa", "//third_party/raylib:raylib", ], linkopts = select({ "//config:windows": ["-ladvapi32"], "//conditions:default": [], }), ) cc_library( name = "canvas", srcs = ["canvas.c"], hdrs = ["canvas.h"], deps = [ "//dowa:dowa", ":theme", "//third_party/raylib:raylib", ], visibility = ["//visibility:public"], ) cc_library( name = "dev_ui", srcs = ["dev_ui.c"], hdrs = ["dev_ui.h"], deps = [ ":canvas", ":theme", "//third_party/raylib:raygui", ], ) cc_library( name = "web_surface", srcs = select({ "//config:linux": ["web_surface_native.cc"], "//config:macos": ["web_surface_native.cc"], "//config:windows": ["web_surface_native.cc"], "//conditions:default": ["web_surface_web.c"], }), hdrs = ["web_surface.h"], copts = select({ "//config:linux": ["-std=c++20"], "//config:macos": ["-std=c++20"], "//conditions:default": [], }), deps = [ ":canvas", ":theme", "//dowa:dowa", "//third_party/raylib:raylib", ] + select({ "//config:linux": [ "@cef//:cef", "@cef//:cef_wrapper", ], "//config:macos": ["@cef//:cef_wrapper"], "//config:windows": ["@cef//:cef_wrapper"], "//conditions:default": [], }), ) filegroup( name = "inter_font", srcs = ["assets/Inter-Variable.ttf"], ) filegroup( name = "fonts", srcs = [ ":inter_font", "assets/OFL.txt", ], ) filegroup( name = "image_placeholder", srcs = ["assets/image-placeholder.svg"], ) filegroup( name = "image_view", srcs = ["assets/image-view.html"], ) raylib_binary( name = "app_bin", srcs = ["main.c"], data = [ ":fonts", ":image_placeholder", ":image_view", ] + select({ "//config:linux": [ "@cef//:resources", "@cef//:sos", ], "//config:macos": ["@cef//:cef_framework"], "//config:windows": [ "@cef//:dlls", "@cef//:resources", ], "//conditions:default": [], }), deps = [ ":canvas", ":web_surface", "//dowa:dowa", "//third_party/raylib:raylib", ], ) raylib_binary( name = "dev_bin", srcs = ["main.c"], data = [ ":fonts", ":image_placeholder", ":image_view", ] + select({ "//config:linux": [ "@cef//:resources", "@cef//:sos", ], "//config:macos": ["@cef//:cef_framework"], "//config:windows": [ "@cef//:dlls", "@cef//:resources", ], "//conditions:default": [], }), defines = ["INFINITE_CANVAS_DEV_UI"], deps = [ ":canvas", ":dev_ui", ":theme", ":web_surface", "//dowa:dowa", "//third_party/raylib:raylib", ], ) sh_binary( name = "app_linux", srcs = ["run_native.sh"], data = [":app_bin"], ) sh_binary( name = "dev_linux", srcs = ["run_native.sh"], data = [":dev_bin"], ) alias( name = "app", actual = select({ "//config:linux": ":app_linux", "//conditions:default": ":app_bin", }), ) alias( name = "dev", actual = select({ "//config:linux": ":dev_linux", "//conditions:default": ":dev_bin", }), ) filegroup( name = "shell", srcs = ["index.html"], ) raylib_binary( name = "web_bin", srcs = ["main.c"], additional_linker_inputs = [ ":image_placeholder", ":inter_font", ], data = [ ":fonts", ":image_placeholder", ], defines = ["INFINITE_CANVAS_DEV_UI"], deps = [ ":canvas", ":dev_ui", ":web_surface", "//dowa:dowa", "//third_party/raylib:raylib", ], linkopts_wasm = [ "-sUSE_GLFW=3", "-sMIN_WEBGL_VERSION=2", "-sMAX_WEBGL_VERSION=2", "-sALLOW_MEMORY_GROWTH", "--preload-file=$(location :inter_font)@/infinite_canvas/assets/Inter-Variable.ttf", "--preload-file=$(location :image_placeholder)@/infinite_canvas/assets/image-placeholder.svg", ], ) wasm_cc_binary( name = "infinite_canvas_wasm", cc_target = ":web_bin", ) move_files_into_dir( name = "web_bundle", srcs = [ ":infinite_canvas_wasm", ":shell", ], dest = "web", ) cc_test( name = "canvas_test", srcs = ["canvas_test.c"], deps = [":canvas"], ) sh_binary( name = "serve", srcs = ["serve.sh"], data = [":web_bundle"], )