diff options
author | Brad King <brad.king@kitware.com> | 2018-01-08 14:58:06 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-01-08 14:58:11 (GMT) |
commit | a3bba2a5ad30287a22f2a700de6a60f0869b8dac (patch) | |
tree | a53f8f47d28b7259a18020ecaedaec152c07d094 /Source | |
parent | 2c089d80de3945e4f08f13557d59e04cbc942a60 (diff) | |
parent | 4017bf40de512e977d59c12f4e3f6c91f5dd953d (diff) | |
download | CMake-a3bba2a5ad30287a22f2a700de6a60f0869b8dac.zip CMake-a3bba2a5ad30287a22f2a700de6a60f0869b8dac.tar.gz CMake-a3bba2a5ad30287a22f2a700de6a60f0869b8dac.tar.bz2 |
Merge topic '17431-iphone-deployment-target'
4017bf40 Darwin: Emit deployment target that matches the SDK
8f4663ff Xcode: rename embedded SDK query function
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1447
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 11 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 27 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.h | 2 | ||||
-rw-r--r-- | Source/cmInstallTargetGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 31 | ||||
-rw-r--r-- | Source/cmMakefile.h | 17 | ||||
-rw-r--r-- | Source/cmOSXBundleGenerator.cxx | 4 |
8 files changed, 76 insertions, 22 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 4d704b3..4eddd15 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1529,7 +1529,8 @@ std::string cmGeneratorTarget::GetAppBundleDirectory( ext = "app"; } fpath += ext; - if (shouldAddContentLevel(level) && !this->Makefile->PlatformIsAppleIos()) { + if (shouldAddContentLevel(level) && + !this->Makefile->PlatformIsAppleEmbedded()) { fpath += "/Contents"; if (shouldAddFullLevel(level)) { fpath += "/MacOS"; @@ -1559,7 +1560,8 @@ std::string cmGeneratorTarget::GetCFBundleDirectory( } } fpath += ext; - if (shouldAddContentLevel(level) && !this->Makefile->PlatformIsAppleIos()) { + if (shouldAddContentLevel(level) && + !this->Makefile->PlatformIsAppleEmbedded()) { fpath += "/Contents"; if (shouldAddFullLevel(level)) { fpath += "/MacOS"; @@ -1579,7 +1581,8 @@ std::string cmGeneratorTarget::GetFrameworkDirectory( ext = "framework"; } fpath += ext; - if (shouldAddFullLevel(level) && !this->Makefile->PlatformIsAppleIos()) { + if (shouldAddFullLevel(level) && + !this->Makefile->PlatformIsAppleEmbedded()) { fpath += "/Versions/"; fpath += this->GetFrameworkVersion(); } @@ -3004,7 +3007,7 @@ void cmGeneratorTarget::GetLibraryNames(std::string& name, std::string& soName, if (this->IsFrameworkOnApple()) { realName = prefix; - if (!this->Makefile->PlatformIsAppleIos()) { + if (!this->Makefile->PlatformIsAppleEmbedded()) { realName += "Versions/"; realName += this->GetFrameworkVersion(); realName += "/"; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 6e903fb..fd9b488 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2609,7 +2609,7 @@ std::string cmGlobalGenerator::GenerateRuleFile( bool cmGlobalGenerator::ShouldStripResourcePath(cmMakefile* mf) const { - return mf->PlatformIsAppleIos(); + return mf->PlatformIsAppleEmbedded(); } std::string cmGlobalGenerator::GetSharedLibFlagsForLanguage( diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 424ad45..338c2b4 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1172,7 +1172,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets( // dstPath in frameworks is relative to Versions/<version> ostr << keySources.first; } else if (keySources.first != "MacOS") { - if (gtgt->Target->GetMakefile()->PlatformIsAppleIos()) { + if (gtgt->Target->GetMakefile()->PlatformIsAppleEmbedded()) { ostr << keySources.first; } else { // dstPath in bundles is relative to Contents/MacOS @@ -2992,7 +2992,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( buildSettings->AddAttribute("ARCHS", this->CreateString(archs)); } if (deploymentTarget && *deploymentTarget) { - buildSettings->AddAttribute("MACOSX_DEPLOYMENT_TARGET", + buildSettings->AddAttribute(GetDeploymentPlatform(root->GetMakefile()), this->CreateString(deploymentTarget)); } if (!this->GeneratorToolset.empty()) { @@ -3605,7 +3605,7 @@ bool cmGlobalXCodeGenerator::UseEffectivePlatformName(cmMakefile* mf) const "XCODE_EMIT_EFFECTIVE_PLATFORM_NAME"); if (!epnValue) { - return mf->PlatformIsAppleIos(); + return mf->PlatformIsAppleEmbedded(); } return cmSystemTools::IsOn(epnValue); @@ -3627,3 +3627,24 @@ void cmGlobalXCodeGenerator::ComputeTargetObjectDirectory( dir += "/"; gt->ObjectDirectory = dir; } + +std::string cmGlobalXCodeGenerator::GetDeploymentPlatform(const cmMakefile* mf) +{ + switch (mf->GetAppleSDKType()) { + case cmMakefile::AppleSDK::AppleTVOS: + case cmMakefile::AppleSDK::AppleTVSimulator: + return "TVOS_DEPLOYMENT_TARGET"; + + case cmMakefile::AppleSDK::IPhoneOS: + case cmMakefile::AppleSDK::IPhoneSimulator: + return "IPHONEOS_DEPLOYMENT_TARGET"; + + case cmMakefile::AppleSDK::WatchOS: + case cmMakefile::AppleSDK::WatchSimulator: + return "WATCHOS_DEPLOYMENT_TARGET"; + + case cmMakefile::AppleSDK::MacOS: + default: + return "MACOSX_DEPLOYMENT_TARGET"; + } +} diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index b758e97..2269b25 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -254,6 +254,8 @@ private: const std::string& configName, const cmGeneratorTarget* t) const; + static std::string GetDeploymentPlatform(const cmMakefile* mf); + void ComputeArchitectures(cmMakefile* mf); void ComputeObjectDirArch(cmMakefile* mf); diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index b964794..814dc4f 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -167,7 +167,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( to1 += "."; to1 += ext; to1 += "/"; - if (!mf->PlatformIsAppleIos()) { + if (!mf->PlatformIsAppleEmbedded()) { to1 += "Contents/MacOS/"; } to1 += targetName; @@ -796,7 +796,7 @@ void cmInstallTargetGenerator::AddUniversalInstallRule( { cmMakefile const* mf = this->Target->Target->GetMakefile(); - if (!mf->PlatformIsAppleIos() || !mf->IsOn("XCODE")) { + if (!mf->PlatformIsAppleEmbedded() || !mf->IsOn("XCODE")) { return; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index a1e2f63..5d6029c 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2244,25 +2244,38 @@ bool cmMakefile::PlatformIsx32() const return false; } -bool cmMakefile::PlatformIsAppleIos() const +cmMakefile::AppleSDK cmMakefile::GetAppleSDKType() const { std::string sdkRoot; sdkRoot = this->GetSafeDefinition("CMAKE_OSX_SYSROOT"); sdkRoot = cmSystemTools::LowerCase(sdkRoot); - const std::string embedded[] = { - "appletvos", "appletvsimulator", "iphoneos", - "iphonesimulator", "watchos", "watchsimulator", + struct + { + std::string name; + AppleSDK sdk; + } const sdkDatabase[]{ + { "appletvos", AppleSDK::AppleTVOS }, + { "appletvsimulator", AppleSDK::AppleTVSimulator }, + { "iphoneos", AppleSDK::IPhoneOS }, + { "iphonesimulator", AppleSDK::IPhoneSimulator }, + { "watchos", AppleSDK::WatchOS }, + { "watchsimulator", AppleSDK::WatchSimulator }, }; - for (std::string const& i : embedded) { - if (sdkRoot.find(i) == 0 || - sdkRoot.find(std::string("/") + i) != std::string::npos) { - return true; + for (auto entry : sdkDatabase) { + if (sdkRoot.find(entry.name) == 0 || + sdkRoot.find(std::string("/") + entry.name) != std::string::npos) { + return entry.sdk; } } - return false; + return AppleSDK::MacOS; +} + +bool cmMakefile::PlatformIsAppleEmbedded() const +{ + return GetAppleSDKType() != AppleSDK::MacOS; } const char* cmMakefile::GetSONameFlag(const std::string& language) const diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index b36b8ca..c92424b 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -439,8 +439,23 @@ public: /** Return whether the target platform is x32. */ bool PlatformIsx32() const; + /** Apple SDK Type */ + enum class AppleSDK + { + MacOS, + IPhoneOS, + IPhoneSimulator, + AppleTVOS, + AppleTVSimulator, + WatchOS, + WatchSimulator, + }; + + /** What SDK type points CMAKE_OSX_SYSROOT to? */ + AppleSDK GetAppleSDKType() const; + /** Return whether the target platform is Apple iOS. */ - bool PlatformIsAppleIos() const; + bool PlatformIsAppleEmbedded() const; /** Retrieve soname flag for the specified language if supported */ const char* GetSONameFlag(const std::string& language) const; diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx index c85c82d..e658e2c 100644 --- a/Source/cmOSXBundleGenerator.cxx +++ b/Source/cmOSXBundleGenerator.cxx @@ -82,7 +82,7 @@ void cmOSXBundleGenerator::CreateFramework(const std::string& targetName, // Configure the Info.plist file std::string plist = newoutpath; - if (!this->Makefile->PlatformIsAppleIos()) { + if (!this->Makefile->PlatformIsAppleEmbedded()) { // Put the Info.plist file into the Resources directory. this->MacContentFolders->insert("Resources"); plist += "/Resources"; @@ -93,7 +93,7 @@ void cmOSXBundleGenerator::CreateFramework(const std::string& targetName, plist.c_str()); // Generate Versions directory only for MacOSX frameworks - if (this->Makefile->PlatformIsAppleIos()) { + if (this->Makefile->PlatformIsAppleEmbedded()) { return; } |