cleaned up windows build line building

This commit is contained in:
Allen Webster 2017-07-08 22:09:24 -04:00
parent e2bb8cf07e
commit 98fc2c7252
1 changed files with 19 additions and 20 deletions

View File

@ -194,17 +194,16 @@ get_defines_from_flags(u32 flags){
static void static void
build(u32 flags, u32 arch, char *code_path, char **code_files, char *out_path, char *out_file, char **defines, char **exports, char **inc_folders){ build(u32 flags, u32 arch, char *code_path, char **code_files, char *out_path, char *out_file, char **defines, char **exports, char **inc_folders){
Build_Line line; Temp_Dir temp = fm_pushdir(out_path);
Build_Line link_line;
Build_Line line_prefix;
Build_Line line;
fm_init_build_line(&line); fm_init_build_line(&line);
fm_init_build_line(&link_line);
fm_init_build_line(&line_prefix);
if (arch == Arch_X86){ if (arch == Arch_X86){
fm_add_to_line(line_prefix, "%s\\windows_scripts\\setup_cl_x86.bat & ", code_path); fm_add_to_line(line, "%s\\windows_scripts\\setup_cl_x86.bat &", code_path);
} }
fm_add_to_line(line, "cl");
if (flags & OPTS){ if (flags & OPTS){
fm_add_to_line(line, CL_OPTS); fm_add_to_line(line, CL_OPTS);
@ -255,38 +254,38 @@ build(u32 flags, u32 arch, char *code_path, char **code_files, char *out_path, c
} }
} }
for (u32 i = 0; code_files[i]; ++i){
fm_add_to_line(line, "\"%s\\%s\"", code_path, code_files[i]);
}
fm_add_to_line(line, "/Fe%s", out_file);
fm_add_to_line(line, "/link /INCREMENTAL:NO");
switch (arch){ switch (arch){
case Arch_X64: fm_add_to_line(link_line, "/MACHINE:X64"); break; case Arch_X64: fm_add_to_line(line, "/MACHINE:X64"); break;
case Arch_X86: fm_add_to_line(link_line, "/MACHINE:X86"); break; case Arch_X86: fm_add_to_line(line, "/MACHINE:X86"); break;
default: InvalidCodePath; default: InvalidCodePath;
} }
if (flags & DEBUG_INFO){ if (flags & DEBUG_INFO){
fm_add_to_line(link_line, "/DEBUG"); fm_add_to_line(line, "/DEBUG");
} }
if (flags & SHARED_CODE){ if (flags & SHARED_CODE){
Assert(exports != 0); Assert(exports != 0);
fm_add_to_line(link_line, "/OPT:REF"); fm_add_to_line(line, "/OPT:REF");
for (u32 i = 0; exports[i] != 0; ++i){ for (u32 i = 0; exports[i] != 0; ++i){
char *str = fm_str("/EXPORT:", exports[i]); char *str = fm_str("/EXPORT:", exports[i]);
fm_add_to_line(link_line, "%s", str); fm_add_to_line(line, "%s", str);
} }
} }
else{ else{
fm_add_to_line(link_line, "/NODEFAULTLIB:library"); fm_add_to_line(line, "/NODEFAULTLIB:library");
}
for (u32 i = 0; code_files[i]; ++i){
fm_add_to_line(line, "\"%s\\%s\"", code_path, code_files[i]);
} }
fm_finish_build_line(&line); fm_finish_build_line(&line);
fm_finish_build_line(&link_line);
fm_finish_build_line(&line_prefix);
Temp_Dir temp = fm_pushdir(out_path); systemf("%s", line.build_options);
systemf("%scl %s /Fe%s /link /INCREMENTAL:NO %s", line_prefix.build_options, line.build_options, out_file, link_line.build_options);
fm_popdir(temp); fm_popdir(temp);
} }