diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0b66d69..f9c74f7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,6 +11,11 @@ on: jobs: build_xp: runs-on: windows-2019 + strategy: + matrix: + include: + - target: Release_English_winxp + - target: Release_Chinese_winxp steps: - name: Checkout code uses: actions/checkout@v4 @@ -23,31 +28,26 @@ jobs: with: python-version: '3.11' architecture: x64 - - - name: Run build script 32xp - run: python build.py xp + + - name: Run build script + run: python build.py ${{ matrix.target }} - name: Pack run: python build.py pack - - name: Upload English xp artifact + + - name: Upload artifact uses: actions/upload-artifact@v4 with: - name: Release_English_xp - path: builds/Release_English_xp.zip - - name: Upload Chinese xp artifact - uses: actions/upload-artifact@v4 - with: - name: Release_Chinese_xp - path: builds/Release_Chinese_xp.zip + name: ${{ matrix.target }} + path: builds/${{ matrix.target }}.zip - name: Release LunaHook uses: softprops/action-gh-release@v2 with: tag_name: ${{ github.event.inputs.create_release }} - files: | - builds/Release_Chinese_xp.zip - builds/Release_English_xp.zip + files: builds/${{ matrix.target }}.zip env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + build_plugin: runs-on: windows-latest strategy: diff --git a/build.py b/build.py index 8f127d1..fd39b01 100644 --- a/build.py +++ b/build.py @@ -32,5 +32,7 @@ else: os.system(f"cmd /c builden.bat") elif sys.argv[1]=='zh': os.system(f"cmd /c buildzh.bat") - elif sys.argv[1]=='xp': - os.system(f"cmd /c build32xp.bat") \ No newline at end of file + elif sys.argv[1]=='Release_English_winxp': + os.system(f"cmd /c buildxpen.bat") + elif sys.argv[1]=='Release_Chinese_winxp': + os.system(f"cmd /c buildxpzh.bat") \ No newline at end of file diff --git a/scripts/build32xp_local.bat b/scripts/build32xp_local.bat index 1151dd1..bed9151 100644 --- a/scripts/build32xp_local.bat +++ b/scripts/build32xp_local.bat @@ -1,67 +1,3 @@ cmake -DWINXP=1 ../CMakeLists.txt -G "Visual Studio 17 2022" -A win32 -T host=x86 -B ../build/x86_xp cmake -DWINXP=1 -DLANGUAGE=Chinese ../CMakeLists.txt -G "Visual Studio 17 2022" -A win32 -T host=x86 -B ../build/x86_zh_xp - -python edit_target.py - -@echo off -setlocal enabledelayedexpansion -goto :main - -:get_host_arch - setlocal - set out_var=%~1 - if defined PROCESSOR_ARCHITEW6432 ( - set "host_arch=%PROCESSOR_ARCHITEW6432%" - ) else ( - set "host_arch=%PROCESSOR_ARCHITECTURE%" - ) - if "%host_arch%" == "AMD64" ( - set result=x64 - ) else if "%host_arch%" == "x86" ( - set result=x86 - ) else ( - echo ERROR: Unsupported host machine architecture. - endlocal - exit /b 1 - ) - endlocal & set %out_var%=%result% - goto :eof - -:find_msvc - setlocal - set out_var=%~1 - rem Find vswhere.exe - set "vswhere=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" - if not exist "%vswhere%" set "vswhere=!ProgramFiles!\Microsoft Visual Studio\Installer\vswhere.exe" - if not exist "%vswhere%" ( - echo ERROR: Failed to find vswhere.exe>&2 - endlocal & exit /b 1 - ) - rem Find VC tools - for /f "usebackq tokens=*" %%i in (`"%vswhere%" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do ( - set vc_dir=%%i - ) - if not exist "%vc_dir%\Common7\Tools\vsdevcmd.bat" ( - echo ERROR: Failed to find MSVC.>&2 - endlocal & exit /b 1 - ) - endlocal & set "%out_var%=%vc_dir%" - goto :eof - -:activate_msvc - where cl.exe > nul 2>&1 && goto :eof || cmd /c exit 0 - call :find_msvc vc_dir || goto :eof - call "%vc_dir%\Common7\Tools\vsdevcmd.bat" -no_logo -arch=%~1 || goto :eof - goto :eof - - -:main - call :get_host_arch host_arch || exit /b - if not defined TARGET_ARCH ( - rem Target architecture is by default the same as the host architecture - set target_arch=%host_arch% - ) - call :activate_msvc "%target_arch%" || goto :eof - msbuild ..\build\x86_xp\LunaHook.sln -p:Configuration=Release - msbuild ..\build\x86_zh_xp\LunaHook.sln -p:Configuration=Release - goto :eof +call dobuildxp.bat \ No newline at end of file diff --git a/scripts/buildxpen.bat b/scripts/buildxpen.bat new file mode 100644 index 0000000..6b3f8d8 --- /dev/null +++ b/scripts/buildxpen.bat @@ -0,0 +1,3 @@ +cmake -DWINXP=1 ../CMakeLists.txt -G "Visual Studio 16 2019" -A win32 -T v141_xp -B ../build/x86_xp +cmake --build ../build/x86_xp --config Release --target ALL_BUILD -j 14 +call dobuildxp.bat \ No newline at end of file diff --git a/scripts/buildxpzh.bat b/scripts/buildxpzh.bat new file mode 100644 index 0000000..d0c46f2 --- /dev/null +++ b/scripts/buildxpzh.bat @@ -0,0 +1,4 @@ + +cmake -DWINXP=1 -DLANGUAGE=Chinese ../CMakeLists.txt -G "Visual Studio 16 2019" -A win32 -T v141_xp -B ../build/x86_zh_xp +cmake --build ../build/x86_zh_xp --config Release --target ALL_BUILD -j 14 +call dobuildxp.bat \ No newline at end of file diff --git a/scripts/build32xp.bat b/scripts/dobuildxp.bat similarity index 84% rename from scripts/build32xp.bat rename to scripts/dobuildxp.bat index 5bedb3f..2e8d46d 100644 --- a/scripts/build32xp.bat +++ b/scripts/dobuildxp.bat @@ -1,8 +1,3 @@ -cmake -DWINXP=1 ../CMakeLists.txt -G "Visual Studio 16 2019" -A win32 -T v141_xp -B ../build/x86_xp -cmake --build ../build/x86_xp --config Release --target ALL_BUILD -j 14 - -cmake -DWINXP=1 -DLANGUAGE=Chinese ../CMakeLists.txt -G "Visual Studio 16 2019" -A win32 -T v141_xp -B ../build/x86_zh_xp -cmake --build ../build/x86_zh_xp --config Release --target ALL_BUILD -j 14 python edit_target.py @echo off