-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_win32_handmade.jai
59 lines (50 loc) · 1.96 KB
/
build_win32_handmade.jai
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#import "Basic";
#import "File";
#import "Compiler";
OUTPUT_PATH :: "build/";
OUTPUT_EXE_NAME :: "win32_handmade";
#run {
defer set_build_options_dc(.{do_output=false});
make_directory_if_it_does_not_exist(OUTPUT_PATH, recursive = true);
log("Compiling main. | OS: % | CPU: %", OS, CPU);
w := compiler_create_workspace("build win32_handmade");
options := get_build_options(w);
copy_commonly_propagated_fields(get_build_options(), *options);
options.output_path = OUTPUT_PATH;
options.output_executable_name = OUTPUT_EXE_NAME;
options.output_type = .EXECUTABLE;
options.os_target = OS;
options.cpu_target = CPU;
//options.backend = .X64;
//options.additional_linker_arguments = string.["/SUBSYSTEM:WINDOWS", "/ENTRY:main", "/IGNORE:4216"];
set_optimization(*options, .DEBUG);
set_build_options(options, w);
compiler_begin_intercept(w);
// HANDMADE_INTERNAL indicates when we're trying to do something that we'de only want to do internally
// (e.g., specify allocator pointer positions)
// HANDMADE_DEBUG indicates something we'd only want in debug builds (e.g., asserts) -- there might be a better way to do this,
// or I think assert already does an #if ASSERT
build_constants := tprint(#string STRING
HANDMADE_INTERNAL :: %;
HANDMADE_DEBUG :: %;
STRING,
true,
true,
);
add_build_string(build_constants, w);
// add all your files here.
add_build_file("src/win32_handmade.jai", w);
while true {
message := compiler_wait_for_message();
if message.kind == {
case .COMPLETE; {
message_complete := (cast(*Message_Complete) message);
if message_complete.error_code != .NONE {
exit(1);
}
break;
}
}
}
compiler_end_intercept(w);
}