From 0d5a1ba297d3b00844c48e319a33b01b700354f5 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Thu, 9 Dec 2021 14:02:14 +0400 Subject: [PATCH] Force mac architecture and deployment target only in non-packaged builds --- validate_special_target.cmake | 18 +++++++++++++----- variables.cmake | 8 ++++++-- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/validate_special_target.cmake b/validate_special_target.cmake index 9e79684..dc55e50 100644 --- a/validate_special_target.cmake +++ b/validate_special_target.cmake @@ -6,6 +6,12 @@ set(DESKTOP_APP_SPECIAL_TARGET "" CACHE STRING "Use special platform target, like 'macstore' for Mac App Store.") +set(no_special_target 0) +if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "") + set(no_special_target 1) +endif() +option(DESKTOP_APP_USE_PACKAGED "Find libraries using CMake instead of exact paths." ${no_special_target}) + set(default_to_qt6 1) if (WIN32) set(default_to_qt6 0) @@ -18,11 +24,13 @@ function(report_bad_special_target) endif() endfunction() -set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12 CACHE STRING "Minimum macOS deployment version" FORCE) -if (DESKTOP_APP_QT6) - set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "Target macOS architectures" FORCE) -else() - set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Target macOS architectures" FORCE) +if (NOT DESKTOP_APP_USE_PACKAGED) + set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12 CACHE STRING "Minimum macOS deployment version" FORCE) + if (DESKTOP_APP_QT6) + set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "Target macOS architectures" FORCE) + else() + set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Target macOS architectures" FORCE) + endif() endif() if (WIN32) diff --git a/variables.cmake b/variables.cmake index 768612c..902e9af 100644 --- a/variables.cmake +++ b/variables.cmake @@ -22,7 +22,6 @@ option(DESKTOP_APP_DISABLE_DBUS_INTEGRATION "Disable all code for D-Bus integrat option(DESKTOP_APP_DISABLE_X11_INTEGRATION "Disable all code for X11 integration (Linux only)." OFF) option(DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION "Disable all code for Wayland integration (Linux only)." OFF) option(DESKTOP_APP_USE_ALLOCATION_TRACER "Use simple allocation tracer (Linux only)." OFF) -option(DESKTOP_APP_USE_PACKAGED "Find libraries using CMake instead of exact paths." ${no_special_target}) option(DESKTOP_APP_USE_PACKAGED_LAZY "Bundle recommended Qt plugins for self-contained packages. (Linux only)" OFF) option(DESKTOP_APP_USE_PACKAGED_FFMPEG_STATIC "Link ffmpeg statically in packaged mode." OFF) option(DESKTOP_APP_DISABLE_SPELLCHECK "Disable spellcheck library." OFF) @@ -31,7 +30,12 @@ option(DESKTOP_APP_DISABLE_AUTOUPDATE "Disable autoupdate." ${disable_autoupdate option(DESKTOP_APP_USE_HUNSPELL_ONLY "Disable system spellchecker and use bundled Hunspell only. (For debugging purposes)" OFF) option(DESKTOP_APP_USE_ENCHANT "Use Enchant instead of bundled Hunspell. (Linux only)" OFF) option(DESKTOP_APP_NO_PDB "Disable PDB file generation. (Windows only)" OFF) -set(DESKTOP_APP_MAC_ARCH "x86_64;arm64" CACHE STRING "Target macOS arch. (macOS only)") + +if (NOT DESKTOP_APP_USE_PACKAGED) + set(DESKTOP_APP_MAC_ARCH "${CMAKE_OSX_ARCHITECTURES}" CACHE STRING "Target macOS arch. (macOS only)") +else() + set(DESKTOP_APP_MAC_ARCH "x86_64;arm64" CACHE STRING "Target macOS arch. (macOS only)") +endif() set(dont_bundle_fonts 0) if (DESKTOP_APP_USE_PACKAGED AND NOT DESKTOP_APP_USE_PACKAGED_LAZY)