transcript browser wasm working

This commit is contained in:
Krzosa Karol
2025-08-03 12:03:28 +02:00
parent ff17114860
commit bb3859b537
20 changed files with 817 additions and 547 deletions

View File

@@ -6,7 +6,10 @@
// don't ever include stuff that build_file will generate code for!
#define DONT_INCLUDE_GENERATED_MATH
#include "src/core/core.h"
#include "src/os/os.h"
#include "src/core/core.c"
#include "src/os/os.c"
#define BUILD_TOOL_LIB
#define S8_String s8_t
@@ -28,7 +31,7 @@ void build_testing_target(void) {
}
if (PLATFORM_WINDOWS) {
os_delete_file(s8("testing.pdb"));
os_delete(s8("testing.pdb"));
int ok = os_systemf(
"cl ../src/testing/testing_main.c -Fe:testing.exe -Fd:testing.pdb"
" -I ../src"
@@ -86,7 +89,7 @@ void build_prototype_wasm_target(void) {
b32 html_code_modified = cache_code_modified(s8("../src/app/app_wasm.html"), s8("../package/index.html"));
b32 wasm_code_modified = cache_code_modified(s8("../src/prototype/main.c"), s8("main.wasm"));
if (html_code_modified) {
os_copy("../src/app/app_wasm.html", "../package/index.html", os_copy_overwrite);
os_copy(s8("../src/app/app_wasm.html"), s8("../package/index.html"), os_copy_overwrite);
}
if (wasm_code_modified) {
int ok = os_systemf(
@@ -97,7 +100,7 @@ void build_prototype_wasm_target(void) {
" --target=wasm32 -nostdlib -mbulk-memory -msimd128"
" -Wl,-export-dynamic,--allow-undefined,--import-memory,--no-entry,--initial-memory=131072000,--max-memory=4294967296"
);
os_copy("main.wasm", "../package/main.wasm", os_copy_overwrite);
os_copy(s8("main.wasm"), s8("../package/main.wasm"), os_copy_overwrite);
if (ok != 0) exit(ok);
}
}
@@ -128,9 +131,9 @@ void generate_math_code(ma_arena_t *arena) {
#define py "python3 "
#endif
os_set_working_dir("../src/core");
os_set_cwd(s8("../src/core"));
os_systemf(py "core_math_gen.py");
os_set_working_dir("../../build");
os_set_cwd(s8("../../build"));
}
int main(int argc, char **argv) {
@@ -149,9 +152,9 @@ int main(int argc, char **argv) {
generate_testing_code(&tcx->temp);
b32 run_win32_app_base_target = true;
b32 run_testing_target = true;
b32 run_prototype_dll_target = true;
b32 run_prototype_wasm_target = false;
b32 run_testing_target = false;
b32 run_prototype_dll_target = false;
b32 run_prototype_wasm_target = true;
b32 run_prototype_standalone_target = false;
b32 run_server = false;