Xcode: Fix schema container location calculation

This commit is contained in:
Gregor Jasny
2017-02-24 17:31:24 +01:00
parent 5995082101
commit 7202db5db4
4 changed files with 18 additions and 19 deletions

View File

@@ -3344,7 +3344,7 @@ void cmGlobalXCodeGenerator::OutputXCodeProject(
if (this->GetCMakeInstance()->GetState()->GetGlobalPropertyAsBool(
"XCODE_GENERATE_SCHEME") &&
this->XcodeVersion >= 70) {
this->OutputXCodeSharedSchemes(xcodeDir, root);
this->OutputXCodeSharedSchemes(xcodeDir);
this->OutputXCodeWorkspaceSettings(xcodeDir);
}
@@ -3357,7 +3357,7 @@ void cmGlobalXCodeGenerator::OutputXCodeProject(
}
void cmGlobalXCodeGenerator::OutputXCodeSharedSchemes(
const std::string& xcProjDir, cmLocalGenerator* root)
const std::string& xcProjDir)
{
for (std::vector<cmXCodeObject*>::const_iterator i =
this->XCodeObjects.begin();
@@ -3369,7 +3369,7 @@ void cmGlobalXCodeGenerator::OutputXCodeSharedSchemes(
cmXCodeScheme schm(obj, this->CurrentConfigurationTypes,
this->XcodeVersion);
schm.WriteXCodeSharedScheme(xcProjDir,
root->GetCurrentSourceDirectory());
this->RelativeToSource(xcProjDir.c_str()));
}
}
}

View File

@@ -166,8 +166,7 @@ private:
void OutputXCodeProject(cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators);
// Write shared scheme files for all the native targets
void OutputXCodeSharedSchemes(const std::string& xcProjDir,
cmLocalGenerator* root);
void OutputXCodeSharedSchemes(const std::string& xcProjDir);
void OutputXCodeWorkspaceSettings(const std::string& xcProjDir);
void WriteXCodePBXProj(std::ostream& fout, cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators);

View File

@@ -3,6 +3,7 @@
#include "cmXCodeScheme.h"
#include <iomanip>
#include <iostream>
#include <sstream>
#include "cmGeneratedFileStream.h"
@@ -20,7 +21,7 @@ cmXCodeScheme::cmXCodeScheme(cmXCodeObject* xcObj,
}
void cmXCodeScheme::WriteXCodeSharedScheme(const std::string& xcProjDir,
const std::string sourceRoot)
const std::string& container)
{
// Create shared scheme sub-directory tree
//
@@ -39,12 +40,11 @@ void cmXCodeScheme::WriteXCodeSharedScheme(const std::string& xcProjDir,
return;
}
std::string xcProjRelDir = xcProjDir.substr(sourceRoot.size() + 1);
WriteXCodeXCScheme(fout, xcProjRelDir);
WriteXCodeXCScheme(fout, container);
}
void cmXCodeScheme::WriteXCodeXCScheme(std::ostream& fout,
const std::string& xcProjDir)
const std::string& container)
{
cmXMLWriter xout(fout);
xout.SetIndentationElement(std::string(3, ' '));
@@ -55,9 +55,9 @@ void cmXCodeScheme::WriteXCodeXCScheme(std::ostream& fout,
xout.Attribute("LastUpgradeVersion", WriteVersionString());
xout.Attribute("version", "1.3");
WriteBuildAction(xout, xcProjDir);
WriteBuildAction(xout, container);
WriteTestAction(xout, FindConfiguration("Debug"));
WriteLaunchAction(xout, FindConfiguration("Debug"), xcProjDir);
WriteLaunchAction(xout, FindConfiguration("Debug"), container);
WriteProfileAction(xout, FindConfiguration("Release"));
WriteAnalyzeAction(xout, FindConfiguration("Debug"));
WriteArchiveAction(xout, FindConfiguration("Release"));
@@ -66,7 +66,7 @@ void cmXCodeScheme::WriteXCodeXCScheme(std::ostream& fout,
}
void cmXCodeScheme::WriteBuildAction(cmXMLWriter& xout,
const std::string& xcProjDir)
const std::string& container)
{
xout.StartElement("BuildAction");
xout.BreakAttributes();
@@ -88,7 +88,7 @@ void cmXCodeScheme::WriteBuildAction(cmXMLWriter& xout,
xout.Attribute("BlueprintIdentifier", this->TargetId);
xout.Attribute("BuildableName", this->TargetName);
xout.Attribute("BlueprintName", this->TargetName);
xout.Attribute("ReferencedContainer", "container:" + xcProjDir);
xout.Attribute("ReferencedContainer", "container:" + container);
xout.EndElement();
xout.EndElement(); // BuildActionEntry
@@ -119,7 +119,7 @@ void cmXCodeScheme::WriteTestAction(cmXMLWriter& xout,
void cmXCodeScheme::WriteLaunchAction(cmXMLWriter& xout,
std::string configuration,
const std::string& xcProjDir)
const std::string& container)
{
xout.StartElement("LaunchAction");
xout.BreakAttributes();
@@ -143,7 +143,7 @@ void cmXCodeScheme::WriteLaunchAction(cmXMLWriter& xout,
xout.Attribute("BlueprintIdentifier", this->TargetId);
xout.Attribute("BuildableName", this->TargetName);
xout.Attribute("BlueprintName", this->TargetName);
xout.Attribute("ReferencedContainer", "container:" + xcProjDir);
xout.Attribute("ReferencedContainer", "container:" + container);
xout.EndElement();
xout.EndElement(); // MacroExpansion

View File

@@ -21,7 +21,7 @@ public:
unsigned int xcVersion);
void WriteXCodeSharedScheme(const std::string& xcProjDir,
const std::string sourceRoot);
const std::string& container);
private:
const std::string& TargetName;
@@ -29,12 +29,12 @@ private:
const std::vector<std::string>& ConfigList;
const unsigned int XcodeVersion;
void WriteXCodeXCScheme(std::ostream& fout, const std::string& xcProjDir);
void WriteXCodeXCScheme(std::ostream& fout, const std::string& container);
void WriteBuildAction(cmXMLWriter& xout, const std::string& xcProjDir);
void WriteBuildAction(cmXMLWriter& xout, const std::string& container);
void WriteTestAction(cmXMLWriter& xout, std::string configuration);
void WriteLaunchAction(cmXMLWriter& xout, std::string configuration,
const std::string& xcProjDir);
const std::string& container);
void WriteProfileAction(cmXMLWriter& xout, std::string configuration);
void WriteAnalyzeAction(cmXMLWriter& xout, std::string configuration);
void WriteArchiveAction(cmXMLWriter& xout, std::string configuration);