This commit is contained in:
恍兮惚兮 2024-04-26 19:06:02 +08:00
parent 49b586f62e
commit 0412a71fdf
14 changed files with 179 additions and 74 deletions

View File

@ -8,8 +8,6 @@ on:
required: true
type: string
env:
QT_VERSION: 5.15.2
jobs:
build_xp:
runs-on: windows-2019
@ -26,15 +24,10 @@ jobs:
python-version: '3.11'
architecture: x64
- name: Run build script 32xp
run: python build.py 32xp
run: python build.py xp
- name: Pack
run: python build.py pack_xp
# - name: Upload plugin32_xp artifact
# uses: actions/upload-artifact@v4
# with:
# name: plugin32_xp
# path: builds/plugin32_xp.zip
- name: Upload English xp artifact
uses: actions/upload-artifact@v4
with:
@ -46,8 +39,17 @@ jobs:
name: Release_Chinese_xp.zip
path: builds/Release_Chinese_xp.zip
build:
build_plugin:
runs-on: windows-latest
strategy:
matrix:
include:
- cmd: plg32
qtarch: win32_msvc2019
target: plugin32.zip
- cmd: plg64
qtarch: win64_msvc2019_64
target: plugin64.zip
steps:
- name: Checkout code
uses: actions/checkout@v4
@ -56,54 +58,64 @@ jobs:
with:
sdk-version: 22621
- name: Install Qt32
uses: jurplel/install-qt-action@v3.3.0
with:
version: ${{ env.QT_VERSION }}
host: windows
target: desktop
arch: win32_msvc2019
dir: ${{ runner.temp }}
setup-python: true
- name: Run build script 32
run: python build.py 32
- name: Install Qt
uses: jurplel/install-qt-action@v3.3.0
with:
version: ${{ env.QT_VERSION }}
version: 5.15.2
host: windows
target: desktop
arch: win64_msvc2019_64
arch: ${{ matrix.qtarch }}
dir: ${{ runner.temp }}
setup-python: true
- name: Install vcltl
run: python build.py 0
- name: Run build script
run: python build.py 64
run: python build.py ${{ matrix.cmd }}
- name: Pack
run: python build.py pack
- name: Upload plugin32 artifact
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: plugin32.zip
path: builds/plugin32.zip
- name: Upload plugin64 artifact
name: ${{ matrix.target }}
path: builds/${{ matrix.target }}
build_everylang:
runs-on: windows-latest
strategy:
matrix:
include:
- lang: en
target: Release_English.zip
- lang: zh
target: Release_Chinese.zip
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Windows 10 SDK
uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
with:
sdk-version: 22621
- name: Install Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
architecture: x64
- name: Install vcltl
run: python build.py 0
- name: Run build script
run: python build.py ${{ matrix.lang }}
- name: Pack
run: python build.py pack
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: plugin64.zip
path: builds/plugin64.zip
- name: Upload English artifact
uses: actions/upload-artifact@v4
with:
name: Release_English.zip
path: builds/Release_English.zip
- name: Upload Chinese artifact
uses: actions/upload-artifact@v4
with:
name: Release_Chinese.zip
path: builds/Release_Chinese.zip
name: ${{ matrix.target }}
path: builds/${{ matrix.target }}
release:
needs: [build, build_xp]
needs: [build_xp, build_plugin,build_everylang]
runs-on: windows-latest
steps:
- name: Checkout code

View File

@ -58,6 +58,8 @@ set(VERSION_MINOR 1)
set(VERSION_PATCH 2)
set(VERSION_REVISION 0)
if(NOT DEFINED PLUGIN)
add_subdirectory(include)
add_subdirectory(LunaHook)
endif()
add_subdirectory(LunaHost)

View File

@ -1,4 +1,5 @@
if(NOT DEFINED PLUGIN)
generate_product_version(
versioninfohost
NAME "LunaHost"
@ -28,4 +29,5 @@ set_target_properties(LunaHostCLI PROPERTIES OUTPUT_NAME "LunaHostCLI${bitappend
set_target_properties(LunaHostDll PROPERTIES OUTPUT_NAME "LunaHost${bitappendix}")
target_link_libraries(LunaHostCLI pch host ${YY_Thunks_for_WinXP})
target_link_libraries(LunaHostDll pch host ${YY_Thunks_for_WinXP})
endif()
add_subdirectory(GUI)

View File

@ -1,5 +1,8 @@
if(NOT DEFINED PLUGIN)
add_executable(LunaHost WIN32 confighelper.cpp controls.cpp main.cpp processlistwindow.cpp LunaHost.cpp window.cpp luna.rc pluginmanager.cpp Plugin/extensionimpl.cpp Plugin/copyclipboard.cpp QtLoader_inline.cpp app.manifest ${versioninfohost})
target_precompile_headers(LunaHost REUSE_FROM pch)
set_target_properties(LunaHost PROPERTIES OUTPUT_NAME "LunaHost${bitappendix}")
target_link_libraries(LunaHost comctl32 winhttp version pch host ${YY_Thunks_for_WinXP})
endif()
add_subdirectory(Plugin)

View File

@ -11,14 +11,11 @@ if(Qt5_DIR)
set_target_properties(QtLoader PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/plugin${bitappendix}")
endif()
endif()
if(NOT DEFINED WINXP)
if(LANGUAGE STREQUAL "English")
if(DEFINED PLUGIN)
include(QtUtils.cmake)
#msvc_registry_search()
#if(Qt5_DIR)
find_qt5(Core Widgets WebSockets)
add_subdirectory(extensions)
#endif()
endif()
endif()

View File

@ -3,21 +3,9 @@ import subprocess
rootDir = os.path.dirname(__file__)
vcltlFile = "https://github.com/Chuyu-Team/VC-LTL5/releases/download/v5.0.9/VC-LTL-5.0.9-Binary.7z"
vcltlFileName = "VC-LTL-5.0.9-Binary.7z"
availableTargets = ["32xp", "32", "64"]
def installVCLTL():
os.chdir(rootDir)
if os.path.exists("temp"):
return # already installed
os.makedirs(rootDir + "\\temp", exist_ok=True)
subprocess.run(f"curl -Lo temp\\{vcltlFileName} {vcltlFile}")
subprocess.run(f"7z x temp\\{vcltlFileName} -otemp\\VC-LTL5")
subprocess.run("cmd /c temp\\VC-LTL5\\Install.cmd")
target = sys.argv[1]
os.chdir(os.path.join(rootDir, "scripts"))
if target in availableTargets:
@ -29,3 +17,39 @@ else:
os.system(f"python pack.py pack")
else:
os.system(f"python pack.py pack_xp")
if sys.argv[1]=='0':
vcltlFile = "https://github.com/Chuyu-Team/VC-LTL5/releases/download/v5.0.9/VC-LTL-5.0.9-Binary.7z"
vcltlFileName = "VC-LTL-5.0.9-Binary.7z"
def installVCLTL():
os.chdir(rootDir)
if os.path.exists("temp"):
return # already installed
os.makedirs(rootDir + "\\temp", exist_ok=True)
subprocess.run(f"curl -Lo temp\\{vcltlFileName} {vcltlFile}")
subprocess.run(f"7z x temp\\{vcltlFileName} -otemp\\VC-LTL5")
subprocess.run("cmd /c temp\\VC-LTL5\\Install.cmd")
installVCLTL()
elif sys.argv[1]=='plg32':
os.chdir(os.path.join(rootDir, "scripts"))
os.system(f"cmd /c buildplugin32.bat")
elif sys.argv[1]=='plg64':
os.chdir(os.path.join(rootDir, "scripts"))
os.system(f"cmd /c buildplugin64.bat")
elif sys.argv[1]=='pack':
os.chdir(os.path.join(rootDir, "scripts"))
os.system(f"python pack.py pack")
elif sys.argv[1]=='en':
os.chdir(os.path.join(rootDir, "scripts"))
os.system(f"cmd /c builden.bat")
elif sys.argv[1]=='zh':
os.chdir(os.path.join(rootDir, "scripts"))
os.system(f"cmd /c buildzh.bat")
elif sys.argv[1]=='xp':
os.chdir(os.path.join(rootDir, "scripts"))
os.system(f"cmd /c build32xp.bat")

View File

@ -1,5 +0,0 @@
cmake ../CMakeLists.txt -G "Visual Studio 17 2022" -A win32 -T host=x86 -B ../build/x86
cmake --build ../build/x86 --config Release --target ALL_BUILD -j 14
cmake -DLANGUAGE=Chinese ../CMakeLists.txt -G "Visual Studio 17 2022" -A win32 -T host=x86 -B ../build/x86_zh
cmake --build ../build/x86_zh --config Release --target ALL_BUILD -j 14

View File

@ -0,0 +1,67 @@
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

View File

@ -1,5 +0,0 @@
cmake ../CMakeLists.txt -G "Visual Studio 17 2022" -A x64 -T host=x64 -B ../build/x64
cmake --build ../build/x64 --config Release --target ALL_BUILD -j 14
cmake -DLANGUAGE=Chinese ../CMakeLists.txt -G "Visual Studio 17 2022" -A x64 -T host=x64 -B ../build/x64_zh
cmake --build ../build/x64_zh --config Release --target ALL_BUILD -j 14

5
scripts/builden.bat Normal file
View File

@ -0,0 +1,5 @@
cmake ../CMakeLists.txt -G "Visual Studio 17 2022" -A win32 -T host=x86 -B ../build/x86
cmake --build ../build/x86 --config Release --target ALL_BUILD -j 14
cmake ../CMakeLists.txt -G "Visual Studio 17 2022" -A x64 -T host=x64 -B ../build/x64
cmake --build ../build/x64 --config Release --target ALL_BUILD -j 14

View File

@ -0,0 +1,2 @@
cmake -DPLUGIN=1 ../CMakeLists.txt -G "Visual Studio 17 2022" -A win32 -T host=x86 -B ../build/plugin32
cmake --build ../build/plugin32 --config Release --target ALL_BUILD -j 14

View File

@ -0,0 +1,2 @@
cmake -DPLUGIN=1 ../CMakeLists.txt -G "Visual Studio 17 2022" -A x64 -T host=x64 -B ../build/plugin64
cmake --build ../build/plugin64 --config Release --target ALL_BUILD -j 14

5
scripts/buildzh.bat Normal file
View File

@ -0,0 +1,5 @@
cmake -DLANGUAGE=Chinese ../CMakeLists.txt -G "Visual Studio 17 2022" -A win32 -T host=x86 -B ../build/x86_zh
cmake --build ../build/x86_zh --config Release --target ALL_BUILD -j 14
cmake -DLANGUAGE=Chinese ../CMakeLists.txt -G "Visual Studio 17 2022" -A x64 -T host=x64 -B ../build/x64_zh
cmake --build ../build/x64_zh --config Release --target ALL_BUILD -j 14

View File

@ -1,12 +1,6 @@
import os, shutil, sys
isXp = ""
if sys.argv[1] == "pack_xp":
isXp = "_xp"
else:
pass
for f in os.listdir("../builds"):
if os.path.isdir("../builds/" + f) == False:
continue
@ -32,5 +26,5 @@ for f in os.listdir("../builds"):
]:
os.remove(path)
targetdir = "../builds/" + f
target = "../builds/" + f + isXp + ".zip"
target = "../builds/" + f + ".zip"
os.system(rf'"C:\Program Files\7-Zip\7z.exe" a -m0=LZMA -mx9 {target} {targetdir}')