This commit is contained in:
rankun 2020-02-20 15:33:51 +08:00
commit cf1c87a881
3 changed files with 45 additions and 20 deletions

View file

@ -39,6 +39,12 @@ jobs:
targetName: QtScrcpy.exe targetName: QtScrcpy.exe
# 步骤 # 步骤
steps: steps:
- name: cacheQt
id: WindowsCacheQt
uses: actions/cache@v1
with:
path: ../Qt/${{matrix.qt_ver}}/${{matrix.qt_arch_install}}
key: ${{ runner.os }}-Qt/${{matrix.qt_ver}}/${{matrix.qt_arch}}
- name: setupQt - name: setupQt
if: steps.WindowsCacheQt.outputs.cache-hit == 'true' if: steps.WindowsCacheQt.outputs.cache-hit == 'true'
shell: pwsh shell: pwsh
@ -74,6 +80,7 @@ jobs:
ENV_BUILD_DIR: '../build-win' ENV_BUILD_DIR: '../build-win'
run: | run: |
call "ci\win\build_for_win.bat" release %vc_arch% call "ci\win\build_for_win.bat" release %vc_arch%
call "ci\win\publish_for_win.bat" %vc_arch%
# tag 打包 # tag 打包
- name: package - name: package
if: startsWith(github.event.ref, 'refs/tags/') if: startsWith(github.event.ref, 'refs/tags/')

View file

@ -1,9 +1,18 @@
@echo off @echo off
:: 从环境变量获取必要参数 :: 从环境变量获取必要参数
:: 例如 C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat
set vcvarsall="%ENV_VCVARSALL%" set vcvarsall="%ENV_VCVARSALL%"
:: 例如 d:\a\QtScrcpy\Qt\5.12.7
set qt_msvc_path="%ENV_QT_MSVC%" set qt_msvc_path="%ENV_QT_MSVC%"
:: 例如 ../build-win
set build_path_name="%ENV_BUILD_DIR%" set build_path_name="%ENV_BUILD_DIR%"
echo=
echo=
echo ---------------------------------------------------------------
echo check ENV
echo ---------------------------------------------------------------
echo ENV_VCVARSALL %ENV_VCVARSALL% echo ENV_VCVARSALL %ENV_VCVARSALL%
echo ENV_QT_MSVC %ENV_QT_MSVC% echo ENV_QT_MSVC %ENV_QT_MSVC%
echo ENV_BUILD_DIR %ENV_BUILD_DIR% echo ENV_BUILD_DIR %ENV_BUILD_DIR%

View file

@ -1,13 +1,23 @@
@echo off @echo off
set qt_msvc_path="D:\Qt\Qt5.12.4\5.12.4\" :: 从环境变量获取必要参数
:: 例如 d:\a\QtScrcpy\Qt\5.12.7
set qt_msvc_path="%ENV_QT_MSVC%"
:: 获取脚本绝对路径 echo=
echo=
echo ---------------------------------------------------------------
echo check ENV
echo ---------------------------------------------------------------
echo ENV_QT_MSVC %ENV_QT_MSVC%
:: 获取脚本绝对路径
set script_path=%~dp0 set script_path=%~dp0
:: 进入脚本所在目录,因为这会影响脚本中执行的程序的工作目录 :: 进入脚本所在目录,因为这会影响脚本中执行的程序的工作目录
set old_cd=%cd% set old_cd=%cd%
cd /d %~dp0 cd /d %~dp0
:: 启动参数声明 :: 启动参数声明
set cpu_mode=x86 set cpu_mode=x86
if /i "%1"=="x86" ( if /i "%1"=="x86" (
set cpu_mode=x86 set cpu_mode=x86
@ -16,21 +26,20 @@ if /i "%1"=="x64" (
set cpu_mode=x64 set cpu_mode=x64
) )
:: 环境变量设置 :: 环境变量设置
set adb_path=%script_path%..\..\third_party\adb\win\*.*
set adb_path=%script_path%third_party\adb\win\*.* set jar_path=%script_path%..\..\third_party\scrcpy-server
set jar_path=%script_path%third_party\scrcpy-server set keymap_path=%script_path%..\..\keymap
set keymap_path=%script_path%keymap set config_path=%script_path%..\..\config
set config_path=%script_path%config
if /i %cpu_mode% == x86 ( if /i %cpu_mode% == x86 (
set publish_path=%script_path%QtScrcpy-win32\ set publish_path=%script_path%..\build\QtScrcpy-win32\
set release_path=%script_path%output\win\x86\release set release_path=%script_path%..\..\output\win\x86\release
set qt_msvc_path=%qt_msvc_path%msvc2017\bin set qt_msvc_path=%qt_msvc_path%\msvc2017\bin
) else ( ) else (
set publish_path=%script_path%QtScrcpy-win64\ set publish_path=%script_path%QtScrcpy-win64\
set release_path=%script_path%output\win\x64\release set release_path=%script_path%..\..\output\win\x64\release
set qt_msvc_path=%qt_msvc_path%msvc2017_64\bin set qt_msvc_path=%qt_msvc_path%\msvc2017_64\bin
) )
set PATH=%qt_msvc_path%;%PATH% set PATH=%qt_msvc_path%;%PATH%
@ -38,21 +47,21 @@ if exist %publish_path% (
rmdir /s/q %publish_path% rmdir /s/q %publish_path%
) )
:: 复制要发布的包 :: 复制要发布的包
xcopy %release_path% %publish_path% /E /Y xcopy %release_path% %publish_path% /E /Y
xcopy %adb_path% %publish_path% /Y xcopy %adb_path% %publish_path% /Y
xcopy %jar_path% %publish_path% /Y xcopy %jar_path% %publish_path% /Y
xcopy %keymap_path% %publish_path%keymap\ /E /Y xcopy %keymap_path% %publish_path%keymap\ /E /Y
xcopy %config_path% %publish_path%config\ /E /Y xcopy %config_path% %publish_path%config\ /E /Y
:: 添加qt依赖包 :: 添加qt依赖包
windeployqt %publish_path%\QtScrcpy.exe windeployqt %publish_path%\QtScrcpy.exe
:: 删除多余qt依赖包 :: 删除多余qt依赖包
rmdir /s/q %publish_path%\iconengines rmdir /s/q %publish_path%\iconengines
rmdir /s/q %publish_path%\translations rmdir /s/q %publish_path%\translations
:: 截图功能需要qjpeg.dll :: 截图功能需要qjpeg.dll
del %publish_path%\imageformats\qgif.dll del %publish_path%\imageformats\qgif.dll
del %publish_path%\imageformats\qicns.dll del %publish_path%\imageformats\qicns.dll
del %publish_path%\imageformats\qico.dll del %publish_path%\imageformats\qico.dll
@ -72,7 +81,7 @@ if /i %cpu_mode% == x86 (
echo= echo=
echo= echo=
echo --------------------------------------------------------------- echo ---------------------------------------------------------------
echo 完成! echo 完成!
echo --------------------------------------------------------------- echo ---------------------------------------------------------------
:return :return