From dc7c240aaa144213f568b6d4e31e89b57afaec21 Mon Sep 17 00:00:00 2001 From: rankun Date: Fri, 18 Sep 2020 17:41:26 +0800 Subject: [PATCH] feat: copy vcruntime myself --- .github/workflows/windows.yml | 2 ++ ci/win/publish_for_win.bat | 23 ++++++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index af60f92..0bcfc81 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -6,11 +6,13 @@ on: - 'QtScrcpy/**' - '!QtScrcpy/res/**' - '.github/workflows/windows.yml' + - 'ci/win**' pull_request: paths: - 'QtScrcpy/**' - '!QtScrcpy/res/**' - '.github/workflows/windows.yml' + - 'ci/win**' jobs: build: name: Build diff --git a/ci/win/publish_for_win.bat b/ci/win/publish_for_win.bat index 50b2636..050f3af 100644 --- a/ci/win/publish_for_win.bat +++ b/ci/win/publish_for_win.bat @@ -9,10 +9,10 @@ echo --------------------------------------------------------------- :: 从环境变量获取必要参数 :: example: D:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvarsall.bat set vcvarsall="%ENV_VCVARSALL%" -:: 设置了VCINSTALLDIR,windeployqt会自动copy vcruntime dll -set VCINSTALLDIR="%ENV_VCINSTALL%" :: 例如 d:\a\QtScrcpy\Qt\5.12.7 set qt_msvc_path="%ENV_QT_PATH%" +:: 设置了VCINSTALLDIR,windeployqt会自动copy vcruntime dll +:: set VCINSTALLDIR="%ENV_VCINSTALL%" echo ENV_VCVARSALL %ENV_VCVARSALL% echo ENV_QT_PATH %ENV_QT_PATH% @@ -57,11 +57,11 @@ if /i %cpu_mode% == x86 ( set PATH=%qt_msvc_path%;%PATH% :: 注册vc环境(注册以后,windeployqt会把vc_redist复制过来(vcruntime安装包)) -:: if /i %cpu_mode% == x86 ( -:: call %vcvarsall% %cpu_mode% -:: ) else ( -:: call %vcvarsall% %cpu_mode% -:: ) +if /i %cpu_mode% == x86 ( + call %vcvarsall% %cpu_mode% +) else ( + call %vcvarsall% %cpu_mode% +) if exist %publish_path% ( rmdir /s/q %publish_path% @@ -92,12 +92,21 @@ del %publish_path%\imageformats\qtiff.dll del %publish_path%\imageformats\qwbmp.dll del %publish_path%\imageformats\qwebp.dll +:: 删除vc_redist,自己copy vcruntime dll if /i %cpu_mode% == x86 ( del %publish_path%\vc_redist.x86.exe ) else ( del %publish_path%\vc_redist.x64.exe ) +:: copy vcruntime dll +cp "C:\Program Files (x86)\Microsoft Visual Studio\Installer\VCRUNTIME140.dll" %publish_path%\VCRUNTIME140.dll +cp "C:\Program Files (x86)\Microsoft Visual Studio\Installer\api-ms-win-crt-runtime-l1-1-0.dll" %publish_path%\api-ms-win-crt-runtime-l1-1-0.dll +cp "C:\Program Files (x86)\Microsoft Visual Studio\Installer\api-ms-win-crt-heap-l1-1-0.dll" %publish_path%\api-ms-win-crt-heap-l1-1-0.dll +cp "C:\Program Files (x86)\Microsoft Visual Studio\Installer\api-ms-win-crt-math-l1-1-0.dll" %publish_path%\api-ms-win-crt-math-l1-1-0.dll +cp "C:\Program Files (x86)\Microsoft Visual Studio\Installer\api-ms-win-crt-stdio-l1-1-0.dll" %publish_path%\api-ms-win-crt-stdio-l1-1-0.dll +cp "C:\Program Files (x86)\Microsoft Visual Studio\Installer\api-ms-win-crt-locale-l1-1-0.dll" %publish_path%\api-ms-win-crt-locale-l1-1-0.dll + echo= echo= echo ---------------------------------------------------------------