2023-09-16 02:21:24 +00:00
|
|
|
@echo off
|
|
|
|
setlocal
|
|
|
|
|
|
|
|
set script_dir_backslash=%~dp0
|
|
|
|
set script_dir=%script_dir_backslash:~0,-1%
|
|
|
|
set build_dir=%script_dir%\Build
|
|
|
|
set code_dir=%script_dir%
|
|
|
|
set tely_dir=%code_dir%\External\tely
|
|
|
|
|
|
|
|
REM ================================================================================================
|
|
|
|
|
|
|
|
mkdir %build_dir% 2>nul
|
|
|
|
pushd %build_dir%
|
|
|
|
mkdir %build_dir%\Data 2>nul
|
|
|
|
|
|
|
|
REM ================================================================================================
|
|
|
|
|
|
|
|
set robocopy_cmd=robocopy /MIR /NJH /NJS /NDL /NP %code_dir%\Data %build_dir%\Data
|
|
|
|
call powershell -Command "$duration = Measure-Command {%robocopy_cmd% | Out-Default}; Write-Host 'robocopy:' $duration.TotalSeconds 'seconds'"
|
|
|
|
|
|
|
|
REM ================================================================================================
|
|
|
|
|
|
|
|
REM TODO: Raylib seems to have problems shutting down fsanitize=address?
|
2023-09-17 10:13:17 +00:00
|
|
|
set common_compile_flags=/W4 /Z7 /MT /EHsc /nologo
|
2023-09-16 02:21:24 +00:00
|
|
|
set common_link_flags=/link /incremental:no
|
|
|
|
|
|
|
|
REM raylib =========================================================================================
|
|
|
|
|
|
|
|
set raylib_dir=%tely_dir%\external\raylib
|
|
|
|
if not exist %build_dir%\rcore.obj (
|
|
|
|
cl %common_compile_flags% ^
|
|
|
|
/w ^
|
|
|
|
/c ^
|
|
|
|
/D _DEFAULT_SOURCE ^
|
|
|
|
/D PLATFORM_DESKTOP ^
|
|
|
|
/I %raylib_dir% ^
|
|
|
|
/I %raylib_dir%\external\glfw\include ^
|
|
|
|
/I %raylib_dir%\glfw\deps\mingw ^
|
|
|
|
%raylib_dir%\rcore.c ^
|
|
|
|
%raylib_dir%\utils.c ^
|
|
|
|
%raylib_dir%\raudio.c ^
|
|
|
|
%raylib_dir%\rmodels.c ^
|
|
|
|
%raylib_dir%\rtext.c ^
|
|
|
|
%raylib_dir%\rtextures.c ^
|
|
|
|
%raylib_dir%\rshapes.c ^
|
|
|
|
%raylib_dir%\rglfw.c
|
|
|
|
)
|
|
|
|
|
|
|
|
REM raylib flags =========================================================================================
|
|
|
|
|
|
|
|
set raylib_compile_flags=%common_compile_flags% ^
|
|
|
|
/Tp %tely_dir%\tely_platform_raylib_unity.h ^
|
|
|
|
/I "%raylib_dir%"
|
|
|
|
|
|
|
|
set raylib_link_flags=%common_link_flags% ^
|
|
|
|
%build_dir%\rcore.obj ^
|
|
|
|
%build_dir%\utils.obj ^
|
|
|
|
%build_dir%\raudio.obj ^
|
|
|
|
%build_dir%\rmodels.obj ^
|
|
|
|
%build_dir%\rtext.obj ^
|
|
|
|
%build_dir%\rtextures.obj ^
|
|
|
|
%build_dir%\rshapes.obj ^
|
|
|
|
%build_dir%\rglfw.obj ^
|
|
|
|
gdi32.lib opengl32.lib winmm.lib user32.lib shell32.lib
|
|
|
|
|
|
|
|
REM DLL flags ======================================================================================
|
|
|
|
|
2023-09-17 10:13:17 +00:00
|
|
|
set dll_compile_flags=%common_compile_flags% /LD /Tp %code_dir%\feely_pona_unity.h
|
2023-09-16 02:21:24 +00:00
|
|
|
set dll_link_flags=%common_link_flags%
|
|
|
|
|
|
|
|
REM MSVC commands ==================================================================================
|
|
|
|
|
|
|
|
set msvc_exe_name=feely_pona_msvc
|
|
|
|
set msvc_cmd=cl %raylib_compile_flags% /Fo%msvc_exe_name% /Fe%msvc_exe_name% %raylib_link_flags%
|
|
|
|
set msvc_dll_cmd=cl %dll_compile_flags% /Fotely_dll_msvc /Fetely_dll_msvc %dll_link_flags%
|
|
|
|
|
|
|
|
REM CLANG commands =================================================================================
|
|
|
|
|
|
|
|
set clang_exe_name_sdl=feely_pona_clang
|
|
|
|
set clang_cmd_sdl=clang-cl %compile_flags% /Fo%clang_exe_name_sdl% /Fe%clang_exe_name_sdl% %link_flags%
|
|
|
|
set clang_dll_cmd=clang-cl %dll_compile_flags% /Fotely_dll_clang /Fetely_dll_clang %dll_link_flags%
|
|
|
|
|
|
|
|
REM MSVC build =====================================================================================
|
|
|
|
|
|
|
|
set msvc_build_platform=$platform_time = Measure-Command {%msvc_cmd% ^| Out-Default};
|
|
|
|
set msvc_build_dll=$dll_time = Measure-Command {%msvc_dll_cmd% ^| Out-Default};
|
|
|
|
set msvc_print_platform_and_dll_time=Write-Host 'msvc (platform+dll):'($platform_time.TotalSeconds + $dll_time.TotalSeconds)'s ('$platform_time.TotalSeconds + $dll_time.TotalSeconds')'
|
|
|
|
|
2023-10-10 12:00:35 +00:00
|
|
|
powershell -Command "$file = [System.IO.File]::Open('%build_dir%\%msvc_exe_name%.exe', 'Open', 'Write'); $file.Close(); $file.Dispose()" 2>nul && set msvc_exe_is_locked=0 || set msvc_exe_is_locked=1
|
|
|
|
powershell -Command "$duration = Measure-Command {%msvc_dll_cmd% | Out-Default}; Write-Host 'msvc (dll):' $duration.TotalSeconds 'seconds'"
|
2023-09-16 02:21:24 +00:00
|
|
|
|
|
|
|
echo foo> %msvc_exe_name%.lock
|
2023-10-10 12:00:35 +00:00
|
|
|
if %msvc_exe_is_locked% == 0 (
|
|
|
|
powershell -Command "$time_a = Measure-Command {%msvc_cmd% | Out-Default }; Write-Host 'msvc (raylib):' $time_a.TotalSeconds 'seconds'"
|
2023-09-16 02:21:24 +00:00
|
|
|
)
|
|
|
|
del %msvc_exe_name%.lock
|
|
|
|
|
2023-10-10 12:00:35 +00:00
|
|
|
REM MSVC no-dll ====================================================================================
|
|
|
|
|
|
|
|
set msvc_no_dll_cmd=cl %common_compile_flags% /Tp %code_dir%\feely_pona_unity_nodll.h /Fofeely_pona_msvc_nodll /Fefeely_pona_msvc_nodll %raylib_link_flags%
|
|
|
|
set msvc_sprite_packer_cmd=cl %common_compile_flags% %code_dir%\feely_pona_sprite_packer.cpp /Fofeely_pona_sprite_packer /Fefeely_pona_sprite_packer %common_link_flags%
|
|
|
|
|
|
|
|
powershell -Command "$duration = Measure-Command {%msvc_sprite_packer_cmd% | Out-Default}; Write-Host 'msvc (sprite packer):' $duration.TotalSeconds 'seconds'"
|
|
|
|
powershell -Command "$duration = Measure-Command {%msvc_no_dll_cmd% | Out-Default}; Write-Host 'msvc (no-dll):' $duration.TotalSeconds 'seconds'"
|
|
|
|
|
2023-10-11 13:04:01 +00:00
|
|
|
cl /nologo /Z7 %code_dir%\feely_pona_build.cpp
|
2023-09-16 02:21:24 +00:00
|
|
|
|
|
|
|
popd
|
|
|
|
exit /B 1
|