jai port :D
This commit is contained in:
71
build.jai
Normal file
71
build.jai
Normal file
@@ -0,0 +1,71 @@
|
||||
#import "Basic";
|
||||
#import "Compiler";
|
||||
#import "File";
|
||||
#import "File_Utilities";
|
||||
|
||||
IMGUI_PATH :: "modules/ImGui/src";
|
||||
IMGUI_LIB :: "modules/ImGui/windows/ImGui.lib";
|
||||
|
||||
build :: () {
|
||||
set_build_options_dc(.{do_output=false});
|
||||
|
||||
// Build ImGui from source if the static lib doesn't exist
|
||||
if !file_exists(IMGUI_LIB) {
|
||||
print("ImGui.lib not found — building from source...\n");
|
||||
make_directory_if_it_does_not_exist("modules/ImGui/windows");
|
||||
|
||||
success := build_cpp_static_lib("modules/ImGui/windows/ImGui",
|
||||
tprint("%/imgui.cpp", IMGUI_PATH),
|
||||
tprint("%/imgui_widgets.cpp", IMGUI_PATH),
|
||||
tprint("%/imgui_draw.cpp", IMGUI_PATH),
|
||||
tprint("%/imgui_tables.cpp", IMGUI_PATH),
|
||||
tprint("%/imgui_demo.cpp", IMGUI_PATH),
|
||||
tprint("%/backends/imgui_impl_win32.cpp", IMGUI_PATH),
|
||||
tprint("%/backends/imgui_impl_dx12.cpp", IMGUI_PATH),
|
||||
tprint("%/imgui_backend_c.cpp", IMGUI_PATH),
|
||||
extra = .[
|
||||
"/DIMGUI_API=__declspec(dllexport)",
|
||||
"/DIMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS",
|
||||
tprint("/I%", IMGUI_PATH),
|
||||
tprint("/I%/backends", IMGUI_PATH),
|
||||
],
|
||||
);
|
||||
|
||||
if !success {
|
||||
compiler_set_workspace_status(.FAILED);
|
||||
return;
|
||||
}
|
||||
print("ImGui.lib built successfully.\n");
|
||||
}
|
||||
|
||||
w := compiler_create_workspace("autosample");
|
||||
if !w {
|
||||
print("Workspace creation failed.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
options := get_build_options(w);
|
||||
options.output_executable_name = "autosample";
|
||||
options.output_path = "build/";
|
||||
|
||||
import_path: [..] string;
|
||||
array_add(*import_path, "modules"); // Our local modules (ImGui)
|
||||
for options.import_path array_add(*import_path, it);
|
||||
options.import_path = import_path;
|
||||
|
||||
set_build_options(options, w);
|
||||
compiler_begin_intercept(w);
|
||||
add_build_file("src/main.jai", w);
|
||||
|
||||
while true {
|
||||
message := compiler_wait_for_message();
|
||||
if !message break;
|
||||
if message.kind == .COMPLETE break;
|
||||
}
|
||||
|
||||
compiler_end_intercept(w);
|
||||
}
|
||||
|
||||
#run build();
|
||||
|
||||
#import "BuildCpp";
|
||||
Reference in New Issue
Block a user