From 73805ea2db8f6ab62dd58520602a540c3090278b Mon Sep 17 00:00:00 2001 From: Paul Date: Sun, 22 Sep 2019 08:06:19 -0400 Subject: [PATCH] On OSX, convert systemversion to MACOSX_DEPLOYMENT_TARGET Per the discussion in issue #1336, if systemversion is set output MACOSX_DEPLOYMENT_TARGET into the resulting xcode project. This borrows a diff from the (unmerged) PR #1003, applies it in isolation, and adds a pair of unit tests to confirm that both setting and not setting the systemversion results in correct output. Closes #1336 --- modules/xcode/tests/test_xcode_project.lua | 43 ++++++++++++++++++++++ modules/xcode/xcode_common.lua | 5 +++ 2 files changed, 48 insertions(+) diff --git a/modules/xcode/tests/test_xcode_project.lua b/modules/xcode/tests/test_xcode_project.lua index 27972b67..2d4eff37 100644 --- a/modules/xcode/tests/test_xcode_project.lua +++ b/modules/xcode/tests/test_xcode_project.lua @@ -1738,6 +1738,49 @@ ]] end + function suite.XCBuildConfigurationTarget_OnOSXMinVersion() + _TARGET_OS = "macosx" + systemversion "10.11" + prepare() + xcode.XCBuildConfiguration_Target(tr, tr.products.children[1], tr.configs[1]) + test.capture [[ + FDC4CBFB4635B02D8AD4823B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CONFIGURATION_BUILD_DIR = bin/Debug; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_DYNAMIC_NO_PIC = NO; + INSTALL_PATH = /usr/local/bin; + MACOSX_DEPLOYMENT_TARGET = 10.11; + PRODUCT_NAME = MyProject; + }; + name = Debug; + }; + ]] + end + + function suite.XCBuildConfigurationTarget_OnOSXUnSpecificedVersion() + _TARGET_OS = "macosx" + -- systemversion "10.11" + prepare() + xcode.XCBuildConfiguration_Target(tr, tr.products.children[1], tr.configs[1]) + test.capture [[ + FDC4CBFB4635B02D8AD4823B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CONFIGURATION_BUILD_DIR = bin/Debug; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_DYNAMIC_NO_PIC = NO; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = MyProject; + }; + name = Debug; + }; + ]] + end + function suite.XCBuildConfigurationTarget_OnInfoPlist() files { "./a/b/c/MyProject-Info.plist" } diff --git a/modules/xcode/xcode_common.lua b/modules/xcode/xcode_common.lua index 9abfe396..0a32f224 100644 --- a/modules/xcode/xcode_common.lua +++ b/modules/xcode/xcode_common.lua @@ -1233,6 +1233,11 @@ if family then settings['TARGETED_DEVICE_FAMILY'] = family end + else + local minOSVersion = project.systemversion(cfg) + if minOSVersion ~= nil then + settings['MACOSX_DEPLOYMENT_TARGET'] = minOSVersion + end end --ms not by default ...add it manually if you need it