for /f "delims=" %%i in ('cd') do set PWD=%%i
set LINK_OPTIONS="%PWD%\shared\lib\windows_x86_64\lib\wasmer.lib" ws2_32.lib Advapi32.lib userenv.lib bcrypt.lib kernel32.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrtd.lib
-set FLAGS=%FLAGS% "/I%PWD%\shared\include" /DENABLE_RUN_WITH_WASMER=1
+set FLAGS=%FLAGS% "/I%PWD%\shared\include" /DONYX_RUNTIME_LIBRARY=wasmer
rc.exe misc/icon_resource.rc
cl.exe %FLAGS% /Icompiler/include /std:c17 /TC %SOURCE_FILES% /link /IGNORE:4217 %LINK_OPTIONS% /DEBUG /OUT:onyx.exe /incremental:no /opt:ref /subsystem:console misc\icon_resource.res
mkdir dist
xcopy core dist\core /s /e /h /I
xcopy examples dist\examples /s /e /h /I
- @REM xcopy misc dist\misc /s /e /h /I
+
+ mkdir dist\misc
+ copy misc\onyx-windows.sublime-build dist\misc\onyx-windows.sublime-build
+ copy misc\onyx-mode.el dist\misc\onyx-mode.el
+ copy misc\onyx.sublime-syntax dist\misc\onyx.sublime-syntax
+ copy misc\vscode\onyx-0.1.8.vsix dist\misc\onyx-0.1.8.vsix
+
copy onyx_runtime.dll dist\onyx_runtime.dll
xcopy tests dist\tests /s /e /h /I
copy onyx.exe dist\onyx.exe
#define VERSION "v0.1.8"
+#ifdef ONYX_RUNTIME_LIBRARY
+ #define ONYX_RUNTIME_LIBRARY_MAPPED ONYX_RUNTIME_LIBRARY
+#else
+ #define ONYX_RUNTIME_LIBRARY_MAPPED none
+#endif
+
+#define STRINGIFY_(x) #x
+#define STRINGIFY(x) STRINGIFY_(x)
+
Context context;
#define VERSION_STRING "Onyx toolchain version " VERSION "\n" \
- "Built on " __TIMESTAMP__ "\n"
+ "Built on " __TIMESTAMP__ "\n" \
+ "Runtime: " STRINGIFY(ONYX_RUNTIME_LIBRARY_MAPPED) "\n"
#define DOCSTRING_HEADER VERSION_STRING \
"\n" \
"Subcommands:\n"
"\thelp Shows this help message. Use \"onyx help <subcommand>\".\n"
"\tbuild Compiles an Onyx program into an executable.\n"
-#ifdef ENABLE_RUN_WITH_WASMER
+#ifdef ONYX_RUNTIME_LIBRARY
"\trun Compiles and runs an Onyx program, all at once.\n"
#endif
"\tcheck Checks syntax and types of an Onyx program.\n"
+#ifdef _BH_LINUX
"\twatch Continuously rebuilds an Onyx program on file changes.\n"
+#endif
"\tpackage Package manager\n"
"\tversion Prints version information\n";
// "\tdoc <input files>\n"
bh_arr_push(options.files, bh_aprintf(alloc, "%s/tools/onyx-pkg.onyx", core_installation));
goto skip_parsing_arguments;
}
- #ifdef ENABLE_RUN_WITH_WASMER
+ #ifdef ONYX_RUNTIME_LIBRARY
else if (!strcmp(argv[1], "run")) {
options.action = ONYX_COMPILE_ACTION_RUN;
arg_parse_start = 2;
options.action = ONYX_COMPILE_ACTION_WATCH;
arg_parse_start = 2;
}
- // `#ifdef ENABLE_RUN_WITH_WASMER
+ // `#ifdef ONYX_RUNTIME_LIBRARY
// `else if (!strcmp(argv[1], "run-watch")) {
// ` options.action = ONYX_COMPILE_ACTION_RUN_WATCH;
// ` arg_parse_start = 2;
skip_parsing_arguments:
- // NOTE: Always enable multi-threading for the Onyx runtime.
- if (options.runtime == Runtime_Onyx) {
+ // NOTE: Always enable multi-threading for the Onyx and WASI runtime.
+ if (options.runtime == Runtime_Onyx || options.runtime == Runtime_Wasi) {
options.use_multi_threading = 1;
}
return ONYX_COMPILER_PROGRESS_SUCCESS;
}
-#ifdef ENABLE_RUN_WITH_WASMER
+#ifdef ONYX_RUNTIME_LIBRARY
static b32 onyx_run_module(bh_buffer code_buffer) {
onyx_run_initialize(context.options->debug_session);
break;
#endif
- #ifdef ENABLE_RUN_WITH_WASMER
+ #ifdef ONYX_RUNTIME_LIBRARY
case ONYX_COMPILE_ACTION_RUN:
compiler_progress = do_compilation(&compile_opts);
if (compiler_progress == ONYX_COMPILER_PROGRESS_SUCCESS) {
break;
#endif
- #ifdef ENABLE_RUN_WITH_WASMER
+ #ifdef ONYX_RUNTIME_LIBRARY
case ONYX_COMPILE_ACTION_RUN_WASM:
global_heap_allocator = bh_heap_allocator();
context_init(&compile_opts);