mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-04-19 19:15:07 +00:00
feat: mac support arm64
This commit is contained in:
parent
ae1523b2a0
commit
f863a91f94
4 changed files with 71 additions and 10 deletions
18
.github/workflows/macos.yml
vendored
18
.github/workflows/macos.yml
vendored
|
@ -21,9 +21,15 @@ jobs:
|
||||||
runs-on: macos-13
|
runs-on: macos-13
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
qt-ver: [5.15.2]
|
qt-ver: [5.15.2, 6.5.3]
|
||||||
qt-arch-install: [clang_64]
|
# 配置qt-ver的额外设置qt-arch-install,build-arch
|
||||||
clang-arch: [x64]
|
include:
|
||||||
|
- qt-ver: 5.15.2
|
||||||
|
qt-arch-install: clang_64
|
||||||
|
build-arch: x64
|
||||||
|
- qt-ver: 6.5.3
|
||||||
|
qt-arch-install: arm64
|
||||||
|
build-arch: [x64, arm64]
|
||||||
env:
|
env:
|
||||||
target-name: QtScrcpy
|
target-name: QtScrcpy
|
||||||
qt-install-path: ${{ github.workspace }}/${{ matrix.qt-ver }}
|
qt-install-path: ${{ github.workspace }}/${{ matrix.qt-ver }}
|
||||||
|
@ -51,7 +57,7 @@ jobs:
|
||||||
ENV_QT_PATH: ${{ env.qt-install-path }}
|
ENV_QT_PATH: ${{ env.qt-install-path }}
|
||||||
run: |
|
run: |
|
||||||
python ci/generate-version.py
|
python ci/generate-version.py
|
||||||
ci/mac/build_for_mac.sh RelWithDebInfo
|
ci/mac/build_for_mac.sh RelWithDebInfo ${{ matrix.build-arch }}
|
||||||
# 获取ref最后一个/后的内容
|
# 获取ref最后一个/后的内容
|
||||||
- name: Get the version
|
- name: Get the version
|
||||||
shell: bash
|
shell: bash
|
||||||
|
@ -63,9 +69,9 @@ jobs:
|
||||||
id: package
|
id: package
|
||||||
env:
|
env:
|
||||||
ENV_QT_PATH: ${{ env.qt-install-path }}
|
ENV_QT_PATH: ${{ env.qt-install-path }}
|
||||||
publish_name: ${{ env.target-name }}-${{ env.plantform-des }}-${{ matrix.clang-arch }}-${{ steps.get-version.outputs.version }}
|
publish_name: ${{ env.target-name }}-${{ env.plantform-des }}-${{ matrix.build-arch }}-Qt${{matrix.qt-ver}}-${{ steps.get-version.outputs.version }}
|
||||||
run: |
|
run: |
|
||||||
ci/mac/publish_for_mac.sh ../build
|
ci/mac/publish_for_mac.sh ../build ${{ matrix.build-arch }}
|
||||||
ci/mac/package_for_mac.sh
|
ci/mac/package_for_mac.sh
|
||||||
mv ci/build/QtScrcpy.app ci/build/${{ env.publish_name }}.app
|
mv ci/build/QtScrcpy.app ci/build/${{ env.publish_name }}.app
|
||||||
mv ci/build/QtScrcpy.dmg ci/build/${{ env.publish_name }}.dmg
|
mv ci/build/QtScrcpy.dmg ci/build/${{ env.publish_name }}.dmg
|
||||||
|
|
|
@ -26,6 +26,19 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
else()
|
else()
|
||||||
set(QC_CPU_ARCH x86)
|
set(QC_CPU_ARCH x86)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# MacOS
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||||
|
# mac default arch arm64
|
||||||
|
if(NOT CMAKE_OSX_ARCHITECTURES)
|
||||||
|
set(CMAKE_OSX_ARCHITECTURES arm64)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (CMAKE_OSX_ARCHITECTURES MATCHES "arm64")
|
||||||
|
set(QC_CPU_ARCH arm64)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
message(STATUS "[${PROJECT_NAME}] CPU_ARCH:${QC_CPU_ARCH}")
|
message(STATUS "[${PROJECT_NAME}] CPU_ARCH:${QC_CPU_ARCH}")
|
||||||
|
|
||||||
# CMake set
|
# CMake set
|
||||||
|
|
|
@ -8,7 +8,6 @@ echo ---------------------------------------------------------------
|
||||||
# 从环境变量获取必要参数
|
# 从环境变量获取必要参数
|
||||||
# 例如 /Users/barry/Qt5.12.5/5.12.5
|
# 例如 /Users/barry/Qt5.12.5/5.12.5
|
||||||
echo ENV_QT_PATH $ENV_QT_PATH
|
echo ENV_QT_PATH $ENV_QT_PATH
|
||||||
qt_cmake_path=$ENV_QT_PATH/clang_64/lib/cmake/Qt5
|
|
||||||
|
|
||||||
# 获取绝对路径,保证其他目录执行此脚本依然正确
|
# 获取绝对路径,保证其他目录执行此脚本依然正确
|
||||||
{
|
{
|
||||||
|
@ -22,6 +21,7 @@ cd $(dirname "$0")
|
||||||
|
|
||||||
# 启动参数声明
|
# 启动参数声明
|
||||||
build_mode=RelWithDebInfo
|
build_mode=RelWithDebInfo
|
||||||
|
cpu_arch=arm64
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo
|
echo
|
||||||
|
@ -36,8 +36,30 @@ if [[ $build_mode != "Release" && $build_mode != "Debug" && $build_mode != "MinS
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
echo ---------------------------------------------------------------
|
||||||
|
echo check cpu arch[x64/arm64]
|
||||||
|
echo ---------------------------------------------------------------
|
||||||
|
|
||||||
|
cpu_arch=$(echo $2)
|
||||||
|
if [[ $cpu_arch != "x64" && $cpu_arch != "arm64" ]]; then
|
||||||
|
echo "error: unkonow cpu mode -- $2"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# 提示
|
# 提示
|
||||||
echo current build mode: $build_mode
|
echo current build mode: $build_mode
|
||||||
|
echo current cpu mode: $cpu_arch
|
||||||
|
|
||||||
|
cmake_arch=x86_64
|
||||||
|
if [ $cpu_arch == "x64" ]; then
|
||||||
|
qt_cmake_path=$ENV_QT_PATH/clang_64/lib/cmake/Qt5
|
||||||
|
cmake_arch=x86_64
|
||||||
|
else
|
||||||
|
qt_cmake_path=$ENV_QT_PATH/macos/lib/cmake/Qt6
|
||||||
|
cmake_arch=arm64
|
||||||
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo
|
echo
|
||||||
|
@ -58,7 +80,7 @@ fi
|
||||||
mkdir $build_path
|
mkdir $build_path
|
||||||
cd $build_path
|
cd $build_path
|
||||||
|
|
||||||
cmake_params="-DCMAKE_PREFIX_PATH=$qt_cmake_path -DCMAKE_BUILD_TYPE=$build_mode -DCMAKE_OSX_ARCHITECTURES=x86_64"
|
cmake_params="-DCMAKE_PREFIX_PATH=$qt_cmake_path -DCMAKE_BUILD_TYPE=$build_mode -DCMAKE_OSX_ARCHITECTURES=$cmake_arch"
|
||||||
cmake $cmake_params ../..
|
cmake $cmake_params ../..
|
||||||
if [ $? -ne 0 ] ;then
|
if [ $? -ne 0 ] ;then
|
||||||
echo "cmake failed"
|
echo "cmake failed"
|
||||||
|
|
|
@ -7,7 +7,6 @@ echo ---------------------------------------------------------------
|
||||||
# 从环境变量获取必要参数
|
# 从环境变量获取必要参数
|
||||||
# 例如 /Users/barry/Qt5.12.5/5.12.5
|
# 例如 /Users/barry/Qt5.12.5/5.12.5
|
||||||
echo ENV_QT_PATH $ENV_QT_PATH
|
echo ENV_QT_PATH $ENV_QT_PATH
|
||||||
qt_clang_path=$ENV_QT_PATH/clang_64
|
|
||||||
|
|
||||||
# 获取绝对路径,保证其他目录执行此脚本依然正确
|
# 获取绝对路径,保证其他目录执行此脚本依然正确
|
||||||
{
|
{
|
||||||
|
@ -21,6 +20,27 @@ cd $(dirname "$0")
|
||||||
|
|
||||||
# 启动参数声明
|
# 启动参数声明
|
||||||
publish_dir=$1
|
publish_dir=$1
|
||||||
|
cpu_arch=$2
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
echo ---------------------------------------------------------------
|
||||||
|
echo check cpu arch[x64/arm64]
|
||||||
|
echo ---------------------------------------------------------------
|
||||||
|
|
||||||
|
if [[ $cpu_arch != "x64" && $cpu_arch != "arm64" ]]; then
|
||||||
|
echo "error: unkonow cpu mode -- $2"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 提示
|
||||||
|
echo current cpu mode: $cpu_arch
|
||||||
|
|
||||||
|
if [ $cpu_arch == "x64" ]; then
|
||||||
|
qt_clang_path=$ENV_QT_PATH/clang_64
|
||||||
|
else
|
||||||
|
qt_clang_path=$ENV_QT_PATH/macos
|
||||||
|
fi
|
||||||
|
|
||||||
# 提示
|
# 提示
|
||||||
echo current publish dir: $publish_dir
|
echo current publish dir: $publish_dir
|
||||||
|
@ -30,7 +50,7 @@ keymap_path=$script_path/../../keymap
|
||||||
# config_path=$script_path/../../config
|
# config_path=$script_path/../../config
|
||||||
|
|
||||||
publish_path=$script_path/$publish_dir
|
publish_path=$script_path/$publish_dir
|
||||||
release_path=$script_path/../../output/x64/RelWithDebInfo
|
release_path=$script_path/../../output/$cpu_arch/RelWithDebInfo
|
||||||
|
|
||||||
export PATH=$qt_clang_path/bin:$PATH
|
export PATH=$qt_clang_path/bin:$PATH
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue