mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-05 05:11:15 -06:00
@@ -3298,6 +3298,31 @@ void cmGlobalXCodeGenerator::OutputXCodeProject(
|
|||||||
void cmGlobalXCodeGenerator::OutputXCodeSharedSchemes(
|
void cmGlobalXCodeGenerator::OutputXCodeSharedSchemes(
|
||||||
const std::string& xcProjDir)
|
const std::string& xcProjDir)
|
||||||
{
|
{
|
||||||
|
// collect all tests for the targets
|
||||||
|
std::map<std::string, cmXCodeScheme::TestObjects> testables;
|
||||||
|
|
||||||
|
for (std::vector<cmXCodeObject*>::const_iterator i =
|
||||||
|
this->XCodeObjects.begin();
|
||||||
|
i != this->XCodeObjects.end(); ++i) {
|
||||||
|
cmXCodeObject* obj = *i;
|
||||||
|
if (obj->GetType() != cmXCodeObject::OBJECT ||
|
||||||
|
obj->GetIsA() != cmXCodeObject::PBXNativeTarget) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!obj->GetTarget()->IsXCTestOnApple()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* testee = obj->GetTarget()->GetProperty("XCTEST_TESTEE");
|
||||||
|
if (!testee) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
testables[testee].push_back(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
// generate scheme
|
||||||
for (std::vector<cmXCodeObject*>::const_iterator i =
|
for (std::vector<cmXCodeObject*>::const_iterator i =
|
||||||
this->XCodeObjects.begin();
|
this->XCodeObjects.begin();
|
||||||
i != this->XCodeObjects.end(); ++i) {
|
i != this->XCodeObjects.end(); ++i) {
|
||||||
@@ -3305,8 +3330,9 @@ void cmGlobalXCodeGenerator::OutputXCodeSharedSchemes(
|
|||||||
if (obj->GetType() == cmXCodeObject::OBJECT &&
|
if (obj->GetType() == cmXCodeObject::OBJECT &&
|
||||||
(obj->GetIsA() == cmXCodeObject::PBXNativeTarget ||
|
(obj->GetIsA() == cmXCodeObject::PBXNativeTarget ||
|
||||||
obj->GetIsA() == cmXCodeObject::PBXAggregateTarget)) {
|
obj->GetIsA() == cmXCodeObject::PBXAggregateTarget)) {
|
||||||
cmXCodeScheme schm(obj, this->CurrentConfigurationTypes,
|
const std::string& targetName = obj->GetTarget()->GetName();
|
||||||
this->XcodeVersion);
|
cmXCodeScheme schm(obj, testables[targetName],
|
||||||
|
this->CurrentConfigurationTypes, this->XcodeVersion);
|
||||||
schm.WriteXCodeSharedScheme(xcProjDir,
|
schm.WriteXCodeSharedScheme(xcProjDir,
|
||||||
this->RelativeToSource(xcProjDir.c_str()));
|
this->RelativeToSource(xcProjDir.c_str()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,10 +10,11 @@
|
|||||||
#include "cmGeneratorTarget.h"
|
#include "cmGeneratorTarget.h"
|
||||||
#include "cmXMLSafe.h"
|
#include "cmXMLSafe.h"
|
||||||
|
|
||||||
cmXCodeScheme::cmXCodeScheme(cmXCodeObject* xcObj,
|
cmXCodeScheme::cmXCodeScheme(cmXCodeObject* xcObj, const TestObjects& tests,
|
||||||
const std::vector<std::string>& configList,
|
const std::vector<std::string>& configList,
|
||||||
unsigned int xcVersion)
|
unsigned int xcVersion)
|
||||||
: Target(xcObj)
|
: Target(xcObj)
|
||||||
|
, Tests(tests)
|
||||||
, TargetName(xcObj->GetTarget()->GetName())
|
, TargetName(xcObj->GetTarget()->GetName())
|
||||||
, ConfigList(configList)
|
, ConfigList(configList)
|
||||||
, XcodeVersion(xcVersion)
|
, XcodeVersion(xcVersion)
|
||||||
@@ -56,7 +57,7 @@ void cmXCodeScheme::WriteXCodeXCScheme(std::ostream& fout,
|
|||||||
xout.Attribute("version", "1.3");
|
xout.Attribute("version", "1.3");
|
||||||
|
|
||||||
WriteBuildAction(xout, container);
|
WriteBuildAction(xout, container);
|
||||||
WriteTestAction(xout, FindConfiguration("Debug"));
|
WriteTestAction(xout, FindConfiguration("Debug"), container);
|
||||||
WriteLaunchAction(xout, FindConfiguration("Debug"), container);
|
WriteLaunchAction(xout, FindConfiguration("Debug"), container);
|
||||||
WriteProfileAction(xout, FindConfiguration("Release"));
|
WriteProfileAction(xout, FindConfiguration("Release"));
|
||||||
WriteAnalyzeAction(xout, FindConfiguration("Debug"));
|
WriteAnalyzeAction(xout, FindConfiguration("Debug"));
|
||||||
@@ -90,7 +91,8 @@ void cmXCodeScheme::WriteBuildAction(cmXMLWriter& xout,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void cmXCodeScheme::WriteTestAction(cmXMLWriter& xout,
|
void cmXCodeScheme::WriteTestAction(cmXMLWriter& xout,
|
||||||
std::string configuration)
|
std::string configuration,
|
||||||
|
const std::string& container)
|
||||||
{
|
{
|
||||||
xout.StartElement("TestAction");
|
xout.StartElement("TestAction");
|
||||||
xout.BreakAttributes();
|
xout.BreakAttributes();
|
||||||
@@ -102,8 +104,22 @@ void cmXCodeScheme::WriteTestAction(cmXMLWriter& xout,
|
|||||||
xout.Attribute("shouldUseLaunchSchemeArgsEnv", "YES");
|
xout.Attribute("shouldUseLaunchSchemeArgsEnv", "YES");
|
||||||
|
|
||||||
xout.StartElement("Testables");
|
xout.StartElement("Testables");
|
||||||
|
for (TestObjects::const_iterator it = this->Tests.begin();
|
||||||
|
it != this->Tests.end(); ++it) {
|
||||||
|
xout.StartElement("TestableReference");
|
||||||
|
xout.BreakAttributes();
|
||||||
|
xout.Attribute("skipped", "NO");
|
||||||
|
WriteBuildableReference(xout, *it, container);
|
||||||
|
xout.EndElement(); // TestableReference
|
||||||
|
}
|
||||||
xout.EndElement();
|
xout.EndElement();
|
||||||
|
|
||||||
|
if (IsTestable()) {
|
||||||
|
xout.StartElement("MacroExpansion");
|
||||||
|
WriteBuildableReference(xout, this->Target, container);
|
||||||
|
xout.EndElement(); // MacroExpansion
|
||||||
|
}
|
||||||
|
|
||||||
xout.StartElement("AdditionalOptions");
|
xout.StartElement("AdditionalOptions");
|
||||||
xout.EndElement();
|
xout.EndElement();
|
||||||
|
|
||||||
@@ -213,6 +229,11 @@ std::string cmXCodeScheme::FindConfiguration(const std::string& name)
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cmXCodeScheme::IsTestable() const
|
||||||
|
{
|
||||||
|
return !this->Tests.empty() || IsExecutable(this->Target);
|
||||||
|
}
|
||||||
|
|
||||||
bool cmXCodeScheme::IsExecutable(const cmXCodeObject* target)
|
bool cmXCodeScheme::IsExecutable(const cmXCodeObject* target)
|
||||||
{
|
{
|
||||||
cmGeneratorTarget* gt = target->GetTarget();
|
cmGeneratorTarget* gt = target->GetTarget();
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
#include "cmConfigure.h" // IWYU pragma: keep
|
#include "cmConfigure.h" // IWYU pragma: keep
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "cmGlobalXCodeGenerator.h"
|
#include "cmGlobalXCodeGenerator.h"
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
#include "cmXCodeObject.h"
|
#include "cmXCodeObject.h"
|
||||||
@@ -16,7 +18,9 @@
|
|||||||
class cmXCodeScheme
|
class cmXCodeScheme
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cmXCodeScheme(cmXCodeObject* xcObj,
|
typedef std::vector<const cmXCodeObject*> TestObjects;
|
||||||
|
|
||||||
|
cmXCodeScheme(cmXCodeObject* xcObj, const TestObjects& tests,
|
||||||
const std::vector<std::string>& configList,
|
const std::vector<std::string>& configList,
|
||||||
unsigned int xcVersion);
|
unsigned int xcVersion);
|
||||||
|
|
||||||
@@ -25,6 +29,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
const cmXCodeObject* const Target;
|
const cmXCodeObject* const Target;
|
||||||
|
const TestObjects Tests;
|
||||||
const std::string& TargetName;
|
const std::string& TargetName;
|
||||||
const std::vector<std::string>& ConfigList;
|
const std::vector<std::string>& ConfigList;
|
||||||
const unsigned int XcodeVersion;
|
const unsigned int XcodeVersion;
|
||||||
@@ -32,7 +37,8 @@ private:
|
|||||||
void WriteXCodeXCScheme(std::ostream& fout, const std::string& container);
|
void WriteXCodeXCScheme(std::ostream& fout, const std::string& container);
|
||||||
|
|
||||||
void WriteBuildAction(cmXMLWriter& xout, const std::string& container);
|
void WriteBuildAction(cmXMLWriter& xout, const std::string& container);
|
||||||
void WriteTestAction(cmXMLWriter& xout, std::string configuration);
|
void WriteTestAction(cmXMLWriter& xout, std::string configuration,
|
||||||
|
const std::string& container);
|
||||||
void WriteLaunchAction(cmXMLWriter& xout, std::string configuration,
|
void WriteLaunchAction(cmXMLWriter& xout, std::string configuration,
|
||||||
const std::string& container);
|
const std::string& container);
|
||||||
void WriteProfileAction(cmXMLWriter& xout, std::string configuration);
|
void WriteProfileAction(cmXMLWriter& xout, std::string configuration);
|
||||||
@@ -45,6 +51,8 @@ private:
|
|||||||
std::string WriteVersionString();
|
std::string WriteVersionString();
|
||||||
std::string FindConfiguration(const std::string& name);
|
std::string FindConfiguration(const std::string& name);
|
||||||
|
|
||||||
|
bool IsTestable() const;
|
||||||
|
|
||||||
static bool IsExecutable(const cmXCodeObject* target);
|
static bool IsExecutable(const cmXCodeObject* target);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user