From fdbb33b10b1e6935f42539e77c04731099cd4e2b Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Wed, 22 Feb 2017 19:22:59 -0500 Subject: [PATCH] experiments with build system for x86 windows build --- 4ed_site.ctm | Bin 1188 -> 1220 bytes build.bat | 6 ----- meta/build.cpp | 47 +++++++++++++++++++++++++++++++------- project.4coder | 1 + string/_4coder_string.ctm | Bin 2500 -> 2548 bytes 5 files changed, 40 insertions(+), 14 deletions(-) diff --git a/4ed_site.ctm b/4ed_site.ctm index 77ce8a411a7948e078f88caf95c0d54fc03922dd..1b1c5a2aba38a4df8c48f8752e7957db948cd3f0 100644 GIT binary patch delta 40 ncmZ3&d4zMr5*CHIJ*y99_FiISWME)84#X2*@EwKmZv*)NGj9zF delta 7 OcmX@YxrB4W5*7dqO#;&Z diff --git a/build.bat b/build.bat index b8fbfe56..0bccd819 100644 --- a/build.bat +++ b/build.bat @@ -19,11 +19,5 @@ popd ..\build\build if %ERRORLEVEL% neq 0 (set FirstError=1) -pushd ..\build -call "print_size.bat" 4coder_custom.dll -call "print_size.bat" 4ed_app.dll -call "print_size.bat" 4ed.exe -popd - :END call "ctime" -end 4ed_data.ctm %FirstError% diff --git a/meta/build.cpp b/meta/build.cpp index 5d9e2dcf..a5161363 100644 --- a/meta/build.cpp +++ b/meta/build.cpp @@ -80,6 +80,7 @@ enum{ OPTIMIZATION = 0x100, KEEP_ASSERT = 0x200, SITE_INCLUDES = 0x400, + X86 = 0x800, }; @@ -136,10 +137,14 @@ init_build_line(Build_Line *line){ #define CL_ICON "..\\res\\icon.res" +#define CL_X86 "-MACHINE:X86" + static void build_cl(u32 flags, char *code_path, char *code_file, char *out_path, char *out_file, char *exports){ Build_Line line; + Build_Line link_line; init_build_line(&line); + init_build_line(&link_line); if (flags & OPTS){ build_ap(line, CL_OPTS); @@ -187,17 +192,26 @@ build_cl(u32 flags, char *code_path, char *code_file, char *out_path, char *out_ swap_ptr(&line.build_options, &line.build_options_prev); - char link_options[1024]; - if (flags & SHARED_CODE){ - assert(exports); - snprintf(link_options, sizeof(link_options), "/OPT:REF %s", exports); - } - else{ - snprintf(link_options, sizeof(link_options), "/NODEFAULTLIB:library"); + if (flags & X86){ + build_ap(link_line, CL_X86); } + if (flags & DEBUG_INFO){ + build_ap(link_line, "/DEBUG "); + } + + char link_type_string[1024]; + if (flags & SHARED_CODE){ + assert(exports); + snprintf(link_type_string, sizeof(link_type_string), "/OPT:REF %s", exports); + } + else{ + snprintf(link_type_string, sizeof(link_type_string), "/NODEFAULTLIB:library"); + } + build_ap(link_line, "%s", link_type_string); + Temp_Dir temp = pushdir(out_path); - systemf("cl %s %s\\%s /Fe%s /link /DEBUG /INCREMENTAL:NO %s", line.build_options, code_path, code_file, out_file, link_options); + systemf("cl %s %s\\%s /Fe%s /link /INCREMENTAL:NO %s", line.build_options, code_path, code_file, out_file, link_line.build_options); popdir(temp); } @@ -629,6 +643,23 @@ int main(int argc, char **argv){ return(error_state); } +#elif defined(DEV_BUILD_X86) + +int main(int argc, char **argv){ + init_time_system(); + + char cdir[256]; + + BEGIN_TIME_SECTION(); + i32 n = get_current_directory(cdir, sizeof(cdir)); + assert(n < sizeof(cdir)); + END_TIME_SECTION("current directory"); + + standard_build(cdir, DEBUG_INFO | SUPER | INTERNAL | X86); + + return(error_state); +} + #elif defined(PACKAGE) int main(int argc, char **argv){ diff --git a/project.4coder b/project.4coder index ed863ed4..9b6abdc0 100644 --- a/project.4coder +++ b/project.4coder @@ -4,6 +4,7 @@ open_recursively=false; fkey_command_win[1] = {"build.bat", "*compilation*", true , true }; fkey_command_win[2] = {"site\\build.bat", "*compilation*", true , true }; fkey_command_win[3] = {"string\\build.bat", "*compilation*", true , true }; +fkey_command_win[4] = {"build.bat /DDEV_BUILD_X86", "*compilation*", true , true }; fkey_command_win[5] = {"..\\misc\\run.bat", "*run*", false, false}; fkey_command_win[12] = {"package.bat", "*package*", false, true }; diff --git a/string/_4coder_string.ctm b/string/_4coder_string.ctm index 97e7ccb872a3a779766aac7a0c346ae533afb9ab..8a06400b423fad6fc3dd9f1cd405a59a4257c17c 100644 GIT binary patch delta 56 zcmX>i{6%=f5l#aq(|?cBdoM9E00FzoMMlLZUk+qK`AG?P87E0@JOtw(%f8D90Bv3r AzW@LL delta 7 Ocmew&d_;J|5l#RO<^x;+