mirror of
https://github.com/Detanup01/gbe_fork.git
synced 2024-12-26 10:24:14 +08:00
475cbe5da4
+ use new sdk folder + build proto files in build/tmp folder + update global includes to recognize the new structure + copy post build stuff + Linux: count protoc error + Windows: use nested dir for each build
590 lines
21 KiB
Batchfile
590 lines
21 KiB
Batchfile
@echo off
|
|
|
|
setlocal
|
|
pushd "%~dp0"
|
|
|
|
set /a last_code=0
|
|
|
|
for %%A in (
|
|
"dll\dll.cpp"
|
|
"dll\steam_client.cpp"
|
|
"controller\gamepad.c"
|
|
"sdk\steam\isteamclient.h" ) do (
|
|
if not exist "%%~A" (
|
|
call :err_msg "Invalid emu directory, change directory to emu's src dir (missing file %%~A)"
|
|
set /a last_code=1
|
|
goto :end_script
|
|
)
|
|
)
|
|
|
|
set /a BUILD_LIB32=1
|
|
set /a BUILD_LIB64=1
|
|
|
|
set /a BUILD_EXP_LIB32=1
|
|
set /a BUILD_EXP_LIB64=1
|
|
set /a BUILD_EXP_CLIENT32=1
|
|
set /a BUILD_EXP_CLIENT64=1
|
|
|
|
set /a BUILD_EXPCLIENT32=1
|
|
set /a BUILD_EXPCLIENT64=1
|
|
set /a BUILD_EXPCLIENT_LDR=1
|
|
|
|
set /a BUILD_TOOL_FIND_ITFS=1
|
|
set /a BUILD_TOOL_LOBBY=1
|
|
|
|
:: < 0: deduce, > 1: force
|
|
set /a PARALLEL_THREADS_OVERRIDE=-1
|
|
|
|
:: 0 = release, 1 = debug, otherwise error
|
|
set /a BUILD_TYPE=-1
|
|
|
|
set /a CLEAN_BUILD=0
|
|
|
|
:: get args
|
|
:args_loop
|
|
if "%~1"=="" (
|
|
goto :args_loop_end
|
|
) else if "%~1"=="-lib-32" (
|
|
set /a BUILD_LIB32=0
|
|
) else if "%~1"=="-lib-64" (
|
|
set /a BUILD_LIB64=0
|
|
) else if "%~1"=="-ex-lib-32" (
|
|
set /a BUILD_EXP_LIB32=0
|
|
) else if "%~1"=="-ex-lib-64" (
|
|
set /a BUILD_EXP_LIB64=0
|
|
) else if "%~1"=="-ex-client-32" (
|
|
set /a BUILD_EXP_CLIENT32=0
|
|
) else if "%~1"=="-ex-client-64" (
|
|
set /a BUILD_EXP_CLIENT64=0
|
|
) else if "%~1"=="-exclient-32" (
|
|
set /a BUILD_EXPCLIENT32=0
|
|
) else if "%~1"=="-exclient-64" (
|
|
set /a BUILD_EXPCLIENT64=0
|
|
) else if "%~1"=="-exclient-ldr" (
|
|
set /a BUILD_EXPCLIENT_LDR=0
|
|
) else if "%~1"=="-tool-itf" (
|
|
set /a BUILD_TOOL_FIND_ITFS=0
|
|
) else if "%~1"=="-tool-lobby" (
|
|
set /a BUILD_TOOL_LOBBY=0
|
|
) else if "%~1"=="-j" (
|
|
call :get_parallel_threads_count %~2 || (
|
|
call :err_msg "Invalid arg after -j, expected a number"
|
|
set /a last_code=1
|
|
goto :end_script
|
|
)
|
|
shift /1
|
|
) else if "%~1"=="clean" (
|
|
set /a CLEAN_BUILD=1
|
|
) else if "%~1"=="release" (
|
|
set /a BUILD_TYPE=0
|
|
) else if "%~1"=="debug" (
|
|
set /a BUILD_TYPE=1
|
|
) else (
|
|
call :err_msg "Invalid arg: %~1"
|
|
set /a last_code=1
|
|
goto :end_script
|
|
)
|
|
|
|
shift /1
|
|
goto :args_loop
|
|
:args_loop_end
|
|
|
|
:: use 70%
|
|
if defined NUMBER_OF_PROCESSORS (
|
|
set /a build_threads=NUMBER_OF_PROCESSORS*70/100
|
|
) else (
|
|
set /a build_threads=2
|
|
)
|
|
if %PARALLEL_THREADS_OVERRIDE% gtr 0 (
|
|
set /a build_threads=PARALLEL_THREADS_OVERRIDE
|
|
)
|
|
if %build_threads% lss 2 (
|
|
set /a build_threads=2
|
|
)
|
|
|
|
:: build type
|
|
set "debug_info="
|
|
set "debug_info_format="
|
|
set "optimization_level="
|
|
set "dbg_defs="
|
|
set "build_folder="
|
|
if %BUILD_TYPE% equ 0 (
|
|
set "debug_info=/DEBUG:NONE"
|
|
set "debug_info_format="
|
|
set "optimization_level=/Ox /Oi /Ob2 /Ot /O2 /Oy-"
|
|
set "dbg_defs=/DEMU_RELEASE_BUILD /DNDEBUG"
|
|
set "build_folder=release"
|
|
) else if %BUILD_TYPE% equ 1 (
|
|
set "debug_info=/DEBUG:FULL"
|
|
set "debug_info_format=/Z7"
|
|
set "optimization_level=/Od"
|
|
set "dbg_defs="
|
|
set "build_folder=debug"
|
|
) else (
|
|
call :err_msg "You must specify any of: [release debug]"
|
|
set /a last_code=1
|
|
goto :end_script
|
|
)
|
|
|
|
set "build_root_dir=build\win\%build_folder%"
|
|
set "steamclient_dir=%build_root_dir%\experimental_steamclient"
|
|
set "experimental_dir=%build_root_dir%\experimental"
|
|
set "tools_dir=%build_root_dir%\tools"
|
|
set "find_interfaces_dir=%tools_dir%\find_interfaces"
|
|
set "lobby_connect_dir=%tools_dir%\lobby_connect"
|
|
|
|
:: common stuff
|
|
set "deps_dir=build\deps\win"
|
|
set "libs_dir=libs"
|
|
set "tools_src_dir=tools"
|
|
set "build_temp_dir=build\tmp\win"
|
|
set "protoc_out_dir=%build_temp_dir%\proto_gen"
|
|
|
|
set "protoc_exe_32=%deps_dir%\protobuf\install32\bin\protoc.exe"
|
|
set "protoc_exe_64=%deps_dir%\protobuf\install64\bin\protoc.exe"
|
|
|
|
set "common_compiler_args=/std:c++17 /MP%build_threads% /DYNAMICBASE /errorReport:none /nologo /utf-8 /EHsc /GF /GL- /GS
|
|
set "common_compiler_args_32=%common_compiler_args%"
|
|
set "common_compiler_args_64=%common_compiler_args%"
|
|
|
|
:: "win" variables are used to build .dll and /SUBSYTEM:WINDOWS applications,
|
|
:: "exe" variables are used to build pure console applications
|
|
set "common_linker_args=/DYNAMICBASE /ERRORREPORT:NONE /NOLOGO"
|
|
set "common_win_linker_args_32=%common_linker_args%"
|
|
set "common_win_linker_args_64=%common_linker_args%"
|
|
set "common_exe_linker_args_32=%common_linker_args%"
|
|
set "common_exe_linker_args_64=%common_linker_args%"
|
|
|
|
:: third party dependencies (include folder + exact .lib file location)
|
|
set ssq_inc=/I"%deps_dir%\libssq\include"
|
|
set ssq_lib32="%deps_dir%\libssq\build32\Release\ssq.lib"
|
|
set ssq_lib64="%deps_dir%\libssq\build64\Release\ssq.lib"
|
|
|
|
set curl_inc32=/I"%deps_dir%\curl\install32\include"
|
|
set curl_inc64=/I"%deps_dir%\curl\install64\include"
|
|
set curl_lib32="%deps_dir%\curl\install32\lib\libcurl.lib"
|
|
set curl_lib64="%deps_dir%\curl\install64\lib\libcurl.lib"
|
|
|
|
set protob_inc32=/I"%deps_dir%\protobuf\install32\include"
|
|
set protob_inc64=/I"%deps_dir%\protobuf\install64\include"
|
|
set protob_lib32="%deps_dir%\protobuf\install32\lib\libprotobuf-lite.lib"
|
|
set protob_lib64="%deps_dir%\protobuf\install64\lib\libprotobuf-lite.lib"
|
|
|
|
set zlib_inc32=/I"%deps_dir%\zlib\install32\include"
|
|
set zlib_inc64=/I"%deps_dir%\zlib\install64\include"
|
|
set zlib_lib32="%deps_dir%\zlib\install32\lib\zlibstatic.lib"
|
|
set zlib_lib64="%deps_dir%\zlib\install64\lib\zlibstatic.lib"
|
|
|
|
set mbedtls_inc32=/I"%deps_dir%\mbedtls\install32\include"
|
|
set mbedtls_inc64=/I"%deps_dir%\mbedtls\install64\include"
|
|
set mbedtls_lib32="%deps_dir%\mbedtls\install32\lib\mbedcrypto.lib"
|
|
set mbedtls_lib64="%deps_dir%\mbedtls\install64\lib\mbedcrypto.lib"
|
|
|
|
:: directories to use for #include
|
|
set release_incs_both=%ssq_inc% /I"%libs_dir%" /I"%protoc_out_dir%" /I"%libs_dir%\utfcpp" /I"controller" /I"dll" /I"sdk" /I"overlay_experimental" /I"%libs_dir%\ImGui"
|
|
set release_incs32=%release_incs_both% %curl_inc32% %protob_inc32% %zlib_inc32% %mbedtls_inc32%
|
|
set release_incs64=%release_incs_both% %curl_inc64% %protob_inc64% %zlib_inc64% %mbedtls_inc64%
|
|
|
|
:: libraries to link with
|
|
:: copied from Visual Studio 2022
|
|
set "CoreLibraryDependencies=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib"
|
|
set "release_libs_both=%CoreLibraryDependencies% Ws2_32.lib Iphlpapi.lib Wldap32.lib Winmm.lib Bcrypt.lib"
|
|
set release_libs32=%release_libs_both% %ssq_lib32% %curl_lib32% %protob_lib32% %zlib_lib32% %mbedtls_lib32%
|
|
set release_libs64=%release_libs_both% %ssq_lib64% %curl_lib64% %protob_lib64% %zlib_lib64% %mbedtls_lib64%
|
|
|
|
:: common source files used everywhere, just for convinience, you still have to provide a complete list later
|
|
set release_src="dll/*.cpp" "%protoc_out_dir%/*.cc"
|
|
|
|
:: additional #defines
|
|
set "common_defs=/DUTF_CPP_CPLUSPLUS=201703L /DCURL_STATICLIB /D_MT /DUNICODE /D_UNICODE"
|
|
set "release_defs=%dbg_defs% %common_defs%"
|
|
|
|
|
|
if not exist "%deps_dir%\" (
|
|
call :err_msg "Dependencies dir was not found"
|
|
set /a last_code=1
|
|
goto :end_script
|
|
)
|
|
|
|
if not exist "%protoc_exe_32%" (
|
|
call :err_msg "protobuff compiler wasn't found - 32"
|
|
set /a last_code=1
|
|
goto :end_script
|
|
)
|
|
|
|
if not exist "%protoc_exe_64%" (
|
|
call :err_msg "protobuff compiler wasn't found - 64"
|
|
set /a last_code=1
|
|
goto :end_script
|
|
)
|
|
|
|
echo [?] All build operations will use %build_threads% parallel jobs
|
|
|
|
if %CLEAN_BUILD% equ 1 (
|
|
echo // cleaning previous build
|
|
if exist "%build_root_dir%" (
|
|
rmdir /s /q "%build_root_dir%"
|
|
)
|
|
echo: & echo:
|
|
)
|
|
|
|
:: x32 build
|
|
setlocal
|
|
|
|
echo // cleaning up to build 32
|
|
call :cleanup
|
|
mkdir "%protoc_out_dir%"
|
|
|
|
call build_win_set_env.bat 32 || (
|
|
endlocal
|
|
call :err_msg "Couldn't find Visual Studio or build tools - 32"
|
|
set /a last_code=1
|
|
goto :end_script
|
|
)
|
|
|
|
echo // invoking protobuf compiler - 32
|
|
"%protoc_exe_32%" .\dll\net.proto -I.\dll\ --cpp_out="%protoc_out_dir%\\" || (
|
|
set /a last_code+=1
|
|
)
|
|
echo: & echo:
|
|
|
|
if %BUILD_LIB32% equ 1 (
|
|
if not exist "%build_root_dir%\x32" (
|
|
mkdir "%build_root_dir%\x32"
|
|
)
|
|
call :compile_lib32 || (
|
|
set /a last_code+=1
|
|
)
|
|
echo: & echo:
|
|
)
|
|
|
|
if %BUILD_EXP_LIB32% equ 1 (
|
|
if not exist "%experimental_dir%\x32" (
|
|
mkdir "%experimental_dir%\x32"
|
|
)
|
|
call :compile_experimental_lib32 || (
|
|
set /a last_code+=1
|
|
)
|
|
echo: & echo:
|
|
)
|
|
|
|
if %BUILD_EXP_CLIENT32% equ 1 (
|
|
if not exist "%experimental_dir%\x32" (
|
|
mkdir "%experimental_dir%\x32"
|
|
)
|
|
call :compile_experimental_client32 || (
|
|
set /a last_code+=1
|
|
)
|
|
echo: & echo:
|
|
)
|
|
|
|
if %BUILD_EXPCLIENT32% equ 1 (
|
|
if not exist "%steamclient_dir%" (
|
|
mkdir "%steamclient_dir%"
|
|
)
|
|
call :compile_experimentalclient_32 || (
|
|
set /a last_code+=1
|
|
)
|
|
echo: & echo:
|
|
)
|
|
|
|
:: steamclient_loader
|
|
if %BUILD_EXPCLIENT_LDR% equ 1 (
|
|
if not exist "%steamclient_dir%" (
|
|
mkdir "%steamclient_dir%"
|
|
)
|
|
call :compile_experimentalclient_ldr || (
|
|
set /a last_code+=1
|
|
)
|
|
echo: & echo:
|
|
)
|
|
|
|
:: tools (x32)
|
|
if %BUILD_TOOL_FIND_ITFS% equ 1 (
|
|
if not exist "%find_interfaces_dir%" (
|
|
mkdir "%find_interfaces_dir%"
|
|
)
|
|
call :compile_tool_itf || (
|
|
set /a last_code+=1
|
|
)
|
|
echo: & echo:
|
|
)
|
|
if %BUILD_TOOL_LOBBY% equ 1 (
|
|
if not exist "%lobby_connect_dir%" (
|
|
mkdir "%lobby_connect_dir%"
|
|
)
|
|
call :compile_tool_lobby || (
|
|
set /a last_code+=1
|
|
)
|
|
echo: & echo:
|
|
)
|
|
|
|
endlocal & set /a last_code=%last_code%
|
|
|
|
|
|
:: some times the next build will fail, a timeout solved it
|
|
timeout /nobreak /t 5
|
|
|
|
|
|
:: x64 build
|
|
setlocal
|
|
|
|
echo // cleaning up to build 64
|
|
call :cleanup
|
|
mkdir "%protoc_out_dir%"
|
|
|
|
call build_win_set_env.bat 64 || (
|
|
endlocal
|
|
call :err_msg "Couldn't find Visual Studio or build tools - 64"
|
|
set /a last_code=1
|
|
goto :end_script
|
|
)
|
|
|
|
echo // invoking protobuf compiler - 64
|
|
"%protoc_exe_64%" .\dll\net.proto -I.\dll\ --cpp_out="%protoc_out_dir%\\" || (
|
|
set /a last_code+=1
|
|
)
|
|
echo: & echo:
|
|
|
|
if %BUILD_LIB64% equ 1 (
|
|
if not exist "%build_root_dir%\x64" (
|
|
mkdir "%build_root_dir%\x64"
|
|
)
|
|
call :compile_lib64 || (
|
|
set /a last_code+=1
|
|
)
|
|
echo: & echo:
|
|
)
|
|
|
|
if %BUILD_EXP_LIB64% equ 1 (
|
|
if not exist "%experimental_dir%\x64" (
|
|
mkdir "%experimental_dir%\x64"
|
|
)
|
|
call :compile_experimental_lib64 || (
|
|
set /a last_code+=1
|
|
)
|
|
echo: & echo:
|
|
)
|
|
|
|
if %BUILD_EXP_CLIENT64% equ 1 (
|
|
if not exist "%experimental_dir%\x64" (
|
|
mkdir "%experimental_dir%\x64"
|
|
)
|
|
call :compile_experimental_client64 || (
|
|
set /a last_code+=1
|
|
)
|
|
echo: & echo:
|
|
)
|
|
|
|
if %BUILD_EXPCLIENT64% equ 1 (
|
|
if not exist "%steamclient_dir%" (
|
|
mkdir "%steamclient_dir%"
|
|
)
|
|
call :compile_experimentalclient_64 || (
|
|
set /a last_code+=1
|
|
)
|
|
echo: & echo:
|
|
)
|
|
|
|
endlocal & set /a last_code=%last_code%
|
|
|
|
|
|
:: cleanup
|
|
echo // cleaning up
|
|
call :cleanup
|
|
echo: & echo:
|
|
|
|
|
|
:: copy configs + examples
|
|
if %last_code% equ 0 (
|
|
echo // copying readmes + files examples
|
|
xcopy /y /s "post_build\steam_settings.EXAMPLE\" "%build_root_dir%\steam_settings.EXAMPLE\"
|
|
copy /y "%tools_src_dir%\steamclient_loader\win\ColdClientLoader.ini" "%steamclient_dir%\"
|
|
copy /y "post_build\README.release.md" "%build_root_dir%\"
|
|
copy /y "CHANGELOG.md" "%build_root_dir%\"
|
|
if %BUILD_TYPE%==1 (
|
|
copy /y "post_build\README.debug.md" "%build_root_dir%\"
|
|
)
|
|
if exist "%experimental_dir%" (
|
|
copy /y "post_build\README.experimental.md" "%experimental_dir%\"
|
|
)
|
|
if exist "%steamclient_dir%" (
|
|
copy /y "post_build\README.experimental_steamclient.md" "%steamclient_dir%\"
|
|
)
|
|
if exist "%find_interfaces_dir%" (
|
|
copy /y "post_build\README.find_interfaces.md" "%find_interfaces_dir%\"
|
|
)
|
|
if exist "%lobby_connect_dir%" (
|
|
copy /y "post_build\README.lobby_connect.md" "%lobby_connect_dir%\"
|
|
)
|
|
) else (
|
|
call :err_msg "Not copying readmes or files examples due to previous errors"
|
|
)
|
|
echo: & echo:
|
|
|
|
|
|
goto :end_script
|
|
|
|
|
|
|
|
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: x32 + tools
|
|
:compile_lib32
|
|
setlocal
|
|
echo // building lib steam_api.dll - 32
|
|
set "_build_tmp=%build_temp_dir%\steam_api32"
|
|
mkdir "%_build_tmp%"
|
|
cl %common_compiler_args_32% /Fo%_build_tmp%\ /Fe%_build_tmp%\ %debug_info% %debug_info_format% %optimization_level% %release_defs% /LD %release_incs32% %release_src% %release_libs32% /link %common_win_linker_args_32% /DLL /OUT:"%build_root_dir%\x32\steam_api.dll"
|
|
set /a _exit=%errorlevel%
|
|
rmdir /s /q "%_build_tmp%"
|
|
endlocal & exit /b %_exit%
|
|
|
|
:compile_experimental_lib32
|
|
setlocal
|
|
echo // building lib experimental steam_api.dll - 32
|
|
set "_build_tmp=%build_temp_dir%\ex_steam_api32"
|
|
mkdir "%_build_tmp%"
|
|
cl %common_compiler_args_32% /Fo%_build_tmp%\ /Fe%_build_tmp%\ %debug_info% %debug_info_format% %optimization_level% %release_defs% /DEMU_EXPERIMENTAL_BUILD /DCONTROLLER_SUPPORT /DEMU_OVERLAY /LD %release_incs32% /IImGui /Ioverlay_experimental %release_src% "%libs_dir%\detours\*.cpp" controller/gamepad.c "%libs_dir%\ImGui\*.cpp" "%libs_dir%\ImGui\backends\imgui_impl_dx*.cpp" "%libs_dir%\ImGui\backends\imgui_impl_win32.cpp" "%libs_dir%\ImGui\backends\imgui_impl_vulkan.cpp" "%libs_dir%\ImGui\backends\imgui_impl_opengl3.cpp" "%libs_dir%\ImGui\backends\imgui_win_shader_blobs.cpp" overlay_experimental/*.cpp overlay_experimental/windows/*.cpp overlay_experimental/System/*.cpp %release_libs32% /link %common_win_linker_args_32% /DLL /OUT:"%experimental_dir%\x32\steam_api.dll"
|
|
set /a _exit=%errorlevel%
|
|
rmdir /s /q "%_build_tmp%"
|
|
endlocal & exit /b %_exit%
|
|
|
|
:compile_experimental_client32
|
|
setlocal
|
|
echo // building lib experimental steamclient.dll - 32
|
|
set "_build_tmp=%build_temp_dir%\ex_steamclient32"
|
|
mkdir "%_build_tmp%"
|
|
cl %common_compiler_args_32% /Fo%_build_tmp%\ /Fe%_build_tmp%\ %debug_info% %debug_info_format% %optimization_level% %release_defs% /DEMU_EXPERIMENTAL_BUILD /LD %release_incs32% "steamclient\steamclient.cpp" %release_libs32% /link %common_win_linker_args_32% /DLL /OUT:"%experimental_dir%\x32\steamclient.dll"
|
|
set /a _exit=%errorlevel%
|
|
rmdir /s /q "%_build_tmp%"
|
|
endlocal & exit /b %_exit%
|
|
|
|
:compile_experimentalclient_32
|
|
setlocal
|
|
echo // building lib steamclient.dll - 32
|
|
set "_build_tmp=%build_temp_dir%\steamclient32"
|
|
mkdir "%_build_tmp%"
|
|
cl %common_compiler_args_32% /Fo%_build_tmp%\ /Fe%_build_tmp%\ %debug_info% %debug_info_format% %optimization_level% %release_defs% /DEMU_EXPERIMENTAL_BUILD /DCONTROLLER_SUPPORT /DEMU_OVERLAY /DSTEAMCLIENT_DLL /LD %release_incs32% /IImGui /Ioverlay_experimental %release_src% "%libs_dir%\detours\*.cpp" controller/gamepad.c "%libs_dir%\ImGui\*.cpp" "%libs_dir%\ImGui\backends\imgui_impl_dx*.cpp" "%libs_dir%\ImGui\backends\imgui_impl_win32.cpp" "%libs_dir%\ImGui\backends\imgui_impl_vulkan.cpp" "%libs_dir%\ImGui\backends\imgui_impl_opengl3.cpp" "%libs_dir%\ImGui\backends\imgui_win_shader_blobs.cpp" overlay_experimental/*.cpp overlay_experimental/windows/*.cpp overlay_experimental/System/*.cpp %release_libs32% /link %common_win_linker_args_32% /DLL /OUT:"%steamclient_dir%\steamclient.dll"
|
|
set /a _exit=%errorlevel%
|
|
rmdir /s /q "%_build_tmp%"
|
|
endlocal & exit /b %_exit%
|
|
|
|
:compile_experimentalclient_ldr
|
|
setlocal
|
|
echo // building executable steamclient_loader.exe - 32
|
|
:: common_win_linker_args_32 isn't a mistake, the entry is wWinMain
|
|
:: check this table: https://learn.microsoft.com/en-us/cpp/build/reference/entry-entry-point-symbol#remarks
|
|
set "_build_tmp=%build_temp_dir%\client_loader32"
|
|
mkdir "%_build_tmp%"
|
|
cl %common_compiler_args_32% /Fo%_build_tmp%\ /Fe%_build_tmp%\ %debug_info% %debug_info_format% %optimization_level% %release_defs% %release_incs32% "%tools_src_dir%\steamclient_loader\win\*.cpp" %release_libs32% user32.lib /link %common_win_linker_args_32% /OUT:"%steamclient_dir%\steamclient_loader.exe"
|
|
set /a _exit=%errorlevel%
|
|
rmdir /s /q "%_build_tmp%"
|
|
endlocal & exit /b %_exit%
|
|
|
|
:compile_tool_itf
|
|
setlocal
|
|
echo // building tool generate_interfaces_file.exe - 32
|
|
set "_build_tmp=%build_temp_dir%\generate_interfaces32"
|
|
mkdir "%_build_tmp%"
|
|
cl %common_compiler_args_32% /Fo%_build_tmp%\ /Fe%_build_tmp%\ %debug_info% %debug_info_format% %optimization_level% %release_defs% %release_incs32% "%tools_src_dir%\generate_interfaces\generate_interfaces.cpp" %release_libs32% /link %common_exe_linker_args_32% /OUT:"%find_interfaces_dir%\generate_interfaces_file.exe"
|
|
set /a _exit=%errorlevel%
|
|
rmdir /s /q "%_build_tmp%"
|
|
endlocal & exit /b %_exit%
|
|
|
|
:compile_tool_lobby
|
|
setlocal
|
|
echo // building tool lobby_connect.exe - 32
|
|
set "_build_tmp=%build_temp_dir%\lobby_connect32"
|
|
mkdir "%_build_tmp%"
|
|
cl %common_compiler_args_32% /Fo%_build_tmp%\ /Fe%_build_tmp%\ %debug_info% %debug_info_format% %optimization_level% %release_defs% /DNO_DISK_WRITES /DLOBBY_CONNECT %release_incs32% "%tools_src_dir%\lobby_connect\lobby_connect.cpp" %release_src% %release_libs32% Comdlg32.lib /link %common_exe_linker_args_32% /OUT:"%lobby_connect_dir%\lobby_connect.exe"
|
|
set /a _exit=%errorlevel%
|
|
rmdir /s /q "%_build_tmp%"
|
|
endlocal & exit /b %_exit%
|
|
|
|
|
|
|
|
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: x64
|
|
:compile_lib64
|
|
setlocal
|
|
echo // building lib steam_api64.dll - 64
|
|
set "_build_tmp=%build_temp_dir%\steam_api64"
|
|
mkdir "%_build_tmp%"
|
|
cl %common_compiler_args_64% /Fo%_build_tmp%\ /Fe%_build_tmp%\ %debug_info% %debug_info_format% %optimization_level% %release_defs% /LD %release_incs64% %release_src% %release_libs64% /link %common_win_linker_args_64% /DLL /OUT:"%build_root_dir%\x64\steam_api64.dll"
|
|
set /a _exit=%errorlevel%
|
|
rmdir /s /q "%_build_tmp%"
|
|
endlocal & exit /b %_exit%
|
|
|
|
:compile_experimental_lib64
|
|
setlocal
|
|
echo // building lib experimental steam_api64.dll - 64
|
|
set "_build_tmp=%build_temp_dir%\ex_steam_api64"
|
|
mkdir "%_build_tmp%"
|
|
cl %common_compiler_args_64% /Fo%_build_tmp%\ /Fe%_build_tmp%\ %debug_info% %debug_info_format% %optimization_level% %release_defs% /DEMU_EXPERIMENTAL_BUILD /DCONTROLLER_SUPPORT /DEMU_OVERLAY /LD %release_incs64% /IImGui /Ioverlay_experimental %release_src% "%libs_dir%\detours\*.cpp" controller/gamepad.c "%libs_dir%\ImGui\*.cpp" "%libs_dir%\ImGui\backends\imgui_impl_dx*.cpp" "%libs_dir%\ImGui\backends\imgui_impl_win32.cpp" "%libs_dir%\ImGui\backends\imgui_impl_vulkan.cpp" "%libs_dir%\ImGui\backends\imgui_impl_opengl3.cpp" "%libs_dir%\ImGui\backends\imgui_win_shader_blobs.cpp" overlay_experimental/*.cpp overlay_experimental/windows/*.cpp overlay_experimental/System/*.cpp %release_libs64% opengl32.lib /link %common_win_linker_args_64% /DLL /OUT:"%experimental_dir%\x64\steam_api64.dll"
|
|
set /a _exit=%errorlevel%
|
|
rmdir /s /q "%_build_tmp%"
|
|
endlocal & exit /b %_exit%
|
|
|
|
:compile_experimental_client64
|
|
setlocal
|
|
echo // building lib experimental steamclient64.dll - 64
|
|
set "_build_tmp=%build_temp_dir%\ex_steamclient64"
|
|
mkdir "%_build_tmp%"
|
|
cl %common_compiler_args_64% /Fo%_build_tmp%\ /Fe%_build_tmp%\ %debug_info% %debug_info_format% %optimization_level% %release_defs% /DEMU_EXPERIMENTAL_BUILD /LD %release_incs64% "steamclient\steamclient.cpp" %release_libs64% /link %common_win_linker_args_64% /DLL /OUT:"%experimental_dir%\x64\steamclient64.dll"
|
|
set /a _exit=%errorlevel%
|
|
rmdir /s /q "%_build_tmp%"
|
|
endlocal & exit /b %_exit%
|
|
|
|
:compile_experimentalclient_64
|
|
setlocal
|
|
echo // building lib steamclient64.dll - 64
|
|
set "_build_tmp=%build_temp_dir%\steamclient64"
|
|
mkdir "%_build_tmp%"
|
|
cl %common_compiler_args_64% /Fo%_build_tmp%\ /Fe%_build_tmp%\ %debug_info% %debug_info_format% %optimization_level% %release_defs% /DEMU_EXPERIMENTAL_BUILD /DCONTROLLER_SUPPORT /DEMU_OVERLAY /DSTEAMCLIENT_DLL /LD %release_incs64% /IImGui /Ioverlay_experimental %release_src% "%libs_dir%\detours\*.cpp" controller/gamepad.c "%libs_dir%\ImGui\*.cpp" "%libs_dir%\ImGui\backends\imgui_impl_dx*.cpp" "%libs_dir%\ImGui\backends\imgui_impl_win32.cpp" "%libs_dir%\ImGui\backends\imgui_impl_vulkan.cpp" "%libs_dir%\ImGui\backends\imgui_impl_opengl3.cpp" "%libs_dir%\ImGui\backends\imgui_win_shader_blobs.cpp" overlay_experimental/*.cpp overlay_experimental/windows/*.cpp overlay_experimental/System/*.cpp %release_libs64% opengl32.lib /link %common_win_linker_args_64% /DLL /OUT:"%steamclient_dir%\steamclient64.dll"
|
|
set /a _exit=%errorlevel%
|
|
rmdir /s /q "%_build_tmp%"
|
|
endlocal & exit /b %_exit%
|
|
|
|
|
|
|
|
:err_msg
|
|
1>&2 echo [X] %~1
|
|
exit /b
|
|
|
|
|
|
:get_parallel_threads_count
|
|
for /f "tokens=* delims=" %%A in ('echo %~1^| findstr /B /R /X "^[0-9][0-9]*$" 2^>nul') do (
|
|
set /a PARALLEL_THREADS_OVERRIDE=%~1
|
|
rem echo [?] Overriding parralel build jobs count with %~1
|
|
exit /b 0
|
|
)
|
|
exit /b 1
|
|
|
|
|
|
:cleanup
|
|
del /f /q *.exp >nul 2>&1
|
|
del /f /q *.lib >nul 2>&1
|
|
del /f /q *.a >nul 2>&1
|
|
del /f /q *.obj >nul 2>&1
|
|
del /f /q *.pdb >nul 2>&1
|
|
del /f /q *.ilk >nul 2>&1
|
|
del /f /q dll\net.pb.cc >nul 2>&1
|
|
del /f /q dll\net.pb.h >nul 2>&1
|
|
rmdir /s /q "%build_temp_dir%" >nul 2>&1
|
|
rmdir /s /q "%protoc_out_dir%" >nul 2>&1
|
|
for %%A in ("ilk" "lib" "exp") do (
|
|
del /f /s /q "%build_root_dir%\*.%%~A" >nul 2>&1
|
|
)
|
|
exit /b
|
|
|
|
|
|
:end_script
|
|
echo:
|
|
if %last_code% equ 0 (
|
|
echo [GG] no failures
|
|
) else (
|
|
1>&2 echo [XX] general failure
|
|
)
|
|
popd
|
|
endlocal & (
|
|
exit /b %last_code%
|
|
)
|