summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2006-03-24 14:15:05 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2006-03-24 14:15:05 (GMT)
commitf7c1723135f140eaac1ee02c31c0339761778f22 (patch)
treeae4858167f38f2e57c3dcf442fbfe83aeea1cc82 /Source
parentcec6543d0d7e0f8302b092f3ff66fb240bc212c4 (diff)
downloadCMake-f7c1723135f140eaac1ee02c31c0339761778f22.zip
CMake-f7c1723135f140eaac1ee02c31c0339761778f22.tar.gz
CMake-f7c1723135f140eaac1ee02c31c0339761778f22.tar.bz2
ENH: add support for universal binaries
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx37
-rw-r--r--Source/cmLocalGenerator.cxx26
-rw-r--r--Source/cmLocalGenerator.h2
-rw-r--r--Source/cmLocalXCodeGenerator.cxx3
-rw-r--r--Source/cmTryCompileCommand.cxx15
5 files changed, 70 insertions, 13 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index bccf362..cf7a96d 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -62,9 +62,6 @@ public:
#endif
-//TODO
-// add OSX application stuff
-
//----------------------------------------------------------------------------
cmGlobalXCodeGenerator::cmGlobalXCodeGenerator()
{
@@ -1096,16 +1093,12 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
this->CreateString("mh_bundle"));
buildSettings->AddAttribute("GCC_DYNAMIC_NO_PIC",
this->CreateString("NO"));
+ buildSettings->AddAttribute("PREBINDING",
+ this->CreateString("NO"));
buildSettings->AddAttribute("GCC_SYMBOLS_PRIVATE_EXTERN",
this->CreateString("NO"));
buildSettings->AddAttribute("GCC_INLINES_ARE_PRIVATE_EXTERN",
this->CreateString("NO"));
- std::string outflag = "-o \\\"$(CONFIGURATION_BUILD_DIR)/";
- outflag += productName;
- outflag += "\\\"";
- extraLinkOptions += " ";
- extraLinkOptions += outflag;
-
// Add the flags to create an executable.
std::string createFlags =
this->LookupFlags("CMAKE_", lang, "_LINK_FLAGS", "");
@@ -1980,7 +1973,31 @@ void cmGlobalXCodeGenerator::CreateXCodeObjects(cmLocalGenerator* root,
configlist->AddAttribute("defaultConfigurationIsVisible", this->CreateString("0"));
configlist->AddAttribute("defaultConfigurationName", this->CreateString("Debug"));
cmXCodeObject* buildSettings =
- this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
+ this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
+ const char* osxArch =
+ this->CurrentMakefile->GetDefinition("CMAKE_OSX_ARCHITECTURES");
+ const char* sysroot =
+ this->CurrentMakefile->GetDefinition("CMAKE_OSX_SYSROOT");
+ if(osxArch && sysroot)
+ {
+ std::vector<std::string> archs;
+ cmSystemTools::ExpandListArgument(std::string(osxArch),
+ archs);
+ if(archs.size() > 1)
+ {
+ buildSettings->AddAttribute("SDKROOT",
+ this->CreateString(sysroot));
+ std::string archString;
+ for( std::vector<std::string>::iterator i = archs.begin();
+ i != archs.end(); ++i)
+ {
+ archString += *i;
+ archString += " ";
+ }
+ buildSettings->AddAttribute("ARCHS",
+ this->CreateString(archString.c_str()));
+ }
+ }
configDebug->AddAttribute("name", this->CreateString("Debug"));
configDebug->AddAttribute("buildSettings", buildSettings);
configRelease->AddAttribute("name", this->CreateString("Release"));
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 7a97cb4..82d4d03 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -40,6 +40,7 @@ cmLocalGenerator::cmLocalGenerator()
this->IgnoreLibPrefix = false;
this->UseRelativePaths = false;
this->Configured = false;
+ this->EmitUniversalBinaryFlags = true;
}
cmLocalGenerator::~cmLocalGenerator()
@@ -1378,6 +1379,30 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
std::string flagsVar = "CMAKE_";
flagsVar += lang;
flagsVar += "_FLAGS";
+ if(this->EmitUniversalBinaryFlags)
+ {
+ const char* osxArch =
+ this->Makefile->GetDefinition("CMAKE_OSX_ARCHITECTURES");
+ const char* sysroot =
+ this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT");
+ if(osxArch && sysroot && lang && lang[0] =='C')
+ {
+ std::vector<std::string> archs;
+ cmSystemTools::ExpandListArgument(std::string(osxArch),
+ archs);
+ if(archs.size() > 1)
+ {
+ for( std::vector<std::string>::iterator i = archs.begin();
+ i != archs.end(); ++i)
+ {
+ flags += " -arch ";
+ flags += *i;
+ }
+ flags += " -isysroot ";
+ flags += sysroot;
+ }
+ }
+ }
this->AddConfigVariableFlags(flags, flagsVar.c_str(), config);
}
@@ -1472,7 +1497,6 @@ void cmLocalGenerator::AddConfigVariableFlags(std::string& flags,
// Add the flags from the variable itself.
std::string flagsVar = var;
this->AppendFlags(flags, this->Makefile->GetDefinition(flagsVar.c_str()));
-
// Add the flags from the build-type specific variable.
if(config && *config)
{
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 1833d2d..9a1df74 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -261,7 +261,7 @@ protected:
bool UseRelativePaths;
bool IgnoreLibPrefix;
bool Configured;
-
+ bool EmitUniversalBinaryFlags;
// Hack for ExpandRuleVariable until object-oriented version is
// committed.
std::string TargetImplib;
diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx
index eb709b3..c7f6de5 100644
--- a/Source/cmLocalXCodeGenerator.cxx
+++ b/Source/cmLocalXCodeGenerator.cxx
@@ -2,6 +2,9 @@
cmLocalXCodeGenerator::cmLocalXCodeGenerator()
{
+ // the global generator does this, so do not
+ // put these flags into the language flags
+ this->EmitUniversalBinaryFlags = false;
}
cmLocalXCodeGenerator::~cmLocalXCodeGenerator()
diff --git a/Source/cmTryCompileCommand.cxx b/Source/cmTryCompileCommand.cxx
index 86353d2..1094664 100644
--- a/Source/cmTryCompileCommand.cxx
+++ b/Source/cmTryCompileCommand.cxx
@@ -231,7 +231,20 @@ int cmTryCompileCommand::CoreTryCompileCode(
// actually do the try compile now that everything is setup
int res = mf->TryCompile(sourceDirectory, binaryDirectory,
projectName, targetName, &cmakeFlags, &output);
-
+ // for the xcode generator
+ if(strcmp(mf->GetCMakeInstance()->GetGlobalGenerator()->GetName() ,
+ "Xcode") == 0)
+ {
+ int numTrys = 0;
+ while(output.find("/bin/sh: bad interpreter: Text file busy")
+ != output.npos && numTrys < 4)
+ {
+ output = "";
+ res = mf->TryCompile(sourceDirectory, binaryDirectory,
+ projectName, targetName, &cmakeFlags, &output);
+ numTrys++;
+ }
+ }
if ( erroroc )
{
cmSystemTools::SetErrorOccured();