Xcode: Add support for combined install on iOS

This patch solves the problem of installing both: Device and Simulator
libraries on iOS. Before only one of them was installed.

If the IOS_INSTALL_COMBINED property is set on a target, a
special install hook will be activated which builds the corresponding
target and combines both at the install location.

The original patch was contributed by Ruslan Baratov, and polished by
Gregor Jasny.
This commit is contained in:
Ruslan Baratov
2015-10-08 03:09:34 +03:00
committed by Gregor Jasny
parent 34f5ef564a
commit 565d080a9a
16 changed files with 532 additions and 0 deletions

View File

@@ -531,6 +531,7 @@ void cmInstallTargetGenerator::PostReplacementTweaks(std::ostream& os,
{
this->AddInstallNamePatchRule(os, indent, config, file);
this->AddChrpathPatchRule(os, indent, config, file);
this->AddUniversalInstallRule(os, indent, file);
this->AddRanlibRule(os, indent, file);
this->AddStripRule(os, indent, file);
}
@@ -867,3 +868,46 @@ cmInstallTargetGenerator::AddRanlibRule(std::ostream& os,
os << indent << "execute_process(COMMAND \""
<< ranlib << "\" \"" << toDestDirPath << "\")\n";
}
//----------------------------------------------------------------------------
void
cmInstallTargetGenerator
::AddUniversalInstallRule(std::ostream& os,
Indent const& indent,
const std::string& toDestDirPath)
{
cmMakefile const* mf = this->Target->Target->GetMakefile();
if(!mf->PlatformIsAppleIos() || !mf->IsOn("XCODE"))
{
return;
}
const char* xcodeVersion = mf->GetDefinition("XCODE_VERSION");
if(!xcodeVersion || cmSystemTools::VersionCompareGreater("6", xcodeVersion))
{
return;
}
switch(this->Target->GetType())
{
case cmState::EXECUTABLE:
case cmState::STATIC_LIBRARY:
case cmState::SHARED_LIBRARY:
case cmState::MODULE_LIBRARY:
break;
default:
return;
}
if(!this->Target->Target->GetPropertyAsBool("IOS_INSTALL_COMBINED"))
{
return;
}
os << indent << "include(CMakeIOSInstallCombined)\n";
os << indent << "ios_install_combined("
<< "\"" << this->Target->Target->GetName() << "\" "
<< "\"" << toDestDirPath << "\")\n";
}