Skip to content

Commit

Permalink
Ninja: Eclipse and KDevelop fixes for ninja
Browse files Browse the repository at this point in the history
Thx to Claus Klein
  • Loading branch information
syntheticpp committed Jun 15, 2012
1 parent 518c065 commit 2fb07fc
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 4 deletions.
6 changes: 4 additions & 2 deletions Source/cmExtraEclipseCDT4Generator.cxx
Expand Up @@ -33,6 +33,9 @@ ::cmExtraEclipseCDT4Generator() : cmExternalMakefileProjectGenerator()
this->SupportedGlobalGenerators.push_back("NMake Makefiles");
this->SupportedGlobalGenerators.push_back("MinGW Makefiles");
// this->SupportedGlobalGenerators.push_back("MSYS Makefiles");
#endif
#ifdef CMAKE_USE_NINJA
this->SupportedGlobalGenerators.push_back("Ninja");
#endif
this->SupportedGlobalGenerators.push_back("Unix Makefiles");

Expand Down Expand Up @@ -1067,9 +1070,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
}

//insert rules for compiling, preprocessing and assembling individual files
cmLocalUnixMakefileGenerator3* lumg=(cmLocalUnixMakefileGenerator3*)*it;
std::vector<std::string> objectFileTargets;
lumg->GetIndividualFileTargets(objectFileTargets);
(*it)->GetIndividualFileTargets(objectFileTargets);
for(std::vector<std::string>::const_iterator fit=objectFileTargets.begin();
fit != objectFileTargets.end();
++fit)
Expand Down
3 changes: 3 additions & 0 deletions Source/cmGlobalKdevelopGenerator.cxx
Expand Up @@ -44,6 +44,9 @@ cmGlobalKdevelopGenerator::cmGlobalKdevelopGenerator()
:cmExternalMakefileProjectGenerator()
{
this->SupportedGlobalGenerators.push_back("Unix Makefiles");
#ifdef CMAKE_USE_NINJA
this->SupportedGlobalGenerators.push_back("Ninja");
#endif
}

void cmGlobalKdevelopGenerator::Generate()
Expand Down
15 changes: 13 additions & 2 deletions Source/cmGlobalNinjaGenerator.cxx
Expand Up @@ -928,11 +928,22 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
cmNinjaDeps());
}

std::string cmGlobalNinjaGenerator::ninjaCmd() const
{
cmLocalGenerator* lgen = this->LocalGenerators[0];
if (lgen) {
return lgen->ConvertToOutputFormat(
lgen->GetMakefile()->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"),
cmLocalGenerator::SHELL);
}
return "ninja";
}

void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os)
{
WriteRule(*this->RulesFileStream,
"CLEAN",
"ninja -t clean",
(ninjaCmd() + " -t clean").c_str(),
"Cleaning all built files...",
"Rule for cleaning all built files.",
/*depfile=*/ "",
Expand All @@ -953,7 +964,7 @@ void cmGlobalNinjaGenerator::WriteTargetHelp(std::ostream& os)
{
WriteRule(*this->RulesFileStream,
"HELP",
"ninja -t targets",
(ninjaCmd() + " -t tagets").c_str(),
"All primary targets available:",
"Rule for printing all primary targets available.",
/*depfile=*/ "",
Expand Down
2 changes: 2 additions & 0 deletions Source/cmGlobalNinjaGenerator.h
Expand Up @@ -317,6 +317,8 @@ class cmGlobalNinjaGenerator : public cmGlobalGenerator
ASD.insert(deps.begin(), deps.end());
}

std::string cmGlobalNinjaGenerator::ninjaCmd() const;

private:
/// The file containing the build statement. (the relation ship of the
/// compilation DAG).
Expand Down
4 changes: 4 additions & 0 deletions Source/cmLocalGenerator.h
Expand Up @@ -204,6 +204,10 @@ class cmLocalGenerator
/** Compute the language used to compile the given source file. */
const char* GetSourceFileLanguage(const cmSourceFile& source);

// Fill the vector with the target names for the object files,
// preprocessed files and assembly files.
virtual void GetIndividualFileTargets(std::vector<std::string>& targets) {}

// Create a struct to hold the varibles passed into
// ExpandRuleVariables
struct RuleVariables
Expand Down

0 comments on commit 2fb07fc

Please sign in to comment.