2017-02-25 01:53:40 +00:00
|
|
|
@echo off
|
|
|
|
|
2019-11-07 05:58:08 +00:00
|
|
|
REM usage: <script> [target [mode]]
|
|
|
|
REM works from any directory, but must remain in custom/bin path to work
|
|
|
|
REM target : if specified determines the file that acts as the build target
|
|
|
|
REM when not specified the build target is 4coder_default_bindings.cpp
|
|
|
|
REM mode : if set to "release" builds with optimizations
|
|
|
|
REM The build steps are:
|
|
|
|
REM 1. preprocess the build target
|
|
|
|
REM 2. build the metadata generator
|
|
|
|
REM 3. run the metadata generator on the result from (1)
|
|
|
|
REM 4. build the build target
|
2020-02-15 20:33:18 +00:00
|
|
|
REM 5. cleanup after the metadata generator
|
2019-11-07 05:58:08 +00:00
|
|
|
REM All output files are generated in the current directory when the script is run
|
|
|
|
|
|
|
|
set location=%cd%
|
|
|
|
set me="%~dp0"
|
|
|
|
cd %me%
|
|
|
|
cd ..
|
|
|
|
set custom_root=%cd%
|
|
|
|
set custom_bin=%custom_root%\bin
|
|
|
|
cd %location%
|
|
|
|
|
|
|
|
if NOT "%Platform%" == "X86" IF NOT "%Platform%" == "x86" (call "%custom_bin%\setup_cl_x86.bat")
|
|
|
|
|
|
|
|
set target=%1
|
|
|
|
if "%target%" == "" set target=%custom_root%\4coder_default_bindings.cpp
|
2017-06-23 01:04:42 +00:00
|
|
|
|
2018-06-15 20:10:49 +00:00
|
|
|
set debug=/Zi
|
2019-03-30 22:10:17 +00:00
|
|
|
set release=/O2 /Zi
|
|
|
|
set mode=%debug%
|
|
|
|
if "%2" == "release" (set mode=%release%)
|
|
|
|
|
2020-02-15 20:33:18 +00:00
|
|
|
set binname=%3
|
|
|
|
if "%binname%" == "" set binname="custom_4coder"
|
|
|
|
|
2019-11-07 05:58:08 +00:00
|
|
|
set opts=/W4 /wd4310 /wd4100 /wd4201 /wd4505 /wd4996 /wd4127 /wd4510 /wd4512 /wd4610 /wd4457 /WX
|
|
|
|
set opts=%opts% /GR- /nologo /FC
|
|
|
|
set opts=%opts% -I%custom_root%
|
2020-02-08 01:02:42 +00:00
|
|
|
set opts=%opts% /D OS_WINDOWS=1 /D OS_LINUX=0 /D OS_MAC=0
|
2019-11-07 05:58:08 +00:00
|
|
|
set opts=%opts% %mode%
|
|
|
|
|
2018-06-15 20:10:49 +00:00
|
|
|
set preproc_file=4coder_command_metadata.i
|
2019-11-07 05:58:08 +00:00
|
|
|
set meta_opts=/P /Fi%preproc_file% /DMETA_PASS
|
|
|
|
|
|
|
|
set build_dll=/LD /link /INCREMENTAL:NO /OPT:REF /RELEASE /PDBALTPATH:%%%%_PDB%%%%
|
|
|
|
set build_dll=%build_dll% /EXPORT:get_version /EXPORT:init_apis
|
|
|
|
|
|
|
|
call cl %opts% %meta_opts% %target%
|
|
|
|
call cl %opts% "%custom_root%\4coder_metadata_generator.cpp" /Femetadata_generator
|
|
|
|
metadata_generator -R "%custom_root%" "%cd%\%preproc_file%"
|
2017-11-22 20:05:58 +00:00
|
|
|
|
2019-11-07 05:58:08 +00:00
|
|
|
call cl %opts% %target% /Fecustom_4coder %build_dll%
|
2017-02-25 01:53:40 +00:00
|
|
|
|
|
|
|
REM file spammation preventation
|
2017-11-22 20:05:58 +00:00
|
|
|
del metadata_generator*
|
2017-02-25 01:53:40 +00:00
|
|
|
del *.exp
|
|
|
|
del *.obj
|
|
|
|
del *.lib
|
2018-06-15 20:10:49 +00:00
|
|
|
del %preproc_file%
|