Commit 2fb07fc4 authored by Peter Kuemmel's avatar Peter Kuemmel
Browse files

Ninja: Eclipse and KDevelop fixes for ninja

Thx to Claus Klein
parent 518c0658
...@@ -33,6 +33,9 @@ cmExtraEclipseCDT4Generator ...@@ -33,6 +33,9 @@ cmExtraEclipseCDT4Generator
this->SupportedGlobalGenerators.push_back("NMake Makefiles"); this->SupportedGlobalGenerators.push_back("NMake Makefiles");
this->SupportedGlobalGenerators.push_back("MinGW Makefiles"); this->SupportedGlobalGenerators.push_back("MinGW Makefiles");
// this->SupportedGlobalGenerators.push_back("MSYS Makefiles"); // this->SupportedGlobalGenerators.push_back("MSYS Makefiles");
#endif
#ifdef CMAKE_USE_NINJA
this->SupportedGlobalGenerators.push_back("Ninja");
#endif #endif
this->SupportedGlobalGenerators.push_back("Unix Makefiles"); this->SupportedGlobalGenerators.push_back("Unix Makefiles");
...@@ -1067,9 +1070,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const ...@@ -1067,9 +1070,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
} }
//insert rules for compiling, preprocessing and assembling individual files //insert rules for compiling, preprocessing and assembling individual files
cmLocalUnixMakefileGenerator3* lumg=(cmLocalUnixMakefileGenerator3*)*it;
std::vector<std::string> objectFileTargets; std::vector<std::string> objectFileTargets;
lumg->GetIndividualFileTargets(objectFileTargets); (*it)->GetIndividualFileTargets(objectFileTargets);
for(std::vector<std::string>::const_iterator fit=objectFileTargets.begin(); for(std::vector<std::string>::const_iterator fit=objectFileTargets.begin();
fit != objectFileTargets.end(); fit != objectFileTargets.end();
++fit) ++fit)
......
...@@ -44,6 +44,9 @@ cmGlobalKdevelopGenerator::cmGlobalKdevelopGenerator() ...@@ -44,6 +44,9 @@ cmGlobalKdevelopGenerator::cmGlobalKdevelopGenerator()
:cmExternalMakefileProjectGenerator() :cmExternalMakefileProjectGenerator()
{ {
this->SupportedGlobalGenerators.push_back("Unix Makefiles"); this->SupportedGlobalGenerators.push_back("Unix Makefiles");
#ifdef CMAKE_USE_NINJA
this->SupportedGlobalGenerators.push_back("Ninja");
#endif
} }
void cmGlobalKdevelopGenerator::Generate() void cmGlobalKdevelopGenerator::Generate()
......
...@@ -928,11 +928,22 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os) ...@@ -928,11 +928,22 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
cmNinjaDeps()); 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) void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os)
{ {
WriteRule(*this->RulesFileStream, WriteRule(*this->RulesFileStream,
"CLEAN", "CLEAN",
"ninja -t clean", (ninjaCmd() + " -t clean").c_str(),
"Cleaning all built files...", "Cleaning all built files...",
"Rule for cleaning all built files.", "Rule for cleaning all built files.",
/*depfile=*/ "", /*depfile=*/ "",
...@@ -953,7 +964,7 @@ void cmGlobalNinjaGenerator::WriteTargetHelp(std::ostream& os) ...@@ -953,7 +964,7 @@ void cmGlobalNinjaGenerator::WriteTargetHelp(std::ostream& os)
{ {
WriteRule(*this->RulesFileStream, WriteRule(*this->RulesFileStream,
"HELP", "HELP",
"ninja -t targets", (ninjaCmd() + " -t tagets").c_str(),
"All primary targets available:", "All primary targets available:",
"Rule for printing all primary targets available.", "Rule for printing all primary targets available.",
/*depfile=*/ "", /*depfile=*/ "",
......
...@@ -317,6 +317,8 @@ private: ...@@ -317,6 +317,8 @@ private:
ASD.insert(deps.begin(), deps.end()); ASD.insert(deps.begin(), deps.end());
} }
std::string cmGlobalNinjaGenerator::ninjaCmd() const;
private: private:
/// The file containing the build statement. (the relation ship of the /// The file containing the build statement. (the relation ship of the
/// compilation DAG). /// compilation DAG).
......
...@@ -204,6 +204,10 @@ public: ...@@ -204,6 +204,10 @@ public:
/** Compute the language used to compile the given source file. */ /** Compute the language used to compile the given source file. */
const char* GetSourceFileLanguage(const cmSourceFile& source); 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 // Create a struct to hold the varibles passed into
// ExpandRuleVariables // ExpandRuleVariables
struct RuleVariables struct RuleVariables
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment