summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorJohan Björk <phb@spotify.com>2011-07-26 21:13:42 (GMT)
committerDavid Cole <david.cole@kitware.com>2011-08-04 20:31:45 (GMT)
commit312d68d5b195255356b444f34be50552bc8981d4 (patch)
treeeeada08aca05442daf88aa444801e5d58166e79b /Source
parent14e54c4c449e2704799ab5283c6c6764472d5a0a (diff)
downloadCMake-312d68d5b195255356b444f34be50552bc8981d4.zip
CMake-312d68d5b195255356b444f34be50552bc8981d4.tar.gz
CMake-312d68d5b195255356b444f34be50552bc8981d4.tar.bz2
Xcode: Rearrange CMakeReRun to enable parallel builds
by isolating the CMakeReRun steps to a ZERO_CHECK target, as in the Visual Studio generators. Also, honor the value of CMAKE_SUPPRESS_REGENERATION.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx45
1 files changed, 23 insertions, 22 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index b3e2e7a..fd9dacd 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -336,6 +336,9 @@ cmGlobalXCodeGenerator::PostBuildMakeTarget(std::string const& tName,
}
//----------------------------------------------------------------------------
+#define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK"
+
+//----------------------------------------------------------------------------
void
cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& gens)
@@ -366,8 +369,18 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
makecommand.push_back(this->CurrentXCodeHackMakefile.c_str());
makecommand.push_back(""); // placeholder, see below
- // Add Re-Run CMake rules
- this->CreateReRunCMakeFile(root, gens);
+ // Add ZERO_CHECK
+ bool regenerate = !mf->IsOn("CMAKE_SUPPRESS_REGENERATION");
+ if (regenerate)
+ {
+ this->CreateReRunCMakeFile(root, gens);
+ std::string file = this->ConvertToRelativeForMake(
+ this->CurrentReRunCMakeMakefile.c_str());
+ cmSystemTools::ReplaceString(file, "\\ ", " ");
+ mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, true, no_depends,
+ no_working_directory,
+ "make", "-f", file.c_str());
+ }
// now make the allbuild depend on all the non-utility targets
// in the project
@@ -379,10 +392,17 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
{
continue;
}
+
cmTargets& tgts = lg->GetMakefile()->GetTargets();
for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++)
{
cmTarget& target = l->second;
+
+ if (regenerate && (l->first != CMAKE_CHECK_BUILD_SYSTEM_TARGET))
+ {
+ target.AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET);
+ }
+
// make all exe, shared libs and modules
// run the depend check makefile as a post build rule
// this will make sure that when the next target is built
@@ -402,8 +422,8 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
cmTarget::POST_BUILD,
"Depend check for xcode",
dir.c_str());
-
}
+
if(!target.GetPropertyAsBool("EXCLUDE_FROM_ALL"))
{
allbuild->AddUtility(target.GetName());
@@ -1114,11 +1134,6 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases,
commands.push_back(*(*i)->GetCustomCommand());
}
}
- std::vector<cmCustomCommand> reruncom;
- cmXCodeObject* cmakeReRunPhase =
- this->CreateBuildPhase("CMake ReRun", "cmakeReRunPhase",
- cmtarget, reruncom);
- buildPhases->AddObject(cmakeReRunPhase);
// create prebuild phase
cmXCodeObject* cmakeRulesBuildPhase =
this->CreateBuildPhase("CMake Rules",
@@ -1207,20 +1222,6 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase,
const & commands,
const char* name)
{
- if(strcmp(name, "cmakeReRunPhase") == 0)
- {
- std::string cdir = this->CurrentMakefile->GetHomeOutputDirectory();
- cdir = this->ConvertToRelativeForMake(cdir.c_str());
- std::string makecmd = "make -C ";
- makecmd += cdir;
- makecmd += " -f ";
- makecmd +=
- this->ConvertToRelativeForMake(this->CurrentReRunCMakeMakefile.c_str());
- cmSystemTools::ReplaceString(makecmd, "\\ ", "\\\\ ");
- buildphase->AddAttribute("shellScript",
- this->CreateString(makecmd.c_str()));
- return;
- }
// collect multiple outputs of custom commands into a set
// which will be used for every configuration