From 26e70d15f636d538817d5821b294be292d47c9e9 Mon Sep 17 00:00:00 2001 From: Holden Date: Tue, 17 Sep 2024 07:16:14 -0400 Subject: [PATCH] CMake: MacOS Deployment Fixes --- .github/workflows/macos.yml | 3 ++- CMakeLists.txt | 2 ++ cmake/CreateMacDMG.cmake | 2 +- src/Geo/CMakeLists.txt | 2 +- src/Joystick/CMakeLists.txt | 2 +- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index d71900e6134e..e005e25a0a44 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -23,7 +23,7 @@ on: jobs: build: - runs-on: macos-13 + runs-on: macos-latest strategy: matrix: @@ -88,6 +88,7 @@ jobs: working-directory: ${{ runner.temp }}/shadow_build_dir run: ${{ env.QT_ROOT_DIR }}/bin/qt-cmake -S ${{ github.workspace }} -B . -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.BuildType }} + -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DQGC_BUILD_TESTING=${{ matrix.BuildType == 'Debug' && 'ON' || 'OFF' }} -DQGC_STABLE_BUILD=${{ github.ref_type == 'tag' || contains(github.ref, 'Stable') && 'ON' || 'OFF' }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 491fb33a9b33..1a1d8a304a37 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -231,6 +231,8 @@ if(QGC_DISABLE_APM_MAVLINK) add_compile_definitions(NO_ARDUPILOT_DIALECT) endif() +cmake_dependent_option(QGC_BUILD_DEPENDENCIES "Force Building of Dependencies." OFF "CMAKE_CROSSCOMPILING OR NOT CMAKE_OSX_ARCHITECTURES STREQUAL ${CMAKE_HOST_SYSTEM_PROCESSOR}" ON) + ####################################################### # Custom Build Configuration ####################################################### diff --git a/cmake/CreateMacDMG.cmake b/cmake/CreateMacDMG.cmake index f2ccbf3ee350..cce72e9c379f 100644 --- a/cmake/CreateMacDMG.cmake +++ b/cmake/CreateMacDMG.cmake @@ -37,6 +37,6 @@ file(REMOVE_RECURSE package) file(MAKE_DIRECTORY package) file(COPY staging/QGroundControl.app DESTINATION package) file(REMOVE /tmp/tmp.dmg) -execute_process(COMMAND hdiutil create /tmp/tmp.dmg -ov -volname QGroundControl -fs HFS+ -srcfolder package) +execute_process(COMMAND hdiutil create /tmp/tmp.dmg -ov -volname QGroundControl -fs APFS -srcfolder package) execute_process(COMMAND hdiutil convert /tmp/tmp.dmg -format UDBZ -o package/QGroundControl.dmg) file(REMOVE /tmp/tmp.dmg) diff --git a/src/Geo/CMakeLists.txt b/src/Geo/CMakeLists.txt index 85a21ab8195b..4a4899c84808 100644 --- a/src/Geo/CMakeLists.txt +++ b/src/Geo/CMakeLists.txt @@ -17,7 +17,7 @@ target_include_directories(Geo PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) set(MINIMUM_GEOGRAPHICLIB_VERSION 2.3) -if(NOT CMAKE_CROSSCOMPILING) +if(NOT QGC_BUILD_DEPENDENCIES) find_package(GeographicLib ${MINIMUM_GEOGRAPHICLIB_VERSION} COMPONENTS STATIC) if(GeographicLib_FOUND) message(STATUS "Found GeographicLib") diff --git a/src/Joystick/CMakeLists.txt b/src/Joystick/CMakeLists.txt index 52a0afb75b9b..1cebdecdbd07 100644 --- a/src/Joystick/CMakeLists.txt +++ b/src/Joystick/CMakeLists.txt @@ -62,7 +62,7 @@ qt_add_resources(Joystick "gamecontrollerdb.txt" set(MINIMUM_SDL2_VERSION 2.30.0) -if(NOT CMAKE_CROSSCOMPILING) +if(NOT QGC_BUILD_DEPENDENCIES) find_package(SDL2 ${MINIMUM_SDL2_VERSION}) if(SDL2_FOUND) message(STATUS "Found JoystickSDL ${SDL2_VERSION_STRING}")