mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-07-18 06:51:29 +00:00
chore: add build script
This commit is contained in:
parent
dcb813fa9a
commit
c6e97295fd
2 changed files with 79 additions and 17 deletions
|
@ -1,6 +1,6 @@
|
||||||
@echo off
|
@echo off
|
||||||
set VsDevCmd="C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\Tools\VsDevCmd.bat"
|
set vcvarsall="C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvarsall.bat"
|
||||||
set qt_msvc_path="D:\Qt\Qt5.12.4\5.12.4\msvc2017\bin"
|
set qt_msvc_path="D:\Qt\Qt5.12.4\5.12.4\"
|
||||||
|
|
||||||
:: 获取脚本绝对路径
|
:: 获取脚本绝对路径
|
||||||
set script_path=%~dp0
|
set script_path=%~dp0
|
||||||
|
@ -10,44 +10,51 @@ cd /d %~dp0
|
||||||
|
|
||||||
:: 启动参数声明
|
:: 启动参数声明
|
||||||
set debug_mode="false"
|
set debug_mode="false"
|
||||||
|
set cpu_mode=x86
|
||||||
|
|
||||||
echo=
|
echo=
|
||||||
echo=
|
echo=
|
||||||
echo ---------------------------------------------------------------
|
echo ---------------------------------------------------------------
|
||||||
echo 检查编译参数[debug/release]
|
echo 检查编译参数[debug/release x86/x64]
|
||||||
echo ---------------------------------------------------------------
|
echo ---------------------------------------------------------------
|
||||||
|
|
||||||
:: 编译参数检查 /i忽略大小写
|
:: 编译参数检查 /i忽略大小写
|
||||||
if /i "%1"=="debug" (
|
if /i "%1"=="debug" (
|
||||||
set debug_mode="true"
|
set debug_mode="true"
|
||||||
goto param_ok
|
|
||||||
)
|
)
|
||||||
if /i "%1"=="release" (
|
if /i "%1"=="release" (
|
||||||
set debug_mode="false"
|
set debug_mode="false"
|
||||||
goto param_ok
|
|
||||||
)
|
)
|
||||||
|
|
||||||
echo "waring: unkonow build mode -- %1, default release"
|
if /i "%2"=="x86" (
|
||||||
set debug_mode="false"
|
set cpu_mode=x86
|
||||||
goto param_ok
|
)
|
||||||
|
if /i "%2"=="x64" (
|
||||||
:param_ok
|
set cpu_mode=x64
|
||||||
|
)
|
||||||
|
|
||||||
:: 提示
|
:: 提示
|
||||||
if /i %debug_mode% == "true" (
|
echo 当前编译模式为debug %debug_mode% %cpu_mode%
|
||||||
echo 当前编译版本为debug版本
|
|
||||||
) else (
|
|
||||||
echo 当前编译版本为release版本
|
|
||||||
)
|
|
||||||
|
|
||||||
:: 环境变量设置
|
:: 环境变量设置
|
||||||
|
if /i %cpu_mode% == x86 (
|
||||||
|
set qt_msvc_path=%qt_msvc_path%msvc2017\bin
|
||||||
|
) else (
|
||||||
|
set qt_msvc_path=%qt_msvc_path%msvc2017_64\bin
|
||||||
|
)
|
||||||
|
|
||||||
set build_path=%script_path%build
|
set build_path=%script_path%build
|
||||||
set PATH=%qt_msvc_path%;%PATH%
|
set PATH=%qt_msvc_path%;%PATH%
|
||||||
|
|
||||||
call %VsDevCmd%
|
:: 注册vc环境
|
||||||
|
if /i %cpu_mode% == x86 (
|
||||||
|
call %vcvarsall% %cpu_mode%
|
||||||
|
) else (
|
||||||
|
call %vcvarsall% %cpu_mode%
|
||||||
|
)
|
||||||
|
|
||||||
if not %errorlevel%==0 (
|
if not %errorlevel%==0 (
|
||||||
echo "VsDevCmd not find"
|
echo "vcvarsall not find"
|
||||||
goto return
|
goto return
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
55
publish_for_win.bat
Normal file
55
publish_for_win.bat
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
@echo off
|
||||||
|
set qt_msvc_path="D:\Qt\Qt5.12.4\5.12.4\msvc2017\bin"
|
||||||
|
|
||||||
|
:: 获取脚本绝对路径
|
||||||
|
set script_path=%~dp0
|
||||||
|
:: 进入脚本所在目录,因为这会影响脚本中执行的程序的工作目录
|
||||||
|
set old_cd=%cd%
|
||||||
|
cd /d %~dp0
|
||||||
|
|
||||||
|
:: 启动参数声明
|
||||||
|
set cpu_mode=x86
|
||||||
|
if /i "%2"=="x86" (
|
||||||
|
set cpu_mode=x86
|
||||||
|
)
|
||||||
|
if /i "%2"=="x64" (
|
||||||
|
set cpu_mode=x64
|
||||||
|
)
|
||||||
|
|
||||||
|
:: 环境变量设置
|
||||||
|
set PATH=%qt_msvc_path%;%PATH%
|
||||||
|
|
||||||
|
set publish_path=%script_path%publish\
|
||||||
|
set adb_path=%script_path%\third_party\adb\win\*.*
|
||||||
|
set jar_path=%script_path%\third_party\scrcpy-server.jar
|
||||||
|
set keymap_path=%script_path%\keymap
|
||||||
|
|
||||||
|
if /i %cpu_mode% == x86 (
|
||||||
|
set release_path=%script_path%output\win\release
|
||||||
|
) else (
|
||||||
|
set release_path=%script_path%output\win-x64\release
|
||||||
|
)
|
||||||
|
|
||||||
|
:: 复制要发布的包
|
||||||
|
xcopy %release_path% %publish_path% /E /Y
|
||||||
|
xcopy %adb_path% %publish_path% /Y
|
||||||
|
xcopy %jar_path% %publish_path% /Y
|
||||||
|
xcopy %keymap_path% %publish_path%keymap\ /E /Y
|
||||||
|
|
||||||
|
:: 添加qt依赖包
|
||||||
|
windeployqt %publish_path%\QtScrcpy.exe
|
||||||
|
|
||||||
|
:: 删除多余qt依赖包
|
||||||
|
rmdir /s/q %publish_path%\iconengines
|
||||||
|
rmdir /s/q %publish_path%\imageformats
|
||||||
|
rmdir /s/q %publish_path%\translations
|
||||||
|
del %publish_path%\vc_redist.x86.exe
|
||||||
|
|
||||||
|
echo=
|
||||||
|
echo=
|
||||||
|
echo ---------------------------------------------------------------
|
||||||
|
echo 完成!
|
||||||
|
echo ---------------------------------------------------------------
|
||||||
|
|
||||||
|
:return
|
||||||
|
cd %old_cd%
|
Loading…
Add table
Add a link
Reference in a new issue