From f403811a0c91c5186736e88951f16a94cdff40dc Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Tue, 1 Feb 2005 17:17:12 -0500 Subject: [PATCH] ENH: closer --- Source/cmGlobalXCodeGenerator.cxx | 30 ++++++++++++++++++++---------- Source/cmGlobalXCodeGenerator.h | 1 + 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 2499aff92..7968f7daa 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -65,7 +65,6 @@ int cmGlobalXCodeGenerator::TryCompile(const char *, */ std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); cmSystemTools::ChangeDirectory(bindir); - std::cerr << "ChangeDirectory " << bindir << "\n"; // Usage: xcodebuild [-project ] [-activetarget] // [-alltargets] [-target ]... [-activebuildstyle] // [-buildstyle ] [-optionalbuildstyle ] @@ -82,6 +81,8 @@ int cmGlobalXCodeGenerator::TryCompile(const char *, makeCommand += targetName; } makeCommand += " -buildstyle Development "; + makeCommand += " SYMROOT="; + makeCommand += cmSystemTools::ConvertToOutputPath(bindir); int retVal; int timeout = cmGlobalGenerator::s_TryCompileTimeout; if (!cmSystemTools::RunSingleCommand(makeCommand.c_str(), output, &retVal, @@ -92,8 +93,6 @@ int cmGlobalXCodeGenerator::TryCompile(const char *, cmSystemTools::ChangeDirectory(cwd.c_str()); return 1; } - std::cerr << makeCommand << "\n"; - std::cerr << "build worked " << retVal << "\n";; cmSystemTools::ChangeDirectory(cwd.c_str()); return retVal; } @@ -172,12 +171,19 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg, cmXCodeObject* settings = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); buildFile->AddAttribute("settings", settings); fileRef->AddAttribute("fileEncoding", this->CreateString("4")); - std::string lang = + const char* lang = this->GetLanguageFromExtension(sf->GetSourceExtension().c_str()); std::string sourcecode = "sourcecode"; - if(lang == "C") + if(!lang) { - sourcecode += ".c.c"; + std::string ext = "."; + ext = sf->GetSourceExtension(); + sourcecode += ext; + sourcecode += ext; + } + else if(strcmp(lang, "C") == 0) + { + sourcecode += ".c.c"; } // default to c++ else @@ -199,6 +205,7 @@ void cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, std::vector& targets, cmXCodeObject* mainGroupChildren) { + m_CurrentMakefile = gen->GetMakefile(); cmTargets &tgts = gen->GetMakefile()->GetTargets(); for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++) { @@ -289,8 +296,9 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateExecutable(cmTarget& cmtarget, this->CreateString("/usr/local/bin")); buildSettings->AddAttribute("OPTIMIZATION_CFLAGS", this->CreateString("")); + std::cerr << m_CurrentMakefile->GetDefineFlags() << "\n"; buildSettings->AddAttribute("OTHER_CFLAGS", - this->CreateString("")); + this->CreateString(m_CurrentMakefile->GetDefineFlags())); buildSettings->AddAttribute("OTHER_LDFLAGS", this->CreateString("")); buildSettings->AddAttribute("OTHER_REZFLAGS", @@ -335,8 +343,9 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateStaticLibrary(cmTarget& cmtarget, this->CreateString("STATIC")); buildSettings->AddAttribute("OPTIMIZATION_CFLAGS", this->CreateString("")); + std::cerr << m_CurrentMakefile->GetDefineFlags() << "\n"; buildSettings->AddAttribute("OTHER_CFLAGS", - this->CreateString("")); + this->CreateString(m_CurrentMakefile->GetDefineFlags())); buildSettings->AddAttribute("OTHER_LDFLAGS", this->CreateString("")); buildSettings->AddAttribute("OTHER_REZFLAGS", @@ -385,8 +394,9 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateSharedLibrary(cmTarget& cmtarget, this->CreateString("DYNAMIC")); buildSettings->AddAttribute("OPTIMIZATION_CFLAGS", this->CreateString("")); + std::cerr << m_CurrentMakefile->GetDefineFlags() << "\n" ; buildSettings->AddAttribute("OTHER_CFLAGS", - this->CreateString("")); + this->CreateString(m_CurrentMakefile->GetDefineFlags())); const char* libFlag = "-dynamiclib"; if(cmtarget.GetType() == cmTarget::MODULE_LIBRARY) { @@ -429,8 +439,8 @@ void cmGlobalXCodeGenerator::CreateXCodeObjects(cmLocalGenerator* , generators ) { - delete m_RootObject; this->ClearXCodeObjects(); + m_RootObject = 0; cmXCodeObject* group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); group->AddAttribute("COPY_PHASE_STRIP", this->CreateString("NO")); cmXCodeObject* developBuildStyle = this->CreateObject(cmXCodeObject::PBXBuildStyle); diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 93fbb45bb..97c50af1b 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -93,6 +93,7 @@ private: std::vector m_XCodeObjects; cmXCodeObject* m_RootObject; + cmMakefile* m_CurrentMakefile; }; #endif