Rabbit Remote Control 0.0.32
|
作者:康林 kl222.nosp@m.@126.nosp@m..com
当前版本:v13.0.0 。建议使用 v5.0.2 及以后版本,以前版本对 CMake 支持不够。
参见:编译集成
set INSTALL_DIR=`pwd`/install set VCPKG_ROOT=/data/vcpkg set VCPKG_TARGET_TRIPLET=x64-android set ANDROID_ABI=x86_64 set ANDROID_PLATFORM=android-23 set ANDROID_NATIVE_API_LEVEL=23 set ANDROID_NDK_HOME= set BUILD_TYPE=Release引用变量使用 %% 。例如: BUILD_TYPE%
export INSTALL_DIR=`pwd`/install export VCPKG_ROOT=/data/vcpkg export VCPKG_TARGET_TRIPLET=x64-android export ANDROID_ABI=x86_64 export ANDROID_PLATFORM=android-23 export ANDROID_NATIVE_API_LEVEL=23 export ANDROID_NDK_HOME= export BUILD_TYPE=Release引用变量使用 ${} 。例如: ${BUILD_TYPE}
git clone https://github.com/KangLin/tigervnc
cmake .. \ -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} \ -DBUILD_SHARED_LIBS=OFF \ -DCMAKE_VERBOSE_MAKEFILE=ON \ -DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake \ -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \ -DVCPKG_VERBOSE=ON \ -DVCPKG_TRACE_FIND_PACKAGE=ON \ -DVCPKG_TARGET_TRIPLET=${VCPKG_TARGET_TRIPLET} \ -DX_VCPKG_APPLOCAL_DEPS_INSTALL=ON \ -DVCPKG_INSTALLED_DIR=${INSTALL_DIR}/tigervnc/vcpkg_installed \ -DANDROID_ABI=${ANDROID_ABI} \ -DANDROID_PLATFORM=${ANDROID_PLATFORM} \ -DBUILD_TESTS=OFF \ -DBUILD_VIEWER=OFF
cmake --build .
cmake --install .
此库默认放在与本项目同级目录下,如果没有在同级目录下,则必须指定 CMake 参数: -DRabbitCommon_ROOT=[RabbitCommon 安装目录]
git clone https://github.com/KangLin/RabbitCommon.git
git clone https://github.com/KangLin/RabbitRemoteControl.git
vcpkg.json
中。export JAVA_HOME= export ANDROID_SDK_ROOT= export ANDROID_NDK_ROOT= export ANDROID_NDK_HOME=%ANDROID_NDK_ROOT% export CMAKE_ROOT= export NINJA_ROOT= export PATH=%CMAKE_ROOT%/bin;%NINJA_ROOT%;%JAVA_HOME%/bin;%PATH% export VCPKG_ROOT= export VCPKG_TARGET_TRIPLET=x64-android export BUILD_TYPE=Release
set JAVA_HOME= set ANDROID_SDK_ROOT= set ANDROID_NDK_ROOT= set ANDROID_NDK_HOME=%ANDROID_NDK_ROOT% set CMAKE_ROOT= set NINJA_ROOT= set PATH=%CMAKE_ROOT%/bin;%NINJA_ROOT%;%JAVA_HOME%/bin;%PATH% set VCPKG_ROOT= set VCPKG_TARGET_TRIPLET=x64-android set BUILD_TYPE=Release
mkdir build ${Qt6_DIR}/bin/qt-cmake .. \ -DCMARK_SHARED=OFF \ -DCMARK_TESTS=OFF \ -DCMARK_STATIC=ON \ -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ -DCMAKE_AUTOGEN_VERBOSE=ON \ -DQT_CHAINLOAD_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake \ -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \ -DVCPKG_TARGET_TRIPLET=${VCPKG_TARGET_TRIPLET} \ -DX_VCPKG_APPLOCAL_DEPS_INSTALL=ON \ -DVCPKG_TRACE_FIND_PACKAGE=ON \ -DVCPKG_VERBOSE=ON \ -DRABBIT_ENABLE_INSTALL_DEPENDENT=ON \ -DRABBIT_ENABLE_INSTALL_QT=ON \ -DRABBIT_ENABLE_INSTALL_TO_BUILD_PATH=ON \ -DQT_HOST_PATH=${Qt6_DIR}/../gcc_64 \ -DQT_ANDROID_SIGN_APK=ON \ -DQT_ENABLE_VERBOSE_DEPLOYMENT=ON \ -DVCPKG_TRACE_FIND_PACKAGE=ON \ -DQt6LinguistTools_DIR=${Qt6_DIR}/../gcc_64/lib/cmake/Qt6LinguistTools \ -DCMAKE_INSTALL_PREFIX=`pwd`/install \ [Depend libraries ......] cmake --build . --verbose --config Release --target all
set JAVA_HOME= set ANDROID_SDK_ROOT= set ANDROID_NDK_ROOT= set ANDROID_NDK_HOME=%ANDROID_NDK_ROOT% set CMAKE_ROOT= set NINJA_ROOT= set PATH=%CMAKE_ROOT%/bin;%NINJA_ROOT%;%JAVA_HOME%/bin;%PATH% set VCPKG_ROOT= set QT_ROOT=
export JAVA_HOME= export ANDROID_SDK_ROOT= export ANDROID_NDK_ROOT= export ANDROID_NDK_HOME=%ANDROID_NDK_ROOT% export CMAKE_ROOT= export NINJA_ROOT= export PATH=%CMAKE_ROOT%/bin;%NINJA_ROOT%;%JAVA_HOME%/bin;%PATH% export VCPKG_ROOT= export QT_ROOT=
cd RabbitRemoteControl cmake --list-presets ;查看 presets cmake --preset "android-x86_64-qt6" \ -DQt6LinguistTools_DIR=${Qt6_DIR}/../gcc_64/lib/cmake/Qt6LinguistTools \ -DQT_HOST_PATH=${Qt6_DIR}/../gcc_64 \ [Depend libraries ......] cmake --build --preset "android-x86_64-qt6"
使用 QtCreator 编译
因为 QtCreator 14 中对 VCPKG ,在 Android 上支持不完善, 所以需要通过设置 QT_CREATOR_SKIP_VCPKG_SETUP=ON,来关闭 VCPKG。 当然,也可以关闭 CMake 包管理器: Qt Creator’s Options -> Build & Run -> CMake and then uncheck “Package manager auto-setup”.