kate: fix ninja support
ninja needs to be run from the toplevel build dir, not from the target dir, as make Alex
This commit is contained in:
parent
1eaf2f263b
commit
c3d20c2ac9
|
@ -52,6 +52,8 @@ void cmExtraKateGenerator::Generate()
|
||||||
this->ProjectName = this->GenerateProjectName(mf->GetProjectName(),
|
this->ProjectName = this->GenerateProjectName(mf->GetProjectName(),
|
||||||
mf->GetSafeDefinition("CMAKE_BUILD_TYPE"),
|
mf->GetSafeDefinition("CMAKE_BUILD_TYPE"),
|
||||||
this->GetPathBasename(mf->GetHomeOutputDirectory()));
|
this->GetPathBasename(mf->GetHomeOutputDirectory()));
|
||||||
|
this->UseNinja = (strcmp(this->GlobalGenerator->GetName(), "Ninja")==0);
|
||||||
|
|
||||||
this->CreateKateProjectFile(mf);
|
this->CreateKateProjectFile(mf);
|
||||||
this->CreateDummyKateProjectFile(mf);
|
this->CreateDummyKateProjectFile(mf);
|
||||||
}
|
}
|
||||||
|
@ -95,11 +97,12 @@ cmExtraKateGenerator::WriteTargets(const cmMakefile* mf,
|
||||||
const std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
|
const std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
|
||||||
const std::string makeArgs = mf->GetSafeDefinition(
|
const std::string makeArgs = mf->GetSafeDefinition(
|
||||||
"CMAKE_KATE_MAKE_ARGUMENTS");
|
"CMAKE_KATE_MAKE_ARGUMENTS");
|
||||||
|
const char* homeOutputDir = mf->GetHomeOutputDirectory();
|
||||||
|
|
||||||
this->AppendTarget(fout, "all", make, makeArgs,
|
this->AppendTarget(fout, "all", make, makeArgs,
|
||||||
mf->GetHomeOutputDirectory());
|
homeOutputDir, homeOutputDir);
|
||||||
this->AppendTarget(fout, "clean", make, makeArgs,
|
this->AppendTarget(fout, "clean", make, makeArgs,
|
||||||
mf->GetHomeOutputDirectory());
|
homeOutputDir, homeOutputDir);
|
||||||
|
|
||||||
// add all executable and library targets and some of the GLOBAL
|
// add all executable and library targets and some of the GLOBAL
|
||||||
// and UTILITY targets
|
// and UTILITY targets
|
||||||
|
@ -143,7 +146,8 @@ cmExtraKateGenerator::WriteTargets(const cmMakefile* mf,
|
||||||
}
|
}
|
||||||
if (insertTarget)
|
if (insertTarget)
|
||||||
{
|
{
|
||||||
this->AppendTarget(fout, ti->first, make, makeArgs, currentDir);
|
this->AppendTarget(fout, ti->first, make, makeArgs,
|
||||||
|
currentDir, homeOutputDir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -158,7 +162,8 @@ cmExtraKateGenerator::WriteTargets(const cmMakefile* mf,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->AppendTarget(fout, ti->first, make, makeArgs, currentDir);
|
this->AppendTarget(fout, ti->first, make, makeArgs,
|
||||||
|
currentDir, homeOutputDir);
|
||||||
break;
|
break;
|
||||||
case cmTarget::EXECUTABLE:
|
case cmTarget::EXECUTABLE:
|
||||||
case cmTarget::STATIC_LIBRARY:
|
case cmTarget::STATIC_LIBRARY:
|
||||||
|
@ -166,10 +171,12 @@ cmExtraKateGenerator::WriteTargets(const cmMakefile* mf,
|
||||||
case cmTarget::MODULE_LIBRARY:
|
case cmTarget::MODULE_LIBRARY:
|
||||||
case cmTarget::OBJECT_LIBRARY:
|
case cmTarget::OBJECT_LIBRARY:
|
||||||
{
|
{
|
||||||
this->AppendTarget(fout, ti->first, make, makeArgs, currentDir);
|
this->AppendTarget(fout, ti->first, make, makeArgs,
|
||||||
|
currentDir, homeOutputDir);
|
||||||
std::string fastTarget = ti->first;
|
std::string fastTarget = ti->first;
|
||||||
fastTarget += "/fast";
|
fastTarget += "/fast";
|
||||||
this->AppendTarget(fout, fastTarget, make, makeArgs, currentDir);
|
this->AppendTarget(fout, fastTarget, make, makeArgs,
|
||||||
|
currentDir, homeOutputDir);
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -185,7 +192,7 @@ cmExtraKateGenerator::WriteTargets(const cmMakefile* mf,
|
||||||
fit != objectFileTargets.end();
|
fit != objectFileTargets.end();
|
||||||
++fit)
|
++fit)
|
||||||
{
|
{
|
||||||
this->AppendTarget(fout, *fit, make, makeArgs, currentDir);
|
this->AppendTarget(fout, *fit, make, makeArgs, currentDir,homeOutputDir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,14 +206,18 @@ cmExtraKateGenerator::AppendTarget(cmGeneratedFileStream& fout,
|
||||||
const std::string& target,
|
const std::string& target,
|
||||||
const std::string& make,
|
const std::string& make,
|
||||||
const std::string& makeArgs,
|
const std::string& makeArgs,
|
||||||
const std::string& path) const
|
const std::string& path,
|
||||||
|
const char* homeOutputDir
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
static char JsonSep = ' ';
|
static char JsonSep = ' ';
|
||||||
|
|
||||||
fout <<
|
fout <<
|
||||||
"\t\t\t" << JsonSep << "{\"name\":\"" << target << "\", "
|
"\t\t\t" << JsonSep << "{\"name\":\"" << target << "\", "
|
||||||
"\"build_cmd\":\"" << make << " -C " << path << " " << makeArgs << " "
|
"\"build_cmd\":\"" << make
|
||||||
<< target << "\"}\n";
|
<< " -C " << (this->UseNinja ? homeOutputDir : path.c_str())
|
||||||
|
<< " " << makeArgs << " "
|
||||||
|
<< target << "\"}\n";
|
||||||
|
|
||||||
JsonSep = ',';
|
JsonSep = ',';
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,8 @@ private:
|
||||||
const std::string& target,
|
const std::string& target,
|
||||||
const std::string& make,
|
const std::string& make,
|
||||||
const std::string& makeArgs,
|
const std::string& makeArgs,
|
||||||
const std::string& path) const;
|
const std::string& path,
|
||||||
|
const char* homeOutputDir) const;
|
||||||
|
|
||||||
std::string GenerateFilesString(const cmMakefile* mf) const;
|
std::string GenerateFilesString(const cmMakefile* mf) const;
|
||||||
std::string GetPathBasename(const std::string& path) const;
|
std::string GetPathBasename(const std::string& path) const;
|
||||||
|
@ -55,6 +56,7 @@ private:
|
||||||
const std::string& path) const;
|
const std::string& path) const;
|
||||||
|
|
||||||
std::string ProjectName;
|
std::string ProjectName;
|
||||||
|
bool UseNinja;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue