From 161ecbf01d05a487bf126c2075cb1ee6c5393189 Mon Sep 17 00:00:00 2001 From: Dimitri Schoolwerth Date: Fri, 8 Jan 2021 13:00:02 +0100 Subject: [PATCH 1/3] CMake: Separate minimal support for iOS and macOS Differentiate between the minimal supported version of macOS (10.10) and iOS (12.0) instead of setting CMAKE_OSX_DEPLOYMENT_TARGET to (macOS-only) 10.10 for both platforms. --- CMakeLists.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 76496f1708..a78472a7cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,8 +28,12 @@ endif() if(APPLE AND NOT CMAKE_OSX_DEPLOYMENT_TARGET) # If no deployment target has been set default to the minimum supported - # OS X version (this has to be set before the first project() call) - set(CMAKE_OSX_DEPLOYMENT_TARGET 10.10 CACHE STRING "macOS Deployment Target") + # OS version (this has to be set before the first project() call) + if(CMAKE_SYSTEM_NAME STREQUAL "iOS") + set(CMAKE_OSX_DEPLOYMENT_TARGET 12.0 CACHE STRING "iOS Deployment Target") + else() + set(CMAKE_OSX_DEPLOYMENT_TARGET 10.10 CACHE STRING "macOS Deployment Target") + endif() endif() include(build/cmake/policies.cmake NO_POLICY_SCOPE) From 086ad7bc9ab0a79c05dd875a60914e60b7c1e378 Mon Sep 17 00:00:00 2001 From: Dimitri Schoolwerth Date: Fri, 8 Jan 2021 13:02:30 +0100 Subject: [PATCH 2/3] CMake: Fix out of sync iOS/macOS deployment target The minimal sample doesn't have an implicit deployment target set, while the library does through CMakeLists.txt in root. This can result in iOS link errors when not explicitly setting CMAKE_OSX_DEPLOYMENT_TARGET as the sample will then use a target OS with an architecture that may not be present in the library with its current target OS version. Fix by copying the part setting CMAKE_OSX_DEPLOYMENT_TARGET in the library to the minimal sample as well. Both parts should be kept in sync but that still seemed preferable to additionally polluting an example file for CMake usage with a dependency by introducing a common include file. --- CMakeLists.txt | 2 ++ samples/minimal/CMakeLists.txt | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a78472a7cd..4063020552 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,6 +26,8 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release") endif() +# This block, particularly the versions used, should be kept in sync with +# samples/minimal/CMakeLists.txt. if(APPLE AND NOT CMAKE_OSX_DEPLOYMENT_TARGET) # If no deployment target has been set default to the minimum supported # OS version (this has to be set before the first project() call) diff --git a/samples/minimal/CMakeLists.txt b/samples/minimal/CMakeLists.txt index 8f64044812..7e1333f4fe 100644 --- a/samples/minimal/CMakeLists.txt +++ b/samples/minimal/CMakeLists.txt @@ -16,6 +16,16 @@ # Declare the minimum required CMake version cmake_minimum_required(VERSION 2.8.12) +if(APPLE AND NOT CMAKE_OSX_DEPLOYMENT_TARGET) + # If no deployment target has been set default to the minimum supported + # OS version (this has to be set before the first project() call) + if(CMAKE_SYSTEM_NAME STREQUAL "iOS") + set(CMAKE_OSX_DEPLOYMENT_TARGET 12.0 CACHE STRING "iOS Deployment Target") + else() + set(CMAKE_OSX_DEPLOYMENT_TARGET 10.10 CACHE STRING "macOS Deployment Target") + endif() +endif() + # Name the project project(minimal) From b86bcb09ce3ab97d4dd0f1a8c3945ca48bb37504 Mon Sep 17 00:00:00 2001 From: Dimitri Schoolwerth Date: Fri, 8 Jan 2021 13:03:24 +0100 Subject: [PATCH 3/3] Travis CI: Use default target for CMake iOS build Remove an explicitly set CMAKE_OSX_DEPLOYMENT_TARGET from the CMake iOS build in order to use the default value which is now also set to an iOS instead of macOS version. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 30c54fc91d..2841c20a28 100644 --- a/.travis.yml +++ b/.travis.yml @@ -62,7 +62,7 @@ jobs: name: wxOSX iOS Xcode 11.4 - os: osx osx_image: xcode11.4 - env: wxTOOLSET=cmake wxCMAKE_GENERATOR=Xcode wxCMAKE_DEFINES="-DCMAKE_SYSTEM_NAME=iOS -DCMAKE_FIND_ROOT_PATH=/usr/local -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED=NO -DCMAKE_OSX_DEPLOYMENT_TARGET=10.12" wxCMAKE_SAMPLES=OFF wxCMAKE_TESTS=OFF + env: wxTOOLSET=cmake wxCMAKE_GENERATOR=Xcode wxCMAKE_DEFINES="-DCMAKE_SYSTEM_NAME=iOS -DCMAKE_FIND_ROOT_PATH=/usr/local -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED=NO" wxCMAKE_SAMPLES=OFF wxCMAKE_TESTS=OFF name: wxOSX iOS CMake Xcode 11.4 - dist: bionic compiler: gcc