103 lines
3.3 KiB
C
103 lines
3.3 KiB
C
#include "src/core/core_inc.h"
|
|
#include "src/core/core_inc.c"
|
|
|
|
#define BUILD_TOOL_LIB
|
|
#define S8_String s8_t
|
|
#include "src/meta/build_tool.c"
|
|
#include "src/meta/parser.c"
|
|
#include "src/meta/serialize.c"
|
|
#include "src/app/app.meta.c"
|
|
|
|
void list_files_recursive(sb8_t *sb, s8_t path) {
|
|
for (OS_FileIter iter = OS_IterateFiles(&Perm, path); OS_IsValid(iter); OS_Advance(&iter)) {
|
|
if (iter.is_directory) {
|
|
list_files_recursive(sb, iter.absolute_path);
|
|
} else {
|
|
sb8_append(sb, iter.absolute_path);
|
|
}
|
|
}
|
|
}
|
|
|
|
int main(int argc, char **argv) {
|
|
int ok = 0;
|
|
|
|
ma_arena_t *arena = ma_create(ma_default_reserve_size);
|
|
meta_app(arena);
|
|
|
|
bool execute_python_snippets = true; // make sure to not abuse just for quick maths
|
|
bool run_server = false;
|
|
|
|
bool core_test_target = true;
|
|
bool win32_target = false;
|
|
bool wasm_target = false;
|
|
|
|
if (execute_python_snippets) {
|
|
sb8_t *sb = sb8_serial_begin(arena);
|
|
list_files_recursive(sb, s8_lit(".."));
|
|
for (sb8_node_t *it = sb->first; it; it = it->next) {
|
|
s8_t abs = it->string;
|
|
|
|
bool is_c_file = s8_ends_with(abs, s8_lit(".c"), true) || s8_ends_with(abs, s8_lit(".cpp"), true) || s8_ends_with(abs, s8_lit(".h"), true) || s8_ends_with(abs, s8_lit(".hpp"), true);
|
|
if (!is_c_file) {
|
|
continue;
|
|
}
|
|
bool is_build_file = s8_ends_with(abs, s8_lit("build_file.c"), true);
|
|
if (is_build_file) {
|
|
continue;
|
|
}
|
|
|
|
s8_t file = OS_ReadFile(&Perm, abs);
|
|
i64 idx = s8_find(file, s8_lit("/*#"), 0);
|
|
if (idx != -1) {
|
|
os_systemf("\"D:\\dev\\apps\\bin\\pyorun.bat\" %s", abs.str);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (run_server) {
|
|
os_systemf("start /D ..\\package ..\\package\\run_server.bat");
|
|
}
|
|
|
|
if (win32_target) {
|
|
os_delete_file(s8_lit("win32_app.pdb"));
|
|
ok = os_systemf(
|
|
"cl ../src/app/app_win32.c -Fe:win32_app.exe -Fd:win32_app.pdb"
|
|
" -I ../src"
|
|
" /Zi /FC /nologo /Oi"
|
|
" /WX /W3 /wd4200 /diagnostics:column"
|
|
" /link /incremental:no"
|
|
);
|
|
if (ok != 0) return ok;
|
|
}
|
|
|
|
if (core_test_target) {
|
|
os_delete_file(s8_lit("core_test.pdb"));
|
|
ok = os_systemf(
|
|
"cl ../src/core/core_test_entry.c -Fe:core_test.exe -Fd:core_test.pdb"
|
|
" -I ../src"
|
|
" /Zi /FC /nologo /Oi"
|
|
" /WX /W3 /wd4200 /diagnostics:column"
|
|
" /link /incremental:no"
|
|
);
|
|
if (ok != 0) return ok;
|
|
|
|
ok = os_systemf("core_test.exe");
|
|
return ok;
|
|
}
|
|
|
|
|
|
if (wasm_target) {
|
|
os_copy("../src/app/app_wasm.html", "../package/index.html", os_copy_overwrite);
|
|
ok = os_systemf(
|
|
"clang.exe ../src/wasm_app/main.c -o main.wasm"
|
|
" -Oz -g -I../src"
|
|
" -Wall -Wno-missing-braces"
|
|
" -fdiagnostics-absolute-paths -fdiagnostics-format=msvc"
|
|
" --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);
|
|
if (ok != 0) return ok;
|
|
}
|
|
return ok;
|
|
} |