diff --git a/4coder_custom.so b/4coder_custom.so deleted file mode 100755 index 8470c958..00000000 Binary files a/4coder_custom.so and /dev/null differ diff --git a/4ed_app b/4ed_app deleted file mode 100755 index 724bb096..00000000 Binary files a/4ed_app and /dev/null differ diff --git a/build.bat b/build.bat index 6c8e4fca..2bb7cc6b 100644 --- a/build.bat +++ b/build.bat @@ -1,10 +1,5 @@ @echo off -REM "build_exp.bat" /O2 -REM "build_all.bat" /DFRED_SUPER /DFRED_INTERNAL /Zi -REM "build_all.bat" /DFRED_INTERNAL /Zi -REM "build_all.bat" /DFRED_SUPER /O2 /Zi - call "ctime" -begin 4ed_data.ctm SET OPTS=/W4 /wd4310 /wd4100 /wd4201 /wd4505 /wd4996 /wd4127 /wd4510 /wd4512 /wd4610 /wd4390 /WX @@ -12,8 +7,11 @@ SET OPTS=/GR- /EHa- /nologo /FC SET FirstError=0 +SET BUILD_MODE="%1" +if "%BUILD_MODE%" == "" (SET BUILD_MODE="/DDEV_BUILD") + pushd ..\build -cl %OPTS% ..\code\build.c /Febuild /DDEV_BUILD +cl %OPTS% ..\code\build.c /Febuild %BUILD_MODE% if %ERRORLEVEL% neq 0 (set FirstError=1) popd @@ -26,4 +24,4 @@ call "print_size.bat" 4ed_app.dll call "print_size.bat" 4ed.exe popd -call "ctime" -end 4ed_data.ctm %FirstError% \ No newline at end of file +call "ctime" -end 4ed_data.ctm %FirstError% diff --git a/build.c b/build.c index 6636ed65..2098e5cf 100644 --- a/build.c +++ b/build.c @@ -142,6 +142,68 @@ execute(char *dir, char *str){ } } +static void +slash_fix(char *path){ + for (int32_t i = 0; path[i]; ++i){ + if (path[i] == '/') path[i] = '\\'; + } +} + +static void +make_folder_if_missing(char *folder){ + char *p = folder; + slash_fix(folder); + + for (; *p; ++p){ + if (*p == '\\'){ + *p = 0; + CreateFolder(folder, 0); + *p = '\\'; + } + } +} + +static void +clear_folder(char *folder){ + slash_fix(folder); + systemf("del /S %s\\*", folder); +} + +static void +copy_file(char *path, char *file, char *folder){ + char src[256], dst[256]; + String b = make_fixed_width_string(src); + append_sc(&b, path); + append_sc(&b, "\\"); + append_sc(&b, file); + terminate_with_null(&b); + + append_sc(&b, folder); + append_sc(&b, "\\"); + append_sc(&b, file); + terminate_with_null(&b); + + slash_fix(src); + slash_fix(dst); + + CopyFile(src, dst, 0); +} + +static void +copy_all(char *source, char *folder){ + slash_fix(source); + slash_fix(folder); + systemf("copy %s %s\\*", source, folder); +} + +static void +zip(char *folder, char *dest){ + char cdir[512]; + get_current_directory(cdir, sizeof(cdir)); + + systemf("pushd %s & %s/zip %s", folder, cdir, dest); +} + #elif defined(IS_LINUX) #include @@ -205,6 +267,9 @@ execute(char *dir, char *str){ } } +static void +slash_fix(char *path){} + static void make_folder_if_missing(char *folder){ systemf("mkdir -p %s", folder); @@ -286,13 +351,6 @@ swap_ptr(char **A, char **B){ *B = a; } -static void -win32_slash_fix(char *path){ - for (int32_t i = 0; path[i]; ++i){ - if (path[i] == '/') path[i] = '\\'; - } -} - enum{ OPTS = 0x1, INCLUDES = 0x2, @@ -368,8 +426,8 @@ build_cl(uint32_t flags, char *code_path, char *code_file, char *out_path, char *out_file, char *exports){ - win32_slash_fix(out_path); - win32_slash_fix(code_path); + slash_fix(out_path); + slash_fix(code_path); Build_Line line; init_build_line(&line); @@ -455,6 +513,8 @@ build_gcc(uint32_t flags, } if (flags & INCLUDES){ + // TODO(allen): Abstract this out. +#if IS_LINUX int32_t size = 0; char freetype_include[512]; FILE *file = popen("pkg-config --cflags freetype2", "r"); @@ -466,6 +526,7 @@ build_gcc(uint32_t flags, } build_ap(line, GCC_INCLUDES" %s", freetype_include); +#endif } if (flags & DEBUG_INFO){ @@ -505,9 +566,12 @@ build_gcc(uint32_t flags, swap_ptr(&line.build_options, &line.build_options_prev); + // TODO(allen): Abstract this out. +#if IS_LINUX Temp_Dir temp = linux_pushd(out_path); systemf("g++ %s -o %s", line.build_options, out_file); linux_popd(temp); +#endif } static void @@ -527,9 +591,9 @@ build(uint32_t flags, static void buildsuper(char *code_path, char *out_path, char *filename){ #if defined(IS_CL) - win32_slash_fix(filename); - win32_slash_fix(out_path); - win32_slash_fix(code_path); + slash_fix(filename); + slash_fix(out_path); + slash_fix(code_path); systemf("pushd %s & call \"%s\\buildsuper.bat\" %s", out_path, code_path, filename); @@ -596,7 +660,7 @@ do_buildsuper(char *cdir){ { BEGIN_TIME_SECTION(); //buildsuper(cdir, BUILD_DIR, "../code/4coder_default_bindings.cpp"); -#if IS_WINDOWS +#if defined(IS_WINDOWS) buildsuper(cdir, BUILD_DIR, "../code/internal_4coder_tests.cpp"); #else buildsuper(cdir, BUILD_DIR, "../code/power/4coder_experiments.cpp"); diff --git a/fsmgen b/fsmgen deleted file mode 100755 index 9804106b..00000000 Binary files a/fsmgen and /dev/null differ diff --git a/package.bat b/package.bat index ca83c265..1014c135 100644 --- a/package.bat +++ b/package.bat @@ -1,47 +1,47 @@ -@echo off +REM @echo off +REM pushd W:\4ed\meta +REM cl %OPTS% ..\code\readme_generator.c /Fereadmegen +REM popd -pushd W:\4ed\meta -cl %OPTS% ..\code\readme_generator.c /Fereadmegen -popd +REM pushd W:\4ed\code -pushd W:\4ed\code +REM ..\meta\readmegen -..\meta\readmegen +REM call "build_all.bat" /O2 /DFRED_KEEP_ASSERT /Zi +REM del ..\current_dist\4coder\*.html +REM copy ..\build\4ed.exe ..\current_dist\4coder\* +REM copy ..\build\4ed.pdb ..\current_dist\4coder\* +REM copy ..\build\4ed_app.dll ..\current_dist\4coder\* +REM copy ..\build\4ed_app.pdb ..\current_dist\4coder\* +REM copy ..\data\* ..\current_dist\4coder\* +REM copy README.txt ..\current_dist\4coder\* +REM copy TODO.txt ..\current_dist\4coder\* +REM del ..\current_dist\4coder\.4coder_settings -call "build_all.bat" /O2 /DFRED_KEEP_ASSERT /Zi -del ..\current_dist\4coder\*.html -copy ..\build\4ed.exe ..\current_dist\4coder\* -copy ..\build\4ed.pdb ..\current_dist\4coder\* -copy ..\build\4ed_app.dll ..\current_dist\4coder\* -copy ..\build\4ed_app.pdb ..\current_dist\4coder\* -copy ..\data\* ..\current_dist\4coder\* -copy README.txt ..\current_dist\4coder\* -copy TODO.txt ..\current_dist\4coder\* -del ..\current_dist\4coder\.4coder_settings +REM call "build_all.bat" /O2 /DFRED_SUPER /DFRED_KEEP_ASSERT /Zi +REM del ..\current_dist\4coder\*.html +REM copy ..\build\4ed.exe ..\current_dist_super\4coder\* +REM copy ..\build\4ed.pdb ..\current_dist_super\4coder\* +REM copy ..\build\4ed_app.dll ..\current_dist_super\4coder\* +REM copy ..\build\4ed_app.pdb ..\current_dist_super\4coder\* +REM copy buildsuper.bat ..\current_dist_super\4coder\* +REM copy ..\data\* ..\current_dist_super\4coder\* +REM del ..\current_dist_super\4coder\basic.cpp +REM copy 4coder_*.h ..\current_dist_super\4coder\* +REM copy 4coder_*.cpp ..\current_dist_super\4coder\* +REM copy README.txt ..\current_dist_super\4coder\* +REM copy TODO.txt ..\current_dist_super\4coder\* +REM copy ..\current_dist\4coder\3rdparty\* ..\current_dist_super\4coder\3rdparty\* +REM del ..\current_dist_super\4coder\*.lib +REM del ..\current_dist_super\4coder\*.obj +REM del ..\current_dist_super\4coder\4coder_custom.dll +REM del ..\current_dist_super\4coder\.4coder_settings -call "build_all.bat" /O2 /DFRED_SUPER /DFRED_KEEP_ASSERT /Zi -del ..\current_dist\4coder\*.html -copy ..\build\4ed.exe ..\current_dist_super\4coder\* -copy ..\build\4ed.pdb ..\current_dist_super\4coder\* -copy ..\build\4ed_app.dll ..\current_dist_super\4coder\* -copy ..\build\4ed_app.pdb ..\current_dist_super\4coder\* -copy buildsuper.bat ..\current_dist_super\4coder\* -copy ..\data\* ..\current_dist_super\4coder\* -del ..\current_dist_super\4coder\basic.cpp -copy 4coder_*.h ..\current_dist_super\4coder\* -copy 4coder_*.cpp ..\current_dist_super\4coder\* -copy README.txt ..\current_dist_super\4coder\* -copy TODO.txt ..\current_dist_super\4coder\* -copy ..\current_dist\4coder\3rdparty\* ..\current_dist_super\4coder\3rdparty\* -del ..\current_dist_super\4coder\*.lib -del ..\current_dist_super\4coder\*.obj -del ..\current_dist_super\4coder\4coder_custom.dll -del ..\current_dist_super\4coder\.4coder_settings +REM copy 4coder_API.html ..\current_dist_super\* -copy 4coder_API.html ..\current_dist_super\* +REM del ..\current_dist_power\power\* /F /Q +REM copy power\* ..\current_dist_power\power\* -del ..\current_dist_power\power\* /F /Q -copy power\* ..\current_dist_power\power\* - -popd +REM popd +build.bat /DPACKAGE diff --git a/zip.bat b/zip.bat new file mode 100644 index 00000000..689e135e --- /dev/null +++ b/zip.bat @@ -0,0 +1,6 @@ +@echo off + +REM Usage: zip +REM compresses the current directory into a zip named .zip + +"C:\Program Files (x86)\7-Zip\7z.exe" a -tzip -y %* \ No newline at end of file