From ed0cfc80c2a2e55a9e85fa1d87a846aa15cf06fd Mon Sep 17 00:00:00 2001 From: zhaodengke Date: Fri, 8 Nov 2024 17:47:09 +0800 Subject: [PATCH] Windows: build bat --- .gitignore | 5 +- Q3E/src/main/jni/doom3/neo/.gitignore | 4 +- build_win_x64_doom3_quak4_prey.bat | 47 +++++++++++++++++++ build_win_x86_doom3_quak4_prey.bat | 47 +++++++++++++++++++ cmake_linux_build_doom3_quak4_prey.sh | 12 +++-- cmake_linux_build_doom3bfg.sh | 6 ++- cmake_msvc_build_doom3_quak4_prey.bat | 14 ++++-- .../com/karin/idTech4Amm/lib/KCVarSystem.java | 44 +++++++++++++++-- .../res/xml/launcher_settings_preference.xml | 1 + 9 files changed, 165 insertions(+), 15 deletions(-) create mode 100644 build_win_x64_doom3_quak4_prey.bat create mode 100644 build_win_x86_doom3_quak4_prey.bat diff --git a/.gitignore b/.gitignore index 61e61a557..b54f6abd0 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,7 @@ cmake_install.cmake CMakeCache.txt *.sln x64 -x86 \ No newline at end of file +x86 +build +Release +Debug diff --git a/Q3E/src/main/jni/doom3/neo/.gitignore b/Q3E/src/main/jni/doom3/neo/.gitignore index 4304bf939..5dc267193 100644 --- a/Q3E/src/main/jni/doom3/neo/.gitignore +++ b/Q3E/src/main/jni/doom3/neo/.gitignore @@ -4,4 +4,6 @@ cmake-* *.dir *.vcxproj* cmake_install.cmake -Release \ No newline at end of file +build +Release +Debug diff --git a/build_win_x64_doom3_quak4_prey.bat b/build_win_x64_doom3_quak4_prey.bat new file mode 100644 index 000000000..e78e4d7b3 --- /dev/null +++ b/build_win_x64_doom3_quak4_prey.bat @@ -0,0 +1,47 @@ +@echo off + +rem MSBuild with MSVC on Windows +rem Using vcpkg as package manager +rem vcpkg install SDL2 curl OpenAL-soft zlib + +rem Replace your `vcpkg` path +set VCPKG_PATH=D:\project\c\vcpkg + +rem Setup build arch: x64 | x86 +set BUILD_ARCH=x64 + +set VCPKG_CMAKE_TOOLCHAIN=%VCPKG_PATH%\scripts\buildsystems\vcpkg.cmake +set DIRECTXSDK_INCLUDE_PATH="%VCPKG_PATH%/packages/directxsdk_%BUILD_ARCH%-windows/include/directxsdk" + +rem Setup build type: Release | Debug +set BUILD_TYPE=Release + +set PROJECT_PATH=Q3E\src\main\jni\doom3\neo + +set WORK_DIR=build\win_%BUILD_ARCH% + +echo Configure and generate MSVC project ...... +if %BUILD_ARCH% == x86 ( + echo Platform: x86 + cmake -B %WORK_DIR% "-A Win32" -DCMAKE_TOOLCHAIN_FILE=%VCPKG_CMAKE_TOOLCHAIN% -DDIRECTXSDK_INCLUDE_PATH=%DIRECTXSDK_INCLUDE_PATH% CMakeLists.txt + rem -G "Visual Studio 17 2022" +) else ( + echo Platform: x86-64 + cmake -B %WORK_DIR% "-A x64" -DCMAKE_TOOLCHAIN_FILE=%VCPKG_CMAKE_TOOLCHAIN% CMakeLists.txt + rem -DBUILD_D3_MOD=OFF -DBUILD_Q4=OFF -DBUILD_PREY=OFF -DBUILD_Q4_MOD=OFF +) + +echo Build %BUILD_TYPE% ...... +cmake --build %WORK_DIR% --config "%BUILD_TYPE%" + +rem clean: cmake --build . --config "%BUILD_TYPE%" --target clean + +set TARGET_PATH=%cd%\%WORK_DIR%\%PROJECT_PATH%\%BUILD_TYPE% + +echo Copy OpenAL32.dll...... +xcopy /Y/Q %VCPKG_PATH%\packages\openal-soft_%BUILD_ARCH%-windows\bin\OpenAL32.dll %TARGET_PATH%\ + +echo Open target directory: %TARGET_PATH% ...... +start "" %TARGET_PATH% + +pause diff --git a/build_win_x86_doom3_quak4_prey.bat b/build_win_x86_doom3_quak4_prey.bat new file mode 100644 index 000000000..de66493c7 --- /dev/null +++ b/build_win_x86_doom3_quak4_prey.bat @@ -0,0 +1,47 @@ +@echo off + +rem MSBuild with MSVC on Windows +rem Using vcpkg as package manager +rem vcpkg install SDL2 curl OpenAL-soft zlib + +rem Replace your `vcpkg` path +set VCPKG_PATH=D:\project\c\vcpkg + +rem Setup build arch: x64 | x86 +set BUILD_ARCH=x86 + +set VCPKG_CMAKE_TOOLCHAIN=%VCPKG_PATH%\scripts\buildsystems\vcpkg.cmake +set DIRECTXSDK_INCLUDE_PATH="%VCPKG_PATH%/packages/directxsdk_%BUILD_ARCH%-windows/include/directxsdk" + +rem Setup build type: Release | Debug +set BUILD_TYPE=Release + +set PROJECT_PATH=Q3E\src\main\jni\doom3\neo + +set WORK_DIR=build\win_%BUILD_ARCH% + +echo Configure and generate MSVC project ...... +if %BUILD_ARCH% == x86 ( + echo Platform: x86 + cmake -B %WORK_DIR% "-A Win32" -DCMAKE_TOOLCHAIN_FILE=%VCPKG_CMAKE_TOOLCHAIN% -DDIRECTXSDK_INCLUDE_PATH=%DIRECTXSDK_INCLUDE_PATH% CMakeLists.txt + rem -G "Visual Studio 17 2022" +) else ( + echo Platform: x86-64 + cmake -B %WORK_DIR% "-A x64" -DCMAKE_TOOLCHAIN_FILE=%VCPKG_CMAKE_TOOLCHAIN% CMakeLists.txt + rem -DBUILD_D3_MOD=OFF -DBUILD_Q4=OFF -DBUILD_PREY=OFF -DBUILD_Q4_MOD=OFF +) + +echo Build %BUILD_TYPE% ...... +cmake --build %WORK_DIR% --config "%BUILD_TYPE%" + +rem clean: cmake --build . --config "%BUILD_TYPE%" --target clean + +set TARGET_PATH=%cd%\%WORK_DIR%\%PROJECT_PATH%\%BUILD_TYPE% + +echo Copy OpenAL32.dll...... +xcopy /Y/Q %VCPKG_PATH%\packages\openal-soft_%BUILD_ARCH%-windows\bin\OpenAL32.dll %TARGET_PATH%\ + +echo Open target directory: %TARGET_PATH% ...... +start "" %TARGET_PATH% + +pause diff --git a/cmake_linux_build_doom3_quak4_prey.sh b/cmake_linux_build_doom3_quak4_prey.sh index 467adf5c8..6ad68dcb0 100644 --- a/cmake_linux_build_doom3_quak4_prey.sh +++ b/cmake_linux_build_doom3_quak4_prey.sh @@ -1,21 +1,25 @@ #!/bin/sh # need install tools: cmake, gcc/g++ | clang/clang++, make -# need install libraries: SDL2, curl, OpenAL-soft, zlib, ALSA +# need install libraries: SDL2, OpenAL-soft, zlib, ALSA # curl # Setup build type: Release | Debug BUILD_TYPE=Release +PROJECT_PATH=Q3E/src/main/jni/doom3/neo + +WORK_DIR=build + echo "Configure and generate GNU makefile ......"; -cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} CMakeLists.txt; +cmake -B ${WORK_DIR} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} CMakeLists.txt; # -DBUILD_D3_MOD=OFF -DBUILD_Q4=OFF -DBUILD_PREY=OFF -DBUILD_Q4_MOD=OFF echo "Build ${BUILD_TYPE} ......"; -make; +cmake --build ${WORK_DIR} --config ${BUILD_TYPE} # clean: make clean; -TARGET_PATH="`pwd`/Q3E/src/main/jni/doom3/neo"; +TARGET_PATH="`pwd`/${WORK_DIR}/${PROJECT_PATH}"; echo "Target directory: ${TARGET_PATH} ......" echo "Done"; diff --git a/cmake_linux_build_doom3bfg.sh b/cmake_linux_build_doom3bfg.sh index 8f2a977a8..545962cc0 100755 --- a/cmake_linux_build_doom3bfg.sh +++ b/cmake_linux_build_doom3bfg.sh @@ -8,13 +8,15 @@ BUILD_TYPE=Release TARGET_PATH="`pwd`/Q3E/src/main/jni/doom3bfg/neo"; +WORK_DIR=build + cd ${TARGET_PATH}; echo "Configure and generate GNU makefile ......"; -cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_CXX_FLAGS="-Werror=nonnull" CMakeLists.txt; +cmake -B build -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_CXX_FLAGS="-Werror=nonnull" CMakeLists.txt; echo "Build ${BUILD_TYPE} ......"; -make; +cmake --build ${WORK_DIR} --config ${BUILD_TYPE} # clean: make clean; diff --git a/cmake_msvc_build_doom3_quak4_prey.bat b/cmake_msvc_build_doom3_quak4_prey.bat index db1da5139..e78e4d7b3 100644 --- a/cmake_msvc_build_doom3_quak4_prey.bat +++ b/cmake_msvc_build_doom3_quak4_prey.bat @@ -16,21 +16,27 @@ set DIRECTXSDK_INCLUDE_PATH="%VCPKG_PATH%/packages/directxsdk_%BUILD_ARCH%-windo rem Setup build type: Release | Debug set BUILD_TYPE=Release +set PROJECT_PATH=Q3E\src\main\jni\doom3\neo + +set WORK_DIR=build\win_%BUILD_ARCH% + echo Configure and generate MSVC project ...... if %BUILD_ARCH% == x86 ( echo Platform: x86 - cmake -G "Visual Studio 17 2022" "-A Win32" -DCMAKE_TOOLCHAIN_FILE=%VCPKG_CMAKE_TOOLCHAIN% -DDIRECTXSDK_INCLUDE_PATH=%DIRECTXSDK_INCLUDE_PATH% CMakeLists.txt + cmake -B %WORK_DIR% "-A Win32" -DCMAKE_TOOLCHAIN_FILE=%VCPKG_CMAKE_TOOLCHAIN% -DDIRECTXSDK_INCLUDE_PATH=%DIRECTXSDK_INCLUDE_PATH% CMakeLists.txt + rem -G "Visual Studio 17 2022" ) else ( echo Platform: x86-64 - cmake -DCMAKE_TOOLCHAIN_FILE=%VCPKG_CMAKE_TOOLCHAIN% CMakeLists.txt + cmake -B %WORK_DIR% "-A x64" -DCMAKE_TOOLCHAIN_FILE=%VCPKG_CMAKE_TOOLCHAIN% CMakeLists.txt + rem -DBUILD_D3_MOD=OFF -DBUILD_Q4=OFF -DBUILD_PREY=OFF -DBUILD_Q4_MOD=OFF ) echo Build %BUILD_TYPE% ...... -cmake --build . --config "%BUILD_TYPE%" +cmake --build %WORK_DIR% --config "%BUILD_TYPE%" rem clean: cmake --build . --config "%BUILD_TYPE%" --target clean -set TARGET_PATH=%cd%\Q3E\src\main\jni\doom3\neo\%BUILD_TYPE% +set TARGET_PATH=%cd%\%WORK_DIR%\%PROJECT_PATH%\%BUILD_TYPE% echo Copy OpenAL32.dll...... xcopy /Y/Q %VCPKG_PATH%\packages\openal-soft_%BUILD_ARCH%-windows\bin\OpenAL32.dll %TARGET_PATH%\ diff --git a/idTech4Amm/src/main/java/com/karin/idTech4Amm/lib/KCVarSystem.java b/idTech4Amm/src/main/java/com/karin/idTech4Amm/lib/KCVarSystem.java index 117d5e103..cb49dfedf 100644 --- a/idTech4Amm/src/main/java/com/karin/idTech4Amm/lib/KCVarSystem.java +++ b/idTech4Amm/src/main/java/com/karin/idTech4Amm/lib/KCVarSystem.java @@ -158,9 +158,45 @@ public static Map CVars() KCVar.Group REALRTCW_CVARS = new KCVar.Group("RealRTCW", true) .AddCVar( - KCVar.CreateCVar("harm_sv_cheats", "bool", "0", "Disable change `sv_cheats` when load map and disconnect for allow cheats", KCVar.FLAG_INIT + KCVar.CreateCVar("harm_sv_cheats", "bool", "0", "Disable change `sv_cheats` when load map and disconnect for allow cheats", KCVar.FLAG_INIT | KCVar.FLAG_LAUNCHER ), - KCVar.CreateCVar("harm_r_stencilShadowPersonal", "bool", "1", "Render personal stencil shadow when `cg_shadows` = 2", 0 + KCVar.CreateCVar("harm_r_stencilShadowPersonal", "bool", "1", "Render personal stencil shadow when `cg_shadows` = 2", KCVar.FLAG_LAUNCHER + ), + KCVar.CreateCVar("harm_r_stencilShadowOp", "integer", "0", "Stencil testing operation", 0, + "0", "Automatic(Personal shadow using Z-Fail, other shadow using Z-Pass)", + "1", "Z-Pass", + "2", "Z-Fail" + ), + KCVar.CreateCVar("harm_r_stencilShadowMaxAngle", "integer", "-1", "Limit stencil shadow of light direction and negative-Z-axis max angle(-1=not limit)", 0 + ), + KCVar.CreateCVar("harm_r_stencilShadowModel", "integer", "3", "Render stencil shadow model type mask(mask bit are 1 2 4 8 16, 0=all models; 3=all animation model)", KCVar.FLAG_POSITIVE + ), + KCVar.CreateCVar("harm_r_stencilShadowCap", "bool", "1", "Render stencil shadow volume caps(0=don't render caps, personal shadow is always render)", 0 + ), + KCVar.CreateCVar("harm_r_stencilShadowInfinite", "float", "0", "Stencil shadow volume far is infinite(absolute value as volume's length; 0=512. negative value is infinite, personal shadow is always infinite)", 0 + ), + KCVar.CreateCVar("harm_r_stencilShadowMask", "bool", "0", "Render stencil shadow mask(0=render mask after all shadows; 1=render mask every shadow volume)", 0 + ) + ); + + KCVar.Group ETW_CVARS = new KCVar.Group("ETW", true) + .AddCVar( + KCVar.CreateCVar("harm_r_stencilShadowPersonal", "bool", "1", "Render personal stencil shadow when `cg_shadows` = 2", KCVar.FLAG_LAUNCHER + ), + KCVar.CreateCVar("harm_r_stencilShadowOp", "integer", "0", "Stencil testing operation", 0, + "0", "Automatic(Personal shadow using Z-Fail, other shadow using Z-Pass)", + "1", "Z-Pass", + "2", "Z-Fail" + ), + KCVar.CreateCVar("harm_r_stencilShadowMaxAngle", "integer", "-1", "Limit stencil shadow of light direction and negative-Z-axis max angle(-1=not limit)", 0 + ), + KCVar.CreateCVar("harm_r_stencilShadowModel", "integer", "3", "Render stencil shadow model type mask(mask bit are 1 2 4 8, 0=all models; 3=all animation model)", KCVar.FLAG_POSITIVE + ), + KCVar.CreateCVar("harm_r_stencilShadowCap", "bool", "1", "Render stencil shadow volume caps(0=don't render caps, personal shadow is always render)", 0 + ), + KCVar.CreateCVar("harm_r_stencilShadowInfinite", "float", "0", "Stencil shadow volume far is infinite(absolute value as volume's length; 0=512. negative value is infinite, personal shadow is always infinite)", 0 + ), + KCVar.CreateCVar("harm_r_stencilShadowMask", "bool", "0", "Render stencil shadow mask(0=render mask after all shadows; 1=render mask every shadow volume)", 0 ) ); @@ -172,6 +208,7 @@ public static Map CVars() _cvars.put("preybase", PREY_CVARS); _cvars.put("DOOM3BFG", DOOM3BFG_CVARS); _cvars.put("RealRTCW", REALRTCW_CVARS); + _cvars.put("ETW", REALRTCW_CVARS); return _cvars; } @@ -198,7 +235,8 @@ else if(Q3EUtils.q3ei.isQ4) else if(Q3EUtils.q3ei.isD3BFG) res.add(_cvars.get("DOOM3BFG")); else if(Q3EUtils.q3ei.isDOOM) ; - else if(Q3EUtils.q3ei.isETW) ; + else if(Q3EUtils.q3ei.isETW) + res.add(_cvars.get("ETW")); else if(Q3EUtils.q3ei.isRealRTCW) res.add(_cvars.get("RealRTCW")); else diff --git a/idTech4Amm/src/main/res/xml/launcher_settings_preference.xml b/idTech4Amm/src/main/res/xml/launcher_settings_preference.xml index 9603f178f..a252e2852 100644 --- a/idTech4Amm/src/main/res/xml/launcher_settings_preference.xml +++ b/idTech4Amm/src/main/res/xml/launcher_settings_preference.xml @@ -57,6 +57,7 @@