|
|
@ -207,7 +207,8 @@ void cmGlobalXCodeGenerator::ConfigureOutputPaths() |
|
|
|
this->CurrentMakefile->GetSafeDefinition("LIBRARY_OUTPUT_PATH"); |
|
|
|
if(this->LibraryOutputPath.size() == 0) |
|
|
|
{ |
|
|
|
this->LibraryOutputPath = this->CurrentMakefile->GetCurrentOutputDirectory(); |
|
|
|
this->LibraryOutputPath = |
|
|
|
this->CurrentMakefile->GetCurrentOutputDirectory(); |
|
|
|
} |
|
|
|
// make sure there is a trailing slash
|
|
|
|
if(this->LibraryOutputPath.size() && |
|
|
@ -225,7 +226,8 @@ void cmGlobalXCodeGenerator::ConfigureOutputPaths() |
|
|
|
this->CurrentMakefile->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH"); |
|
|
|
if(this->ExecutableOutputPath.size() == 0) |
|
|
|
{ |
|
|
|
this->ExecutableOutputPath = this->CurrentMakefile->GetCurrentOutputDirectory(); |
|
|
|
this->ExecutableOutputPath = |
|
|
|
this->CurrentMakefile->GetCurrentOutputDirectory(); |
|
|
|
} |
|
|
|
// make sure there is a trailing slash
|
|
|
|
if(this->ExecutableOutputPath.size() && |
|
|
@ -260,7 +262,8 @@ void cmGlobalXCodeGenerator::Generate() |
|
|
|
this->CurrentProject = root->GetMakefile()->GetProjectName(); |
|
|
|
this->SetCurrentLocalGenerator(root); |
|
|
|
this->OutputDir = this->CurrentMakefile->GetHomeOutputDirectory(); |
|
|
|
this->OutputDir = cmSystemTools::CollapseFullPath(this->OutputDir.c_str()); |
|
|
|
this->OutputDir = |
|
|
|
cmSystemTools::CollapseFullPath(this->OutputDir.c_str()); |
|
|
|
cmSystemTools::SplitPath(this->OutputDir.c_str(), |
|
|
|
this->ProjectOutputDirectoryComponents); |
|
|
|
this->CurrentLocalGenerator = root; |
|
|
@ -358,7 +361,8 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile(cmLocalGenerator* root) |
|
|
|
this->CurrentReRunCMakeMakefile += "/CMakeScripts"; |
|
|
|
cmSystemTools::MakeDirectory(this->CurrentReRunCMakeMakefile.c_str()); |
|
|
|
this->CurrentReRunCMakeMakefile += "/ReRunCMake.make"; |
|
|
|
cmGeneratedFileStream makefileStream(this->CurrentReRunCMakeMakefile.c_str()); |
|
|
|
cmGeneratedFileStream makefileStream |
|
|
|
(this->CurrentReRunCMakeMakefile.c_str()); |
|
|
|
makefileStream.SetCopyIfDifferent(true); |
|
|
|
makefileStream << "# Generated by CMake, DO NOT EDIT\n"; |
|
|
|
makefileStream << "CMakeFiles/cmake.check_cache: "; |
|
|
@ -425,7 +429,8 @@ cmGlobalXCodeGenerator::CreateString(const char* s) |
|
|
|
} |
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
cmXCodeObject* cmGlobalXCodeGenerator::CreateObjectReference(cmXCodeObject* ref) |
|
|
|
cmXCodeObject* cmGlobalXCodeGenerator |
|
|
|
::CreateObjectReference(cmXCodeObject* ref) |
|
|
|
{ |
|
|
|
cmXCodeObject* obj = this->CreateObject(cmXCodeObject::OBJECT_REF); |
|
|
|
obj->SetObject(ref); |
|
|
@ -445,7 +450,8 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg, |
|
|
|
lg->AppendFlags(flags, cmtarget.GetProperty("COMPILE_FLAGS")); |
|
|
|
} |
|
|
|
lg->AppendFlags(flags, sf->GetProperty("COMPILE_FLAGS")); |
|
|
|
cmXCodeObject* fileRef = this->CreateObject(cmXCodeObject::PBXFileReference); |
|
|
|
cmXCodeObject* fileRef = |
|
|
|
this->CreateObject(cmXCodeObject::PBXFileReference); |
|
|
|
|
|
|
|
cmXCodeObject* group = this->GroupMap[sf]; |
|
|
|
cmXCodeObject* children = group->GetObject("children"); |
|
|
@ -461,7 +467,8 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg, |
|
|
|
buildFile->SetComment(comment.c_str()); |
|
|
|
fileRef->SetComment(fname.c_str()); |
|
|
|
buildFile->AddAttribute("fileRef", this->CreateObjectReference(fileRef)); |
|
|
|
cmXCodeObject* settings = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); |
|
|
|
cmXCodeObject* settings = |
|
|
|
this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); |
|
|
|
settings->AddAttribute("COMPILER_FLAGS", this->CreateString(flags.c_str())); |
|
|
|
buildFile->AddAttribute("settings", settings); |
|
|
|
fileRef->AddAttribute("fileEncoding", this->CreateString("4")); |
|
|
@ -551,7 +558,8 @@ void cmGlobalXCodeGenerator::SetCurrentLocalGenerator(cmLocalGenerator* gen) |
|
|
|
std::string outdir = |
|
|
|
cmSystemTools::CollapseFullPath(this->CurrentMakefile-> |
|
|
|
GetCurrentOutputDirectory()); |
|
|
|
cmSystemTools::SplitPath(outdir.c_str(), this->CurrentOutputDirectoryComponents); |
|
|
|
cmSystemTools::SplitPath(outdir.c_str(), |
|
|
|
this->CurrentOutputDirectoryComponents); |
|
|
|
|
|
|
|
// Select the current set of configuration types.
|
|
|
|
this->CurrentConfigurationTypes.clear(); |
|
|
@ -560,7 +568,8 @@ void cmGlobalXCodeGenerator::SetCurrentLocalGenerator(cmLocalGenerator* gen) |
|
|
|
if(const char* types = |
|
|
|
this->CurrentMakefile->GetDefinition("CMAKE_CONFIGURATION_TYPES")) |
|
|
|
{ |
|
|
|
cmSystemTools::ExpandListArgument(types, this->CurrentConfigurationTypes); |
|
|
|
cmSystemTools::ExpandListArgument(types, |
|
|
|
this->CurrentConfigurationTypes); |
|
|
|
} |
|
|
|
} |
|
|
|
if(this->CurrentConfigurationTypes.empty()) |
|
|
@ -613,7 +622,8 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, |
|
|
|
sourceBuildPhase->AddAttribute("buildActionMask", |
|
|
|
this->CreateString("2147483647")); |
|
|
|
sourceBuildPhase->SetComment("Sources"); |
|
|
|
cmXCodeObject* buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); |
|
|
|
cmXCodeObject* buildFiles = |
|
|
|
this->CreateObject(cmXCodeObject::OBJECT_LIST); |
|
|
|
sourceBuildPhase->AddAttribute("files", buildFiles); |
|
|
|
sourceBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", |
|
|
|
this->CreateString("0")); |
|
|
@ -626,7 +636,8 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, |
|
|
|
i != classes.end(); ++i) |
|
|
|
{ |
|
|
|
cmXCodeObject* xsf = |
|
|
|
this->CreateXCodeSourceFile(this->CurrentLocalGenerator, *i, cmtarget); |
|
|
|
this->CreateXCodeSourceFile(this->CurrentLocalGenerator, |
|
|
|
*i, cmtarget); |
|
|
|
cmXCodeObject* fr = xsf->GetObject("fileRef"); |
|
|
|
cmXCodeObject* filetype = |
|
|
|
fr->GetObject()->GetObject("lastKnownFileType"); |
|
|
@ -730,7 +741,8 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, |
|
|
|
for ( sfIt = mit->second.begin(); sfIt != mit->second.end(); ++ sfIt ) |
|
|
|
{ |
|
|
|
cmXCodeObject* xsf = |
|
|
|
this->CreateXCodeSourceFile(this->CurrentLocalGenerator, *sfIt, cmtarget); |
|
|
|
this->CreateXCodeSourceFile(this->CurrentLocalGenerator, |
|
|
|
*sfIt, cmtarget); |
|
|
|
buildFiles->AddObject(xsf); |
|
|
|
} |
|
|
|
} |
|
|
@ -794,9 +806,9 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases, |
|
|
|
} |
|
|
|
} |
|
|
|
std::vector<cmCustomCommand> reruncom; |
|
|
|
cmXCodeObject* cmakeReRunPhase = this->CreateBuildPhase("CMake ReRun", |
|
|
|
"cmakeReRunPhase", |
|
|
|
cmtarget, reruncom); |
|
|
|
cmXCodeObject* cmakeReRunPhase = |
|
|
|
this->CreateBuildPhase("CMake ReRun", "cmakeReRunPhase", |
|
|
|
cmtarget, reruncom); |
|
|
|
buildPhases->AddObject(cmakeReRunPhase); |
|
|
|
// create prebuild phase
|
|
|
|
cmXCodeObject* cmakeRulesBuildPhase = |
|
|
@ -804,17 +816,16 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases, |
|
|
|
"cmakeRulesBuildPhase", |
|
|
|
cmtarget, commands); |
|
|
|
// create prebuild phase
|
|
|
|
cmXCodeObject* preBuildPhase = this->CreateBuildPhase("CMake PreBuild Rules", |
|
|
|
"preBuildCommands", |
|
|
|
cmtarget, prebuild); |
|
|
|
cmXCodeObject* preBuildPhase = |
|
|
|
this->CreateBuildPhase("CMake PreBuild Rules", "preBuildCommands", |
|
|
|
cmtarget, prebuild); |
|
|
|
// create prebuild phase
|
|
|
|
cmXCodeObject* preLinkPhase = this->CreateBuildPhase("CMake PreLink Rules", |
|
|
|
"preLinkCommands", |
|
|
|
cmtarget, prelink); |
|
|
|
cmXCodeObject* preLinkPhase = |
|
|
|
this->CreateBuildPhase("CMake PreLink Rules", "preLinkCommands", |
|
|
|
cmtarget, prelink); |
|
|
|
// create prebuild phase
|
|
|
|
cmXCodeObject* postBuildPhase = |
|
|
|
this->CreateBuildPhase("CMake PostBuild Rules", |
|
|
|
"postBuildPhase", |
|
|
|
this->CreateBuildPhase("CMake PostBuild Rules", "postBuildPhase", |
|
|
|
cmtarget, postbuild); |
|
|
|
// the order here is the order they will be built in
|
|
|
|
if(preBuildPhase) |
|
|
@ -977,7 +988,8 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase, |
|
|
|
// There are no outputs. Use the generated force rule name.
|
|
|
|
makefileStream << tname[&cc] << ": "; |
|
|
|
} |
|
|
|
for(std::vector<std::string>::const_iterator d = cc.GetDepends().begin(); |
|
|
|
for(std::vector<std::string>::const_iterator d = |
|
|
|
cc.GetDepends().begin(); |
|
|
|
d != cc.GetDepends().end(); ++d) |
|
|
|
{ |
|
|
|
if(!this->FindTarget(this->CurrentProject.c_str(), |
|
|
@ -1057,7 +1069,8 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase, |
|
|
|
} |
|
|
|
makecmd += " all"; |
|
|
|
cmSystemTools::ReplaceString(makecmd, "\\ ", "\\\\ "); |
|
|
|
buildphase->AddAttribute("shellScript", this->CreateString(makecmd.c_str())); |
|
|
|
buildphase->AddAttribute("shellScript", |
|
|
|
this->CreateString(makecmd.c_str())); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1107,17 +1120,17 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, |
|
|
|
} |
|
|
|
|
|
|
|
// Add define flags
|
|
|
|
this->CurrentLocalGenerator->AppendFlags(defFlags, |
|
|
|
this->CurrentMakefile->GetDefineFlags()); |
|
|
|
this->CurrentLocalGenerator-> |
|
|
|
AppendFlags(defFlags, |
|
|
|
this->CurrentMakefile->GetDefineFlags()); |
|
|
|
cmSystemTools::ReplaceString(defFlags, "\"", "\\\""); |
|
|
|
cmSystemTools::ReplaceString(flags, "\"", "\\\""); |
|
|
|
cmSystemTools::ReplaceString(cflags, "\"", "\\\""); |
|
|
|
if(this->XcodeVersion > 15) |
|
|
|
{ |
|
|
|
buildSettings-> |
|
|
|
AddAttribute("GCC_PREPROCESSOR_DEFINITIONS", |
|
|
|
this->CreateString("CMAKE_INTDIR=\\\\\\\"$(CONFIGURATION)\\\\\\\"")); |
|
|
|
|
|
|
|
buildSettings->AddAttribute |
|
|
|
("GCC_PREPROCESSOR_DEFINITIONS", |
|
|
|
this->CreateString("CMAKE_INTDIR=\\\\\\\"$(CONFIGURATION)\\\\\\\"")); |
|
|
|
} |
|
|
|
std::string extraLinkOptions; |
|
|
|
if(target.GetType() == cmTarget::EXECUTABLE) |
|
|
@ -1127,13 +1140,13 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, |
|
|
|
} |
|
|
|
if(target.GetType() == cmTarget::SHARED_LIBRARY) |
|
|
|
{ |
|
|
|
extraLinkOptions = |
|
|
|
this->CurrentMakefile->GetRequiredDefinition("CMAKE_SHARED_LINKER_FLAGS"); |
|
|
|
extraLinkOptions = this->CurrentMakefile-> |
|
|
|
GetRequiredDefinition("CMAKE_SHARED_LINKER_FLAGS"); |
|
|
|
} |
|
|
|
if(target.GetType() == cmTarget::MODULE_LIBRARY) |
|
|
|
{ |
|
|
|
extraLinkOptions = |
|
|
|
this->CurrentMakefile->GetRequiredDefinition("CMAKE_MODULE_LINKER_FLAGS"); |
|
|
|
extraLinkOptions = this->CurrentMakefile-> |
|
|
|
GetRequiredDefinition("CMAKE_MODULE_LINKER_FLAGS"); |
|
|
|
} |
|
|
|
|
|
|
|
const char* targetLinkFlags = target.GetProperty("LINK_FLAGS"); |
|
|
@ -1495,7 +1508,8 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget) |
|
|
|
buildSettings, fileTypeString, |
|
|
|
productTypeString, productName, globalConfig); |
|
|
|
target->AddAttribute("buildSettings", buildSettings); |
|
|
|
cmXCodeObject* dependencies = this->CreateObject(cmXCodeObject::OBJECT_LIST); |
|
|
|
cmXCodeObject* dependencies = |
|
|
|
this->CreateObject(cmXCodeObject::OBJECT_LIST); |
|
|
|
target->AddAttribute("dependencies", dependencies); |
|
|
|
target->AddAttribute("name", this->CreateString(productName.c_str())); |
|
|
|
target->AddAttribute("productName",this->CreateString(productName.c_str())); |
|
|
@ -1507,12 +1521,14 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget) |
|
|
|
void cmGlobalXCodeGenerator::AddConfigurations(cmXCodeObject* target, |
|
|
|
cmTarget& cmtarget) |
|
|
|
{ |
|
|
|
std::string configTypes = this->CurrentMakefile->GetRequiredDefinition("CMAKE_CONFIGURATION_TYPES"); |
|
|
|
std::string configTypes = |
|
|
|
this->CurrentMakefile->GetRequiredDefinition("CMAKE_CONFIGURATION_TYPES"); |
|
|
|
std::vector<std::string> configVectorIn; |
|
|
|
std::vector<std::string> configVector; |
|
|
|
configVectorIn.push_back(configTypes); |
|
|
|
cmSystemTools::ExpandList(configVectorIn, configVector); |
|
|
|
cmXCodeObject* configlist = this->CreateObject(cmXCodeObject::XCConfigurationList); |
|
|
|
cmXCodeObject* configlist = |
|
|
|
this->CreateObject(cmXCodeObject::XCConfigurationList); |
|
|
|
cmXCodeObject* buildConfigurations = |
|
|
|
this->CreateObject(cmXCodeObject::OBJECT_LIST); |
|
|
|
configlist->AddAttribute("buildConfigurations", buildConfigurations); |
|
|
@ -1526,7 +1542,8 @@ void cmGlobalXCodeGenerator::AddConfigurations(cmXCodeObject* target, |
|
|
|
this->CreateObjectReference(configlist)); |
|
|
|
for(unsigned int i = 0; i < configVector.size(); ++i) |
|
|
|
{ |
|
|
|
cmXCodeObject* config = this->CreateObject(cmXCodeObject::XCBuildConfiguration); |
|
|
|
cmXCodeObject* config = |
|
|
|
this->CreateObject(cmXCodeObject::XCBuildConfiguration); |
|
|
|
buildConfigurations->AddObject(config); |
|
|
|
cmXCodeObject* buildSettings = |
|
|
|
this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); |
|
|
@ -1545,7 +1562,8 @@ void cmGlobalXCodeGenerator::AddConfigurations(cmXCodeObject* target, |
|
|
|
{ |
|
|
|
configlist->AddAttribute("defaultConfigurationName", |
|
|
|
this->CreateString(configVector[0].c_str())); |
|
|
|
configlist->AddAttribute("defaultConfigurationIsVisible", this->CreateString("0")); |
|
|
|
configlist->AddAttribute("defaultConfigurationIsVisible", |
|
|
|
this->CreateString("0")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -1577,12 +1595,14 @@ cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget, |
|
|
|
buildSettings, fileTypeString, |
|
|
|
productTypeString, productName, globalConfig); |
|
|
|
target->AddAttribute("buildSettings", buildSettings); |
|
|
|
cmXCodeObject* dependencies = this->CreateObject(cmXCodeObject::OBJECT_LIST); |
|
|
|
cmXCodeObject* dependencies = |
|
|
|
this->CreateObject(cmXCodeObject::OBJECT_LIST); |
|
|
|
target->AddAttribute("dependencies", dependencies); |
|
|
|
target->AddAttribute("name", this->CreateString(productName.c_str())); |
|
|
|
target->AddAttribute("productName",this->CreateString(productName.c_str())); |
|
|
|
|
|
|
|
cmXCodeObject* fileRef = this->CreateObject(cmXCodeObject::PBXFileReference); |
|
|
|
cmXCodeObject* fileRef = |
|
|
|
this->CreateObject(cmXCodeObject::PBXFileReference); |
|
|
|
fileRef->AddAttribute("explicitFileType", |
|
|
|
this->CreateString(fileTypeString.c_str())); |
|
|
|
fileRef->AddAttribute("path", this->CreateString(productName.c_str())); |
|
|
@ -1629,7 +1649,8 @@ void cmGlobalXCodeGenerator::AddDependTarget(cmXCodeObject* target, |
|
|
|
// now avoid circular references if dependTarget already
|
|
|
|
// depends on target then skip it. Circular references crashes
|
|
|
|
// xcode
|
|
|
|
cmXCodeObject* dependTargetDepends = dependTarget->GetObject("dependencies"); |
|
|
|
cmXCodeObject* dependTargetDepends = |
|
|
|
dependTarget->GetObject("dependencies"); |
|
|
|
if(dependTargetDepends) |
|
|
|
{ |
|
|
|
if(dependTargetDepends->HasObject(target->GetPBXTargetDependency())) |
|
|
@ -1700,10 +1721,11 @@ void cmGlobalXCodeGenerator::AppendOrAddBuildSetting(cmXCodeObject* settings, |
|
|
|
} |
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmGlobalXCodeGenerator::AppendBuildSettingAttribute(cmXCodeObject* target, |
|
|
|
const char* attribute, |
|
|
|
const char* value, |
|
|
|
const char* configName) |
|
|
|
void cmGlobalXCodeGenerator |
|
|
|
::AppendBuildSettingAttribute(cmXCodeObject* target, |
|
|
|
const char* attribute, |
|
|
|
const char* value, |
|
|
|
const char* configName) |
|
|
|
{ |
|
|
|
if(this->XcodeVersion < 21) |
|
|
|
{ |
|
|
@ -1716,12 +1738,15 @@ void cmGlobalXCodeGenerator::AppendBuildSettingAttribute(cmXCodeObject* target, |
|
|
|
{ |
|
|
|
// There are multiple configurations. Add the setting to the
|
|
|
|
// buildSettings of the configuration name given.
|
|
|
|
cmXCodeObject* configurationList = target->GetObject("buildConfigurationList")->GetObject(); |
|
|
|
cmXCodeObject* buildConfigs = configurationList->GetObject("buildConfigurations"); |
|
|
|
cmXCodeObject* configurationList = |
|
|
|
target->GetObject("buildConfigurationList")->GetObject(); |
|
|
|
cmXCodeObject* buildConfigs = |
|
|
|
configurationList->GetObject("buildConfigurations"); |
|
|
|
std::vector<cmXCodeObject*> list = buildConfigs->GetObjectList(); |
|
|
|
// each configuration and the target itself has a buildSettings in it
|
|
|
|
//list.push_back(target);
|
|
|
|
for(std::vector<cmXCodeObject*>::iterator i = list.begin(); i != list.end(); ++i) |
|
|
|
for(std::vector<cmXCodeObject*>::iterator i = list.begin(); |
|
|
|
i != list.end(); ++i) |
|
|
|
{ |
|
|
|
if(configName) |
|
|
|
{ |
|
|
@ -1741,7 +1766,8 @@ void cmGlobalXCodeGenerator::AppendBuildSettingAttribute(cmXCodeObject* target, |
|
|
|
} |
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target) |
|
|
|
void cmGlobalXCodeGenerator |
|
|
|
::AddDependAndLinkInformation(cmXCodeObject* target) |
|
|
|
{ |
|
|
|
cmTarget* cmtarget = target->GetTarget(); |
|
|
|
if(!cmtarget) |
|
|
@ -1760,7 +1786,8 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target) |
|
|
|
emitted.insert(cmtarget->GetName()); |
|
|
|
|
|
|
|
// Loop over all library dependencies.
|
|
|
|
const cmTarget::LinkLibraryVectorType& tlibs = cmtarget->GetLinkLibraries(); |
|
|
|
const cmTarget::LinkLibraryVectorType& tlibs = |
|
|
|
cmtarget->GetLinkLibraries(); |
|
|
|
for(cmTarget::LinkLibraryVectorType::const_iterator lib = tlibs.begin(); |
|
|
|
lib != tlibs.end(); ++lib) |
|
|
|
{ |
|
|
@ -1896,15 +1923,16 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root, |
|
|
|
for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++) |
|
|
|
{ |
|
|
|
cmTarget& cmtarget = l->second; |
|
|
|
// add the soon to be generated Info.plist file as a source for a MACOSX_BUNDLE
|
|
|
|
// file
|
|
|
|
// add the soon to be generated Info.plist file as a source for a
|
|
|
|
// MACOSX_BUNDLE file
|
|
|
|
if(cmtarget.GetPropertyAsBool("MACOSX_BUNDLE")) |
|
|
|
{ |
|
|
|
cmSourceFile file; |
|
|
|
file.SetName("Info", |
|
|
|
this->CurrentMakefile->GetCurrentOutputDirectory(), |
|
|
|
"plist", false); |
|
|
|
cmtarget.GetSourceFiles().push_back(this->CurrentMakefile->AddSource(file)); |
|
|
|
cmtarget.GetSourceFiles().push_back |
|
|
|
(this->CurrentMakefile->AddSource(file)); |
|
|
|
} |
|
|
|
|
|
|
|
std::vector<cmSourceFile*> & classes = cmtarget.GetSourceFiles(); |
|
|
@ -1916,20 +1944,22 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root, |
|
|
|
std::string const& source = sf->GetFullPath(); |
|
|
|
cmSourceGroup& sourceGroup = |
|
|
|
mf->FindSourceGroup(source.c_str(), sourceGroups); |
|
|
|
cmXCodeObject* pbxgroup = this->CreateOrGetPBXGroup(cmtarget, &sourceGroup); |
|
|
|
cmXCodeObject* pbxgroup = |
|
|
|
this->CreateOrGetPBXGroup(cmtarget, &sourceGroup); |
|
|
|
this->GroupMap[sf] = pbxgroup; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
cmXCodeObject* cmGlobalXCodeGenerator::CreateOrGetPBXGroup(cmTarget& cmtarget, |
|
|
|
cmSourceGroup* sg) |
|
|
|
cmXCodeObject* cmGlobalXCodeGenerator |
|
|
|
::CreateOrGetPBXGroup(cmTarget& cmtarget, cmSourceGroup* sg) |
|
|
|
{ |
|
|
|
cmStdString s = cmtarget.GetName(); |
|
|
|
s += "/"; |
|
|
|
s += sg->GetName(); |
|
|
|
std::map<cmStdString, cmXCodeObject* >::iterator i = this->GroupNameMap.find(s); |
|
|
|
std::map<cmStdString, cmXCodeObject* >::iterator i = |
|
|
|
this->GroupNameMap.find(s); |
|
|
|
if(i != this->GroupNameMap.end()) |
|
|
|
{ |
|
|
|
return i->second; |
|
|
@ -1973,10 +2003,10 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateOrGetPBXGroup(cmTarget& cmtarget, |
|
|
|
} |
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmGlobalXCodeGenerator::CreateXCodeObjects(cmLocalGenerator* root, |
|
|
|
std::vector<cmLocalGenerator*>& |
|
|
|
generators |
|
|
|
) |
|
|
|
void cmGlobalXCodeGenerator |
|
|
|
::CreateXCodeObjects(cmLocalGenerator* root, |
|
|
|
std::vector<cmLocalGenerator*>& |
|
|
|
generators) |
|
|
|
{ |
|
|
|
this->ClearXCodeObjects(); |
|
|
|
this->RootObject = 0; |
|
|
@ -1989,7 +2019,8 @@ void cmGlobalXCodeGenerator::CreateXCodeObjects(cmLocalGenerator* root, |
|
|
|
cmXCodeObject* listObjs = this->CreateObject(cmXCodeObject::OBJECT_LIST); |
|
|
|
if(this->XcodeVersion == 15) |
|
|
|
{ |
|
|
|
developBuildStyle->AddAttribute("name", this->CreateString("Development")); |
|
|
|
developBuildStyle->AddAttribute("name", |
|
|
|
this->CreateString("Development")); |
|
|
|
developBuildStyle->AddAttribute("buildSettings", group); |
|
|
|
listObjs->AddObject(developBuildStyle); |
|
|
|
group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); |
|
|
@ -2102,8 +2133,10 @@ void cmGlobalXCodeGenerator::CreateXCodeObjects(cmLocalGenerator* root, |
|
|
|
comment += this->CurrentProject; |
|
|
|
comment += "\""; |
|
|
|
configlist->SetComment(comment.c_str()); |
|
|
|
configlist->AddAttribute("defaultConfigurationIsVisible", this->CreateString("0")); |
|
|
|
configlist->AddAttribute("defaultConfigurationName", this->CreateString("Debug")); |
|
|
|
configlist->AddAttribute("defaultConfigurationIsVisible", |
|
|
|
this->CreateString("0")); |
|
|
|
configlist->AddAttribute("defaultConfigurationName", |
|
|
|
this->CreateString("Debug")); |
|
|
|
cmXCodeObject* buildSettings = |
|
|
|
this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); |
|
|
|
const char* osxArch = |
|
|
@ -2178,7 +2211,8 @@ void |
|
|
|
cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( |
|
|
|
std::vector<cmXCodeObject*>& targets) |
|
|
|
{ |
|
|
|
cmGeneratedFileStream makefileStream(this->CurrentXCodeHackMakefile.c_str()); |
|
|
|
cmGeneratedFileStream |
|
|
|
makefileStream(this->CurrentXCodeHackMakefile.c_str()); |
|
|
|
if(!makefileStream) |
|
|
|
{ |
|
|
|
cmSystemTools::Error("Could not create", |
|
|
@ -2190,8 +2224,8 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( |
|
|
|
// correctly by xcode
|
|
|
|
makefileStream << "# DO NOT EDIT\n"; |
|
|
|
makefileStream << "# This makefile makes sure all linkable targets are \n"; |
|
|
|
makefileStream |
|
|
|
<< "# up-to-date with anything they link to,avoiding a bug in XCode 1.5\n"; |
|
|
|
makefileStream << "# up-to-date with anything they link to,avoiding a " |
|
|
|
"bug in XCode 1.5\n"; |
|
|
|
for(std::vector<std::string>::const_iterator |
|
|
|
ct = this->CurrentConfigurationTypes.begin(); |
|
|
|
ct != this->CurrentConfigurationTypes.end(); ++ct) |
|
|
@ -2235,8 +2269,8 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( |
|
|
|
cmXCodeObject* target = *i; |
|
|
|
std::map<cmStdString, cmXCodeObject::StringVec> const& deplibs = |
|
|
|
target->GetDependLibraries(); |
|
|
|
for(std::map<cmStdString, cmXCodeObject::StringVec>::const_iterator ci = deplibs.begin(); |
|
|
|
ci != deplibs.end(); ++ci) |
|
|
|
for(std::map<cmStdString, cmXCodeObject::StringVec>::const_iterator ci |
|
|
|
= deplibs.begin(); ci != deplibs.end(); ++ci) |
|
|
|
{ |
|
|
|
for(cmXCodeObject::StringVec::const_iterator d = ci->second.begin(); |
|
|
|
d != ci->second.end(); ++d) |
|
|
@ -2276,7 +2310,8 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( |
|
|
|
{ |
|
|
|
// Create a rule for this target.
|
|
|
|
std::string tfull = t->GetFullPath(configName); |
|
|
|
makefileStream << this->ConvertToRelativeForMake(tfull.c_str()) << ":"; |
|
|
|
makefileStream << this->ConvertToRelativeForMake(tfull.c_str()) |
|
|
|
<< ":"; |
|
|
|
|
|
|
|
// List dependencies if any exist.
|
|
|
|
std::map<cmStdString, cmXCodeObject::StringVec>::const_iterator |
|
|
@ -2360,7 +2395,8 @@ cmGlobalXCodeGenerator::OutputXCodeProject(cmLocalGenerator* root, |
|
|
|
{ |
|
|
|
if ((l->second.GetType() != cmTarget::INSTALL_FILES) |
|
|
|
&& (l->second.GetType() != cmTarget::INSTALL_PROGRAMS) |
|
|
|
&& (strncmp(l->first.c_str(), "INCLUDE_EXTERNAL_MSPROJECT", 26) != 0) |
|
|
|
&& (strncmp(l->first.c_str(), |
|
|
|
"INCLUDE_EXTERNAL_MSPROJECT", 26) != 0) |
|
|
|
&& banned.find(l->second.GetName()) == banned.end()) |
|
|
|
{ |
|
|
|
cmTarget& target = l->second; |
|
|
@ -2369,7 +2405,8 @@ cmGlobalXCodeGenerator::OutputXCodeProject(cmLocalGenerator* root, |
|
|
|
// this target
|
|
|
|
for(unsigned int k =0; k < cc->GetDepends().size(); k++) |
|
|
|
{ |
|
|
|
if(cmSystemTools::GetFilenameName(cc->GetDepends()[k]) == target.GetFullName()) |
|
|
|
if(cmSystemTools::GetFilenameName |
|
|
|
(cc->GetDepends()[k]) == target.GetFullName()) |
|
|
|
{ |
|
|
|
sameAsTarget = true; |
|
|
|
} |
|
|
|