64 lines
2.0 KiB
Plaintext
64 lines
2.0 KiB
Plaintext
#import "Basic";
|
|
#import "Compiler";
|
|
#import "File";
|
|
#import "File_Utilities";
|
|
|
|
#run {
|
|
// Disable output for default workspace immediately
|
|
build_options: Build_Options_During_Compile;
|
|
build_options.do_output = false;
|
|
set_build_options_dc(build_options);
|
|
|
|
w := compiler_create_workspace("Target Workspace");
|
|
if !w return;
|
|
|
|
options := get_build_options(w);
|
|
options.output_executable_name = "singbox_tray";
|
|
|
|
// Copy libcurl.dll from compiler modules to output directory
|
|
for options.import_path {
|
|
dll_path := tprint("%Curl/windows/lib/libcurl.dll", it);
|
|
if file_exists(dll_path) {
|
|
dest_path := "libcurl.dll";
|
|
if options.output_path {
|
|
dest_path = tprint("%/libcurl.dll", options.output_path);
|
|
}
|
|
if copy_file(dll_path, dest_path) {
|
|
print("Build: Successfully copied libcurl.dll to %\n", dest_path);
|
|
} else {
|
|
print("Build Warning: Could not copy libcurl.dll to %\n", dest_path);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
// options.additional_linker_arguments is a slice, so copy it to a dynamic array, append, and assign back
|
|
new_args: [..] string;
|
|
new_args.allocator = temp;
|
|
|
|
for options.additional_linker_arguments {
|
|
array_add(*new_args, it);
|
|
}
|
|
|
|
// Set subsystem to Windows so no console window is created/shown.
|
|
array_add(*new_args, "/SUBSYSTEM:WINDOWS");
|
|
|
|
// Route MSVC Windows subsystem entry point to the standard main function.
|
|
array_add(*new_args, "/ENTRY:mainCRTStartup");
|
|
|
|
options.additional_linker_arguments = new_args;
|
|
|
|
set_build_options(options, w);
|
|
|
|
compiler_begin_intercept(w);
|
|
add_build_file("main.jai", w);
|
|
|
|
while true {
|
|
message := compiler_wait_for_message();
|
|
if !message break;
|
|
if message.workspace != w continue;
|
|
if message.kind == .COMPLETE break;
|
|
}
|
|
compiler_end_intercept(w);
|
|
}
|