+ check for vswhere before attempting any detection

+ niceness for terminal output

+ update Windows + Linux scripts to use the new directories of third party + propagate exit error code + fix line ending

+ update Windows deps build script to clean generated build files by cmake after install + propagate exit code of all builds

+ update Linux deps build script to clean generated build files by cmake after install + propagate exit code of all builds

+ fix line ending!
This commit is contained in:
ota 2023-12-15 20:01:14 +02:00 committed by otavepto
parent 6fa1ba1bec
commit 2e69c038cc
5 changed files with 968 additions and 871 deletions

View File

@ -156,6 +156,7 @@ deps_dir="build-linux-deps"
build_root_dir="build-linux/$build_folder" build_root_dir="build-linux/$build_folder"
build_temp_dir="build-linux-temp" build_temp_dir="build-linux-temp"
third_party_dir="third-party" third_party_dir="third-party"
third_party_build_dir="$third_party_dir/build/linux"
build_root_32="$build_root_dir/x32" build_root_32="$build_root_dir/x32"
build_root_64="$build_root_dir/x64" build_root_64="$build_root_dir/x64"
build_root_tools="$build_root_dir/tools" build_root_tools="$build_root_dir/tools"
@ -234,7 +235,7 @@ release_libs=(
protoc_exe_32="$deps_dir/protobuf/install32/bin/protoc" protoc_exe_32="$deps_dir/protobuf/install32/bin/protoc"
protoc_exe_64="$deps_dir/protobuf/install64/bin/protoc" protoc_exe_64="$deps_dir/protobuf/install64/bin/protoc"
parallel_exe="$third_party_dir/rush-v0.5.4-linux/rush" parallel_exe="$third_party_build_dir/rush-v0.5.4-linux/rush"
[ ! -d "$deps_dir" ] && { [ ! -d "$deps_dir" ] && {
echo "[X] Dependencies dir \"$deps_dir\" was not found" >&2; echo "[X] Dependencies dir \"$deps_dir\" was not found" >&2;
@ -260,6 +261,8 @@ chmod 777 "$parallel_exe"
echo "[?] All build operations will use $build_threads parallel jobs" echo "[?] All build operations will use $build_threads parallel jobs"
last_code=0
### create folders + copy common scripts ### create folders + copy common scripts
echo // creating dirs + copying tools echo // creating dirs + copying tools
rm -f -r "$build_root_dir" rm -f -r "$build_root_dir"
@ -301,7 +304,7 @@ function build_for () {
rm -f -r -d "$tmp_work_dir" rm -f -r -d "$tmp_work_dir"
mkdir -p "$tmp_work_dir" || { mkdir -p "$tmp_work_dir" || {
echo [X] "Failed to create compilation directory" >&2; echo [X] "Failed to create compilation directory" >&2;
exit 1; return 1;
} }
local build_cmds=() local build_cmds=()
@ -377,6 +380,7 @@ if [[ "$BUILD_LIB32" = "1" ]]; then
extra_src_files=("controller/*.c") extra_src_files=("controller/*.c")
build_for 1 0 "$build_root_32/libsteam_api.so" '-DCONTROLLER_SUPPORT' extra_src_files build_for 1 0 "$build_root_32/libsteam_api.so" '-DCONTROLLER_SUPPORT' extra_src_files
last_code=$((last_code + $?))
fi fi
if [[ "$BUILD_CLIENT32" = "1" ]]; then if [[ "$BUILD_CLIENT32" = "1" ]]; then
@ -384,6 +388,7 @@ if [[ "$BUILD_CLIENT32" = "1" ]]; then
extra_src_files=("controller/*.c") extra_src_files=("controller/*.c")
build_for 1 0 "$build_root_32/steamclient.so" '-DCONTROLLER_SUPPORT -DSTEAMCLIENT_DLL' extra_src_files build_for 1 0 "$build_root_32/steamclient.so" '-DCONTROLLER_SUPPORT -DSTEAMCLIENT_DLL' extra_src_files
last_code=$((last_code + $?))
fi fi
if [[ "$BUILD_TOOL_LOBBY32" = "1" ]]; then if [[ "$BUILD_TOOL_LOBBY32" = "1" ]]; then
@ -391,6 +396,7 @@ if [[ "$BUILD_TOOL_LOBBY32" = "1" ]]; then
extra_src_files=("lobby_connect.cpp") extra_src_files=("lobby_connect.cpp")
build_for 1 1 "$build_root_tools/lobby_connect_x32" '-DNO_DISK_WRITES -DLOBBY_CONNECT' extra_src_files build_for 1 1 "$build_root_tools/lobby_connect_x32" '-DNO_DISK_WRITES -DLOBBY_CONNECT' extra_src_files
last_code=$((last_code + $?))
fi fi
echo; echo echo; echo
@ -409,6 +415,7 @@ if [[ "$BUILD_LIB64" = "1" ]]; then
extra_src_files=("controller/*.c") extra_src_files=("controller/*.c")
build_for 0 0 "$build_root_64/libsteam_api.so" '-DCONTROLLER_SUPPORT' extra_src_files build_for 0 0 "$build_root_64/libsteam_api.so" '-DCONTROLLER_SUPPORT' extra_src_files
last_code=$((last_code + $?))
fi fi
if [[ "$BUILD_CLIENT64" = "1" ]]; then if [[ "$BUILD_CLIENT64" = "1" ]]; then
@ -416,6 +423,7 @@ if [[ "$BUILD_CLIENT64" = "1" ]]; then
extra_src_files=("controller/*.c") extra_src_files=("controller/*.c")
build_for 0 0 "$build_root_64/steamclient.so" '-DCONTROLLER_SUPPORT -DSTEAMCLIENT_DLL' extra_src_files build_for 0 0 "$build_root_64/steamclient.so" '-DCONTROLLER_SUPPORT -DSTEAMCLIENT_DLL' extra_src_files
last_code=$((last_code + $?))
fi fi
if [[ "$BUILD_TOOL_LOBBY64" = "1" ]]; then if [[ "$BUILD_TOOL_LOBBY64" = "1" ]]; then
@ -423,6 +431,7 @@ if [[ "$BUILD_TOOL_LOBBY64" = "1" ]]; then
extra_src_files=("lobby_connect.cpp") extra_src_files=("lobby_connect.cpp")
build_for 0 1 "$build_root_tools/lobby_connect_x64" '-DNO_DISK_WRITES -DLOBBY_CONNECT' extra_src_files build_for 0 1 "$build_root_tools/lobby_connect_x64" '-DNO_DISK_WRITES -DLOBBY_CONNECT' extra_src_files
last_code=$((last_code + $?))
fi fi
echo; echo echo; echo
@ -433,3 +442,4 @@ rm -f dll/net.pb.cc
rm -f dll/net.pb.h rm -f dll/net.pb.h
rm -f -r -d "$build_temp_dir" rm -f -r -d "$build_temp_dir"
exit $last_code

View File

@ -22,7 +22,9 @@ fi
script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
deps_dir="$script_dir/build-linux-deps" deps_dir="$script_dir/build-linux-deps"
third_party_dir="$script_dir/third-party" third_party_dir="$script_dir/third-party"
mycmake="$third_party_dir/cmake-3.27.7-linux-x86_64/bin/cmake" third_party_deps_dir="$third_party_dir/deps/linux"
third_party_common_dir="$third_party_dir/deps/common/src"
mycmake="$third_party_deps_dir/cmake-3.27.7-linux-x86_64/bin/cmake"
[[ -f "$mycmake" ]] || { [[ -f "$mycmake" ]] || {
echo "[X] Couldn't find cmake" >&2 echo "[X] Couldn't find cmake" >&2
@ -71,6 +73,8 @@ mkdir -p "$deps_dir" || {
echo; echo echo; echo
last_code=0
############## required packages ############## ############## required packages ##############
echo // installing required packages echo // installing required packages
@ -121,23 +125,25 @@ EOL
echo ; echo echo ; echo
############## common CMAKE args ############## ############## common CMAKE args ##############
# https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_FLAGS_CONFIG.html#variable:CMAKE_%3CLANG%3E_FLAGS_%3CCONFIG%3E # https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_FLAGS_CONFIG.html#variable:CMAKE_%3CLANG%3E_FLAGS_%3CCONFIG%3E
cmake_common_args='-G "Unix Makefiles" -S .' cmake_common_args='-G "Unix Makefiles" -S .'
cmake_common_defs="-DCMAKE_BUILD_TYPE=Release -DCMAKE_C_STANDARD_REQUIRED=ON -DCMAKE_CXX_STANDARD_REQUIRED=ON -DCMAKE_C_STANDARD=17 -DCMAKE_CXX_STANDARD=17 -DCMAKE_POSITION_INDEPENDENT_CODE=True -DBUILD_SHARED_LIBS=OFF" cmake_common_defs="-DCMAKE_BUILD_TYPE=Release -DCMAKE_C_STANDARD_REQUIRED=ON -DCMAKE_CXX_STANDARD_REQUIRED=ON -DCMAKE_C_STANDARD=17 -DCMAKE_CXX_STANDARD=17 -DCMAKE_POSITION_INDEPENDENT_CODE=True -DBUILD_SHARED_LIBS=OFF"
cmake_gen32="rm -f -r build32/ && rm -f -r install32/ && mkdir build32/ && mkdir install32/ && '$mycmake' $cmake_common_args -B build32 -DCMAKE_TOOLCHAIN_FILE=$deps_dir/32-bit-toolchain.cmake -DCMAKE_INSTALL_PREFIX=install32 $cmake_common_defs" recreate_32="rm -f -r build32/ && rm -f -r install32/ && mkdir build32/ && mkdir install32/"
cmake_gen64="rm -f -r build64/ && rm -f -r install64/ && mkdir build64/ && mkdir install64/ && '$mycmake' $cmake_common_args -B build64 -DCMAKE_TOOLCHAIN_FILE=$deps_dir/64-bit-toolchain.cmake -DCMAKE_INSTALL_PREFIX=install64 $cmake_common_defs" recreate_64="rm -f -r build64/ && rm -f -r install64/ && mkdir build64/ && mkdir install64/"
cmake_gen32="'$mycmake' $cmake_common_args -B build32 -DCMAKE_TOOLCHAIN_FILE=$deps_dir/32-bit-toolchain.cmake -DCMAKE_INSTALL_PREFIX=install32 $cmake_common_defs"
cmake_gen64="'$mycmake' $cmake_common_args -B build64 -DCMAKE_TOOLCHAIN_FILE=$deps_dir/64-bit-toolchain.cmake -DCMAKE_INSTALL_PREFIX=install64 $cmake_common_defs"
cmake_build32="'$mycmake' --build build32 --config Release --parallel $build_threads $VERBOSITY" cmake_build32="'$mycmake' --build build32 --config Release --parallel $build_threads $VERBOSITY"
cmake_build64="'$mycmake' --build build64 --config Release --parallel $build_threads $VERBOSITY" cmake_build64="'$mycmake' --build build64 --config Release --parallel $build_threads $VERBOSITY"
clean_gen32="[[ -d build32 ]] && rm -f -r build32/"
clean_gen64="[[ -d build64 ]] && rm -f -r build64/"
chmod 777 "$mycmake" chmod 777 "$mycmake"
############## build ssq ############## ############## build ssq ##############
echo // building ssq lib echo // building ssq lib
tar -zxf "$third_party_dir/v3.0.0.tar.gz" -C "$deps_dir" tar -zxf "$third_party_common_dir/v3.0.0.tar.gz" -C "$deps_dir"
for i in {1..10}; do for i in {1..10}; do
mv "$deps_dir/libssq-3.0.0" "$deps_dir/ssq" && { break; } || { sleep 1; } mv "$deps_dir/libssq-3.0.0" "$deps_dir/ssq" && { break; } || { sleep 1; }
@ -146,11 +152,17 @@ done
chmod -R 777 "$deps_dir/ssq" chmod -R 777 "$deps_dir/ssq"
pushd "$deps_dir/ssq" pushd "$deps_dir/ssq"
eval $recreate_32
eval $cmake_gen32 eval $cmake_gen32
last_code=$((last_code + $?))
eval $cmake_build32 eval $cmake_build32
last_code=$((last_code + $?))
eval $recreate_64
eval $cmake_gen64 eval $cmake_gen64
last_code=$((last_code + $?))
eval $cmake_build64 eval $cmake_build64
last_code=$((last_code + $?))
popd popd
echo ; echo echo ; echo
@ -158,7 +170,7 @@ echo ; echo
############## build zlib ############## ############## build zlib ##############
echo // building zlib lib echo // building zlib lib
tar -zxf "$third_party_dir/zlib-1.3.tar.gz" -C "$deps_dir" tar -zxf "$third_party_common_dir/zlib-1.3.tar.gz" -C "$deps_dir"
for i in {1..10}; do for i in {1..10}; do
mv "$deps_dir/zlib-1.3" "$deps_dir/zlib" && { break; } || { sleep 1; } mv "$deps_dir/zlib-1.3" "$deps_dir/zlib" && { break; } || { sleep 1; }
@ -167,11 +179,19 @@ done
chmod -R 777 "$deps_dir/zlib" chmod -R 777 "$deps_dir/zlib"
pushd "$deps_dir/zlib" pushd "$deps_dir/zlib"
eval $recreate_32
eval $cmake_gen32 eval $cmake_gen32
last_code=$((last_code + $?))
eval $cmake_build32 --target install eval $cmake_build32 --target install
last_code=$((last_code + $?))
eval $clean_gen32
eval $recreate_64
eval $cmake_gen64 eval $cmake_gen64
last_code=$((last_code + $?))
eval $cmake_build64 --target install eval $cmake_build64 --target install
last_code=$((last_code + $?))
eval $clean_gen64
popd popd
echo ; echo echo ; echo
@ -216,7 +236,7 @@ wild_zlib_64=(
############## build curl ############## ############## build curl ##############
echo // building curl lib echo // building curl lib
tar -zxf "$third_party_dir/curl-8.4.0.tar.gz" -C "$deps_dir" tar -zxf "$third_party_common_dir/curl-8.4.0.tar.gz" -C "$deps_dir"
for i in {1..10}; do for i in {1..10}; do
mv "$deps_dir/curl-8.4.0" "$deps_dir/curl" && { break; } || { sleep 1; } mv "$deps_dir/curl-8.4.0" "$deps_dir/curl" && { break; } || { sleep 1; }
@ -227,11 +247,19 @@ pushd "$deps_dir/curl"
curl_common_defs="-DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DBUILD_STATIC_CURL=OFF -DBUILD_STATIC_LIBS=ON -DCURL_USE_OPENSSL=OFF -DCURL_ZLIB=ON" curl_common_defs="-DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DBUILD_STATIC_CURL=OFF -DBUILD_STATIC_LIBS=ON -DCURL_USE_OPENSSL=OFF -DCURL_ZLIB=ON"
eval $recreate_32
eval $cmake_gen32 $curl_common_defs "${wild_zlib_32[@]}" -DCMAKE_SHARED_LINKER_FLAGS_INIT="'$deps_dir/zlib/install32/lib/libz.a'" -DCMAKE_MODULE_LINKER_FLAGS_INIT="'$deps_dir/zlib/install32/lib/libz.a'" -DCMAKE_EXE_LINKER_FLAGS_INIT="'$deps_dir/zlib/install32/lib/libz.a'" eval $cmake_gen32 $curl_common_defs "${wild_zlib_32[@]}" -DCMAKE_SHARED_LINKER_FLAGS_INIT="'$deps_dir/zlib/install32/lib/libz.a'" -DCMAKE_MODULE_LINKER_FLAGS_INIT="'$deps_dir/zlib/install32/lib/libz.a'" -DCMAKE_EXE_LINKER_FLAGS_INIT="'$deps_dir/zlib/install32/lib/libz.a'"
last_code=$((last_code + $?))
eval $cmake_build32 --target install eval $cmake_build32 --target install
last_code=$((last_code + $?))
eval $clean_gen32
eval $recreate_64
eval $cmake_gen64 $curl_common_defs "${wild_zlib_64[@]}" -DCMAKE_SHARED_LINKER_FLAGS_INIT="'$deps_dir/zlib/install64/lib/libz.a'" -DCMAKE_MODULE_LINKER_FLAGS_INIT="'$deps_dir/zlib/install64/lib/libz.a'" -DCMAKE_EXE_LINKER_FLAGS_INIT="'$deps_dir/zlib/install64/lib/libz.a'" eval $cmake_gen64 $curl_common_defs "${wild_zlib_64[@]}" -DCMAKE_SHARED_LINKER_FLAGS_INIT="'$deps_dir/zlib/install64/lib/libz.a'" -DCMAKE_MODULE_LINKER_FLAGS_INIT="'$deps_dir/zlib/install64/lib/libz.a'" -DCMAKE_EXE_LINKER_FLAGS_INIT="'$deps_dir/zlib/install64/lib/libz.a'"
last_code=$((last_code + $?))
eval $cmake_build64 --target install eval $cmake_build64 --target install
last_code=$((last_code + $?))
eval $clean_gen64
popd popd
echo ; echo echo ; echo
@ -239,7 +267,7 @@ echo ; echo
############## build protobuf ############## ############## build protobuf ##############
echo // building protobuf lib echo // building protobuf lib
tar -zxf "$third_party_dir/v21.12.tar.gz" -C "$deps_dir" tar -zxf "$third_party_common_dir/v21.12.tar.gz" -C "$deps_dir"
for i in {1..10}; do for i in {1..10}; do
mv "$deps_dir/protobuf-21.12" "$deps_dir/protobuf" && { break; } || { sleep 1; } mv "$deps_dir/protobuf-21.12" "$deps_dir/protobuf" && { break; } || { sleep 1; }
@ -250,11 +278,21 @@ pushd "$deps_dir/protobuf"
proto_common_defs="-Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_BUILD_SHARED_LIBS=OFF -Dprotobuf_WITH_ZLIB=ON" proto_common_defs="-Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_BUILD_SHARED_LIBS=OFF -Dprotobuf_WITH_ZLIB=ON"
eval $recreate_32
eval $cmake_gen32 $proto_common_defs "${wild_zlib_32[@]}" -DCMAKE_SHARED_LINKER_FLAGS_INIT="'$deps_dir/zlib/install32/lib/libz.a'" -DCMAKE_MODULE_LINKER_FLAGS_INIT="'$deps_dir/zlib/install32/lib/libz.a'" -DCMAKE_EXE_LINKER_FLAGS_INIT="'$deps_dir/zlib/install32/lib/libz.a'" eval $cmake_gen32 $proto_common_defs "${wild_zlib_32[@]}" -DCMAKE_SHARED_LINKER_FLAGS_INIT="'$deps_dir/zlib/install32/lib/libz.a'" -DCMAKE_MODULE_LINKER_FLAGS_INIT="'$deps_dir/zlib/install32/lib/libz.a'" -DCMAKE_EXE_LINKER_FLAGS_INIT="'$deps_dir/zlib/install32/lib/libz.a'"
last_code=$((last_code + $?))
eval $cmake_build32 --target install eval $cmake_build32 --target install
last_code=$((last_code + $?))
eval $clean_gen32
eval $recreate_64
eval $cmake_gen64 $proto_common_defs "${wild_zlib_64[@]}" -DCMAKE_SHARED_LINKER_FLAGS_INIT="'$deps_dir/zlib/install64/lib/libz.a'" -DCMAKE_MODULE_LINKER_FLAGS_INIT="'$deps_dir/zlib/install64/lib/libz.a'" -DCMAKE_EXE_LINKER_FLAGS_INIT="'$deps_dir/zlib/install64/lib/libz.a'" eval $cmake_gen64 $proto_common_defs "${wild_zlib_64[@]}" -DCMAKE_SHARED_LINKER_FLAGS_INIT="'$deps_dir/zlib/install64/lib/libz.a'" -DCMAKE_MODULE_LINKER_FLAGS_INIT="'$deps_dir/zlib/install64/lib/libz.a'" -DCMAKE_EXE_LINKER_FLAGS_INIT="'$deps_dir/zlib/install64/lib/libz.a'"
last_code=$((last_code + $?))
eval $cmake_build64 --target install eval $cmake_build64 --target install
last_code=$((last_code + $?))
eval $clean_gen64
popd popd
echo ; echo echo ; echo
exit $last_code

View File

@ -249,53 +249,62 @@ echo // cleaning up to build 32
call build_win_clean.bat call build_win_clean.bat
mkdir "%build_temp_dir%" mkdir "%build_temp_dir%"
echo // invoking protobuf compiler - 32
"%protoc_exe_32%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto
call build_win_set_env.bat 32 || ( call build_win_set_env.bat 32 || (
endlocal endlocal
call :err_msg "Couldn't find Visual Studio or build tools - 32" call :err_msg "Couldn't find Visual Studio or build tools - 32"
set /a last_code=1 set /a last_code=1
goto :end_script goto :end_script
) )
echo // invoking protobuf compiler - 32
"%protoc_exe_32%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto
set /a last_code+=errorlevel
echo: & echo: echo: & echo:
if %BUILD_LIB32% equ 1 ( if %BUILD_LIB32% equ 1 (
call :compile_lib32 call :compile_lib32
set /a last_code+=errorlevel
echo: & echo: echo: & echo:
) )
if %BUILD_EXP_LIB32% equ 1 ( if %BUILD_EXP_LIB32% equ 1 (
call :compile_experimental_lib32 call :compile_experimental_lib32
set /a last_code+=errorlevel
echo: & echo: echo: & echo:
) )
if %BUILD_EXP_CLIENT32% equ 1 ( if %BUILD_EXP_CLIENT32% equ 1 (
call :compile_experimental_client32 call :compile_experimental_client32
set /a last_code+=errorlevel
echo: & echo: echo: & echo:
) )
if %BUILD_EXPCLIENT32% equ 1 ( if %BUILD_EXPCLIENT32% equ 1 (
call :compile_experimentalclient_32 call :compile_experimentalclient_32
set /a last_code+=errorlevel
echo: & echo: echo: & echo:
) )
:: steamclient_loader :: steamclient_loader
if %BUILD_EXPCLIENT_LDR% equ 1 ( if %BUILD_EXPCLIENT_LDR% equ 1 (
call :compile_experimentalclient_ldr call :compile_experimentalclient_ldr
set /a last_code+=errorlevel
echo: & echo: echo: & echo:
) )
:: tools (x32) :: tools (x32)
if %BUILD_TOOL_FIND_ITFS% equ 1 ( if %BUILD_TOOL_FIND_ITFS% equ 1 (
call :compile_tool_itf call :compile_tool_itf
set /a last_code+=errorlevel
echo: & echo: echo: & echo:
) )
if %BUILD_TOOL_LOBBY% equ 1 ( if %BUILD_TOOL_LOBBY% equ 1 (
call :compile_tool_lobby call :compile_tool_lobby
set /a last_code+=errorlevel
echo: & echo: echo: & echo:
) )
endlocal endlocal & set /a last_code=%last_code%
:: some times the next build will fail, a timeout solved it :: some times the next build will fail, a timeout solved it
@ -309,37 +318,43 @@ echo // cleaning up to build 64
call build_win_clean.bat call build_win_clean.bat
mkdir "%build_temp_dir%" mkdir "%build_temp_dir%"
echo // invoking protobuf compiler - 64
"%protoc_exe_64%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto
call build_win_set_env.bat 64 || ( call build_win_set_env.bat 64 || (
endlocal endlocal
call :err_msg "Couldn't find Visual Studio or build tools - 64" call :err_msg "Couldn't find Visual Studio or build tools - 64"
set /a last_code=1 set /a last_code=1
goto :end_script goto :end_script
) )
echo // invoking protobuf compiler - 64
"%protoc_exe_64%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto
set /a last_code+=errorlevel
echo: & echo: echo: & echo:
if %BUILD_LIB64% equ 1 ( if %BUILD_LIB64% equ 1 (
call :compile_lib64 call :compile_lib64
set /a last_code+=errorlevel
echo: & echo: echo: & echo:
) )
if %BUILD_EXP_LIB64% equ 1 ( if %BUILD_EXP_LIB64% equ 1 (
call :compile_experimental_lib64 call :compile_experimental_lib64
set /a last_code+=errorlevel
echo: & echo: echo: & echo:
) )
if %BUILD_EXP_CLIENT64% equ 1 ( if %BUILD_EXP_CLIENT64% equ 1 (
call :compile_experimental_client64 call :compile_experimental_client64
set /a last_code+=errorlevel
echo: & echo: echo: & echo:
) )
if %BUILD_EXPCLIENT64% equ 1 ( if %BUILD_EXPCLIENT64% equ 1 (
call :compile_experimentalclient_64 call :compile_experimentalclient_64
set /a last_code+=errorlevel
echo: & echo: echo: & echo:
) )
endlocal endlocal & set /a last_code=%last_code%
:: copy configs + examples :: copy configs + examples

View File

@ -5,8 +5,12 @@ pushd "%~dp0"
set "deps_dir=build-win-deps" set "deps_dir=build-win-deps"
set "third_party_dir=third-party" set "third_party_dir=third-party"
set "extractor=%third_party_dir%\7za-win\7za.exe" set "third_party_deps_dir=%third_party_dir%\deps\win"
set "mycmake=%~dp0%third_party_dir%\cmake-3.27.7-windows-x86_64\bin\cmake.exe" set "third_party_common_dir=%third_party_dir%\deps\common\src"
set "extractor=%third_party_deps_dir%\7za-win\7za.exe"
set "mycmake=%~dp0%third_party_deps_dir%\cmake-3.27.7-windows-x86_64\bin\cmake.exe"
set /a last_code=0
if not exist "%extractor%" ( if not exist "%extractor%" (
call :err_msg "Couldn't find extraction tool" call :err_msg "Couldn't find extraction tool"
@ -63,8 +67,6 @@ if %jobs_count% lss 2 (
set /a jobs_count=2 set /a jobs_count=2
) )
set /a last_code=0
call :extract_all_deps call :extract_all_deps
:: ############## common CMAKE args ############## :: ############## common CMAKE args ##############
@ -77,6 +79,8 @@ set cmake_gen32="%mycmake%" %cmake_common_args% -A Win32 -B build32 -DCMAKE_INST
set cmake_gen64="%mycmake%" %cmake_common_args% -A x64 -B build64 -DCMAKE_INSTALL_PREFIX=install64 %cmake_common_defs% set cmake_gen64="%mycmake%" %cmake_common_args% -A x64 -B build64 -DCMAKE_INSTALL_PREFIX=install64 %cmake_common_defs%
set cmake_build32="%mycmake%" --build build32 --config Release --parallel %jobs_count% %VERBOSITY% set cmake_build32="%mycmake%" --build build32 --config Release --parallel %jobs_count% %VERBOSITY%
set cmake_build64="%mycmake%" --build build64 --config Release --parallel %jobs_count% %VERBOSITY% set cmake_build64="%mycmake%" --build build64 --config Release --parallel %jobs_count% %VERBOSITY%
set "clean_gen32=if exist build32\ rmdir /s /q build32"
set "clean_gen64=if exist build64\ rmdir /s /q build64"
:: "-DCMAKE_C_STANDARD_LIBRARIES=kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib" "-DCMAKE_CXX_STANDARD_LIBRARIES=kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib" :: "-DCMAKE_C_STANDARD_LIBRARIES=kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib" "-DCMAKE_CXX_STANDARD_LIBRARIES=kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib"
@ -111,8 +115,10 @@ call "%~dp0build_win_set_env.bat" 32 || (
) )
%recreate_32% %recreate_32%
%cmake_gen32% %cmake_gen32%
set /a _exit=errorlevel
%cmake_build32% %cmake_build32%
endlocal set /a _exit+=errorlevel
endlocal & set /a last_code+=%_exit%
setlocal setlocal
call "%~dp0build_win_set_env.bat" 64 || ( call "%~dp0build_win_set_env.bat" 64 || (
@ -124,8 +130,10 @@ call "%~dp0build_win_set_env.bat" 64 || (
) )
%recreate_64% %recreate_64%
%cmake_gen64% %cmake_gen64%
set /a _exit=errorlevel
%cmake_build64% %cmake_build64%
endlocal set /a _exit+=errorlevel
endlocal & set /a last_code+=%_exit%
popd popd
echo: & echo: echo: & echo:
@ -145,8 +153,11 @@ call "%~dp0build_win_set_env.bat" 32 || (
) )
%recreate_32% %recreate_32%
%cmake_gen32% %cmake_gen32%
set /a _exit=errorlevel
%cmake_build32% --target install %cmake_build32% --target install
endlocal set /a _exit+=errorlevel
%clean_gen32%
endlocal & set /a last_code+=%_exit%
setlocal setlocal
call "%~dp0build_win_set_env.bat" 64 || ( call "%~dp0build_win_set_env.bat" 64 || (
@ -158,8 +169,11 @@ call "%~dp0build_win_set_env.bat" 64 || (
) )
%recreate_64% %recreate_64%
%cmake_gen64% %cmake_gen64%
set /a _exit=errorlevel
%cmake_build64% --target install %cmake_build64% --target install
endlocal set /a _exit+=errorlevel
%clean_gen64%
endlocal & set /a last_code+=%_exit%
popd popd
echo: & echo: echo: & echo:
@ -209,8 +223,11 @@ call "%~dp0build_win_set_env.bat" 32 || (
) )
%recreate_32% %recreate_32%
%cmake_gen32% %curl_common_defs% %wild_zlib_32% "-DCMAKE_SHARED_LINKER_FLAGS_INIT=%~dp0%deps_dir%\zlib\install32\lib\zlibstatic.lib" "-DCMAKE_MODULE_LINKER_FLAGS_INIT=%~dp0%deps_dir%\zlib\install32\lib\zlibstatic.lib" "-DCMAKE_EXE_LINKER_FLAGS_INIT=%~dp0%deps_dir%\zlib\install32\lib\zlibstatic.lib" %cmake_gen32% %curl_common_defs% %wild_zlib_32% "-DCMAKE_SHARED_LINKER_FLAGS_INIT=%~dp0%deps_dir%\zlib\install32\lib\zlibstatic.lib" "-DCMAKE_MODULE_LINKER_FLAGS_INIT=%~dp0%deps_dir%\zlib\install32\lib\zlibstatic.lib" "-DCMAKE_EXE_LINKER_FLAGS_INIT=%~dp0%deps_dir%\zlib\install32\lib\zlibstatic.lib"
set /a _exit=errorlevel
%cmake_build32% --target install %cmake_build32% --target install
endlocal set /a _exit+=errorlevel
%clean_gen32%
endlocal & set /a last_code+=%_exit%
setlocal setlocal
call "%~dp0build_win_set_env.bat" 64 || ( call "%~dp0build_win_set_env.bat" 64 || (
@ -222,8 +239,11 @@ call "%~dp0build_win_set_env.bat" 64 || (
) )
%recreate_64% %recreate_64%
%cmake_gen64% %curl_common_defs% %wild_zlib_64% "-DCMAKE_SHARED_LINKER_FLAGS_INIT=%~dp0%deps_dir%\zlib\install64\lib\zlibstatic.lib" "-DCMAKE_MODULE_LINKER_FLAGS_INIT=%~dp0%deps_dir%\zlib\install64\lib\zlibstatic.lib" "-DCMAKE_EXE_LINKER_FLAGS_INIT=%~dp0%deps_dir%\zlib\install64\lib\zlibstatic.lib" %cmake_gen64% %curl_common_defs% %wild_zlib_64% "-DCMAKE_SHARED_LINKER_FLAGS_INIT=%~dp0%deps_dir%\zlib\install64\lib\zlibstatic.lib" "-DCMAKE_MODULE_LINKER_FLAGS_INIT=%~dp0%deps_dir%\zlib\install64\lib\zlibstatic.lib" "-DCMAKE_EXE_LINKER_FLAGS_INIT=%~dp0%deps_dir%\zlib\install64\lib\zlibstatic.lib"
set /a _exit=errorlevel
%cmake_build64% --target install %cmake_build64% --target install
endlocal set /a _exit+=errorlevel
%clean_gen64%
endlocal & set /a last_code+=%_exit%
popd popd
echo: & echo: echo: & echo:
@ -245,8 +265,11 @@ call "%~dp0build_win_set_env.bat" 32 || (
) )
%recreate_32% %recreate_32%
%cmake_gen32% %proto_common_defs% %wild_zlib_32% "-DCMAKE_SHARED_LINKER_FLAGS_INIT=%~dp0%deps_dir%\zlib\install32\lib\zlibstatic.lib" "-DCMAKE_MODULE_LINKER_FLAGS_INIT=%~dp0%deps_dir%\zlib\install32\lib\zlibstatic.lib" "-DCMAKE_EXE_LINKER_FLAGS_INIT=%~dp0%deps_dir%\zlib\install32\lib\zlibstatic.lib" %cmake_gen32% %proto_common_defs% %wild_zlib_32% "-DCMAKE_SHARED_LINKER_FLAGS_INIT=%~dp0%deps_dir%\zlib\install32\lib\zlibstatic.lib" "-DCMAKE_MODULE_LINKER_FLAGS_INIT=%~dp0%deps_dir%\zlib\install32\lib\zlibstatic.lib" "-DCMAKE_EXE_LINKER_FLAGS_INIT=%~dp0%deps_dir%\zlib\install32\lib\zlibstatic.lib"
set /a _exit=errorlevel
%cmake_build32% --target install %cmake_build32% --target install
endlocal set /a _exit+=errorlevel
%clean_gen32%
endlocal & set /a last_code+=%_exit%
setlocal setlocal
call "%~dp0build_win_set_env.bat" 64 || ( call "%~dp0build_win_set_env.bat" 64 || (
@ -258,8 +281,11 @@ call "%~dp0build_win_set_env.bat" 64 || (
) )
%recreate_64% %recreate_64%
%cmake_gen64% %proto_common_defs% %wild_zlib_64% "-DCMAKE_SHARED_LINKER_FLAGS_INIT=%~dp0%deps_dir%\zlib\install64\lib\zlibstatic.lib" "-DCMAKE_MODULE_LINKER_FLAGS_INIT=%~dp0%deps_dir%\zlib\install64\lib\zlibstatic.lib" "-DCMAKE_EXE_LINKER_FLAGS_INIT=%~dp0%deps_dir%\zlib\install64\lib\zlibstatic.lib" %cmake_gen64% %proto_common_defs% %wild_zlib_64% "-DCMAKE_SHARED_LINKER_FLAGS_INIT=%~dp0%deps_dir%\zlib\install64\lib\zlibstatic.lib" "-DCMAKE_MODULE_LINKER_FLAGS_INIT=%~dp0%deps_dir%\zlib\install64\lib\zlibstatic.lib" "-DCMAKE_EXE_LINKER_FLAGS_INIT=%~dp0%deps_dir%\zlib\install64\lib\zlibstatic.lib"
set /a _exit=errorlevel
%cmake_build64% --target install %cmake_build64% --target install
endlocal set /a _exit+=errorlevel
%clean_gen64%
endlocal & set /a last_code+=%_exit%
popd popd
echo: & echo: echo: & echo:
@ -286,16 +312,16 @@ goto :end_script
goto :extract_all_deps_end goto :extract_all_deps_end
) )
echo // Extracting archive "%third_party_dir%\%%~A" to "%deps_dir%\%%~B" echo // Extracting archive "%third_party_common_dir%\%%~A" to "%deps_dir%\%%~B"
for /f "usebackq tokens=* delims=" %%Z in ('"%%~nA"') do ( for /f "usebackq tokens=* delims=" %%Z in ('"%%~nA"') do (
if /i "%%~xZ%%~xA"==".tar.gz" ( if /i "%%~xZ%%~xA"==".tar.gz" (
"%extractor%" x "%third_party_dir%\%%~A" -so | "%extractor%" x -si -ttar -y -aoa -o"%deps_dir%\%%~B" || ( "%extractor%" x "%third_party_common_dir%\%%~A" -so | "%extractor%" x -si -ttar -y -aoa -o"%deps_dir%\%%~B" || (
call :err_msg "Extraction failed" call :err_msg "Extraction failed"
set /a last_code=1 set /a last_code=1
goto :end_script goto :end_script
) )
) else ( ) else (
"%extractor%" x "%third_party_dir%\%%~A" -y -aoa -o"%deps_dir%\%%~B" || ( "%extractor%" x "%third_party_common_dir%\%%~A" -y -aoa -o"%deps_dir%\%%~B" || (
call :err_msg "Extraction failed" call :err_msg "Extraction failed"
set /a last_code=1 set /a last_code=1
goto :end_script goto :end_script

View File

@ -10,6 +10,12 @@ pushd "%~dp0"
set "vs_static_path=" set "vs_static_path="
set "third_party_dir=third-party" set "third_party_dir=third-party"
set "third_party_common_dir=%third_party_dir%\common\win"
if not exist "%third_party_common_dir%\vswhere\vswhere.exe" (
call :err_msg "vswhere.exe wasn't found in third-party folder"
goto :end_script_with_err
)
set "arch=" set "arch="
if "%~1"=="32" ( if "%~1"=="32" (
@ -24,7 +30,7 @@ if "%~1"=="32" (
set "my_vs_path=%vs_static_path%" set "my_vs_path=%vs_static_path%"
if "%my_vs_path%"=="" ( if "%my_vs_path%"=="" (
for /f "tokens=* delims=" %%A in ('"%third_party_dir%\vswhere.exe" -prerelease -latest -nocolor -nologo -property installationPath 2^>nul') do ( for /f "tokens=* delims=" %%A in ('"%third_party_common_dir%\vswhere\vswhere.exe" -prerelease -latest -nocolor -nologo -property installationPath 2^>nul') do (
set "my_vs_path=%%~A\VC\Auxiliary\Build" set "my_vs_path=%%~A\VC\Auxiliary\Build"
) )
) )
@ -43,9 +49,11 @@ echo Using Visual Studio found in: "%my_vs_path%"
popd popd
endlocal & ( endlocal & (
call "%my_vs_path%\vcvars%arch%.bat" && ( call "%my_vs_path%\vcvars%arch%.bat" && (
echo: & echo:
exit /b 0 exit /b 0
) || ( ) || (
1>&2 echo [X] Visual Studio script "vcvars%arch%.bat" failed 1>&2 echo [X] Visual Studio script "vcvars%arch%.bat" failed
echo: & echo:
exit /b 1 exit /b 1
) )
) )