comparison markdown_converter/BUILD @ 185:dfdd66825396

Merged in keep alive changes and mrjunejune changes.
author MrJuneJune <me@mrjunejune.com>
date Fri, 23 Jan 2026 22:22:30 -0800
parents 8c74204fd362
children 8cf4ec5e2191
comparison
equal deleted inserted replaced
182:d6ab5921fedc 185:dfdd66825396
1 load("@rules_cc//cc:cc_library.bzl", "cc_library") 1 load("@rules_cc//cc:cc_library.bzl", "cc_library")
2 load("//gui_ze:gui_ze.bzl", "wasm_binary", "bun_run", "move_files_into_dir") 2 load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
3 load("//gui_ze:gui_ze.bzl", "bun_run", "move_files_into_dir")
4 load("@emsdk//emscripten_toolchain:wasm_rules.bzl", "wasm_cc_binary")
3 5
4 # JS only 6 # JS only
5 filegroup( 7 filegroup(
6 name = "markdown_to_html", 8 name = "markdown_to_html",
7 srcs = glob([ 9 srcs = glob([
8 "**/*.js", 10 "**/*.js",
9 ], allow_empty=True), 11 ], allow_empty=True),
16 "*.h", 18 "*.h",
17 ], allow_empty=True), 19 ], allow_empty=True),
18 visibility = ["//visibility:public"], 20 visibility = ["//visibility:public"],
19 ) 21 )
20 22
21 # C implementation for native use 23 # C implementation for native use (as library)
22 cc_library( 24 cc_library(
23 name = "markdown_to_html_c", 25 name = "markdown_to_html_c",
24 srcs = ["markdown_to_html.c"], 26 srcs = ["markdown_to_html.c"],
25 hdrs = [":markdown_to_html_hdrs"], 27 hdrs = [":markdown_to_html_hdrs"],
26 visibility = ["//visibility:public"], 28 visibility = ["//visibility:public"],
27 ) 29 )
30
31 # WASM binary target (cc_binary required for wasm_cc_binary)
32 # Note: linkopts are emscripten-specific, only apply during WASM build
33 cc_binary(
34 name = "markdown_to_html_bin",
35 srcs = ["markdown_to_html.c", "markdown_to_html.h"],
36 linkopts = [
37 "--no-entry", # No main() function
38 "-sALLOW_MEMORY_GROWTH", # Allow memory to grow dynamically
39 "-sEXPORTED_FUNCTIONS=['_markdown_to_html','_markdown_free','_markdown_get_length','_wasm_alloc','_wasm_free']",
40 "-sEXPORTED_RUNTIME_METHODS=['cwrap','ccall','UTF8ToString','stringToUTF8','lengthBytesUTF8']",
41 ],
42 tags=["manual"],
43 )
44
45 wasm_cc_binary(
46 name = "markdown_to_html_wasm",
47 cc_target = ":markdown_to_html_bin",
48 visibility = ["//visibility:public"],
49 )