diff options
author | Craig Scott <craig.scott@crascit.com> | 2021-02-08 06:30:48 (GMT) |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2021-02-08 07:02:46 (GMT) |
commit | 0110aa018d81a7b0f1f9371fcd038b71fefae554 (patch) | |
tree | b6232f4855654052c2eba15f663154ec19dc2b55 /Source | |
parent | f0257a87a3c282e2ea0c0a06556d4fedeb4cfe95 (diff) | |
download | CMake-0110aa018d81a7b0f1f9371fcd038b71fefae554.zip CMake-0110aa018d81a7b0f1f9371fcd038b71fefae554.tar.gz CMake-0110aa018d81a7b0f1f9371fcd038b71fefae554.tar.bz2 |
IOS_INSTALL_COMBINED: Support Xcode 12 (command line only)
Xcode 12 doesn't allow nested builds within the same build directory.
That means we can no longer do an install by building the install target
when IOS_INSTALL_COMBINED is true. We can, however, still do an install
by running the cmake_install.cmake script or executing cmake --install,
since there is no outer build and therefore the associated SDK can be
built as a sub-build.
The non-build methods previously didn't work when
IOS_INSTALL_COMBINED was true because the generated install script
and the CMakeIOSInstallCombined script both made certain assumptions
that relied on being part of a build. Those assumptions are now
removed. A side-effect of this work is that cpack now also works from the
command line when IOS_INSTALL_COMBINED is true.
Relates: #21282
Fixes: #20023
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmLocalGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmLocalGenerator.h | 2 | ||||
-rw-r--r-- | Source/cmLocalXCodeGenerator.cxx | 60 | ||||
-rw-r--r-- | Source/cmLocalXCodeGenerator.h | 2 |
4 files changed, 62 insertions, 4 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 2239192..b5580e7 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -644,6 +644,8 @@ void cmLocalGenerator::GenerateInstallRules() /* clang-format on */ } + this->AddGeneratorSpecificInstallSetup(fout); + // Ask each install generator to write its code. cmPolicies::PolicyStatus status = this->GetPolicyStatus(cmPolicies::CMP0082); auto const& installers = this->Makefile->GetInstallGenerators(); diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 22d3599..0fa8759 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -493,6 +493,8 @@ protected: std::ostream& os, const std::string& config, std::vector<std::string> const& configurationTypes); + virtual void AddGeneratorSpecificInstallSetup(std::ostream&) {} + std::string& CreateSafeUniqueObjectFileName(const std::string& sin, std::string const& dir_max); diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx index ac0d35e..3b4e3a8 100644 --- a/Source/cmLocalXCodeGenerator.cxx +++ b/Source/cmLocalXCodeGenerator.cxx @@ -4,6 +4,7 @@ #include "cmGeneratorTarget.h" #include "cmGlobalXCodeGenerator.h" +#include "cmMakefile.h" #include "cmSourceFile.h" class cmGeneratorTarget; @@ -45,13 +46,66 @@ void cmLocalXCodeGenerator::Generate() } } -void cmLocalXCodeGenerator::GenerateInstallRules() +void cmLocalXCodeGenerator::AddGeneratorSpecificInstallSetup(std::ostream& os) { - cmLocalGenerator::GenerateInstallRules(); - + // First check if we need to warn about incompatible settings for (const auto& target : this->GetGeneratorTargets()) { target->HasMacOSXRpathInstallNameDir(""); } + + // CMakeIOSInstallCombined.cmake needs to know the location of the top of + // the build directory + os << "set(CMAKE_BINARY_DIR \"" << this->GetBinaryDirectory() << "\")\n\n"; + + if (this->Makefile->PlatformIsAppleEmbedded()) { + std::string platformName; + switch (this->Makefile->GetAppleSDKType()) { + case cmMakefile::AppleSDK::IPhoneOS: + platformName = "iphoneos"; + break; + case cmMakefile::AppleSDK::IPhoneSimulator: + platformName = "iphonesimulator"; + break; + case cmMakefile::AppleSDK::AppleTVOS: + platformName = "appletvos"; + break; + case cmMakefile::AppleSDK::AppleTVSimulator: + platformName = "appletvsimulator"; + break; + case cmMakefile::AppleSDK::WatchOS: + platformName = "watchos"; + break; + case cmMakefile::AppleSDK::WatchSimulator: + platformName = "watchsimulator"; + break; + case cmMakefile::AppleSDK::MacOS: + break; + } + if (!platformName.empty()) { + // The effective platform name is just the platform name with a hyphen + // prepended. We can get the SUPPORTED_PLATFORMS from the project file + // at runtime, so we don't need to compute that here. + /* clang-format off */ + os << + "if(NOT PLATFORM_NAME)\n" + " if(NOT \"$ENV{PLATFORM_NAME}\" STREQUAL \"\")\n" + " set(PLATFORM_NAME \"$ENV{PLATFORM_NAME}\")\n" + " endif()\n" + " if(NOT PLATFORM_NAME)\n" + " set(PLATFORM_NAME " << platformName << ")\n" + " endif()\n" + "endif()\n\n" + "if(NOT EFFECTIVE_PLATFORM_NAME)\n" + " if(NOT \"$ENV{EFFECTIVE_PLATFORM_NAME}\" STREQUAL \"\")\n" + " set(EFFECTIVE_PLATFORM_NAME \"$ENV{EFFECTIVE_PLATFORM_NAME}\")\n" + " endif()\n" + " if(NOT EFFECTIVE_PLATFORM_NAME)\n" + " set(EFFECTIVE_PLATFORM_NAME -" << platformName << ")\n" + " endif()\n" + "endif()\n\n"; + /* clang-format off */ + } + } } void cmLocalXCodeGenerator::ComputeObjectFilenames( diff --git a/Source/cmLocalXCodeGenerator.h b/Source/cmLocalXCodeGenerator.h index dd038b4..5f72f6d 100644 --- a/Source/cmLocalXCodeGenerator.h +++ b/Source/cmLocalXCodeGenerator.h @@ -32,7 +32,7 @@ public: void AppendFlagEscape(std::string& flags, const std::string& rawFlag) const override; void Generate() override; - virtual void GenerateInstallRules(); + void AddGeneratorSpecificInstallSetup(std::ostream& os) override; void ComputeObjectFilenames( std::map<cmSourceFile const*, std::string>& mapping, cmGeneratorTarget const* gt = nullptr) override; |