Ninja:split out setting of msvc TARGET_PDB
This commit is contained in:
parent
59cbc28b92
commit
4bb4787780
|
@ -468,16 +468,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
||||||
}
|
}
|
||||||
|
|
||||||
cmMakefile* mf = this->GetMakefile();
|
cmMakefile* mf = this->GetMakefile();
|
||||||
if (mf->GetDefinition("MSVC_C_ARCHITECTURE_ID") ||
|
if (!this->SetMsvcTargetPdbVariable(vars))
|
||||||
mf->GetDefinition("MSVC_CXX_ARCHITECTURE_ID"))
|
|
||||||
{
|
|
||||||
const std::string pdbPath = this->GetTargetPDB();
|
|
||||||
vars["TARGET_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat(
|
|
||||||
ConvertToNinjaPath(pdbPath.c_str()).c_str(),
|
|
||||||
cmLocalGenerator::SHELL);
|
|
||||||
EnsureParentDirectoryExists(pdbPath);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
// It is common to place debug symbols at a specific place,
|
// It is common to place debug symbols at a specific place,
|
||||||
// so we need a plain target name in the rule available.
|
// so we need a plain target name in the rule available.
|
||||||
|
|
|
@ -311,6 +311,21 @@ std::string cmNinjaTargetGenerator::GetTargetPDB() const
|
||||||
return targetFullPathPDB.c_str();
|
return targetFullPathPDB.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cmNinjaTargetGenerator::SetMsvcTargetPdbVariable(cmNinjaVars& vars) const
|
||||||
|
{
|
||||||
|
cmMakefile* mf = this->GetMakefile();
|
||||||
|
if (mf->GetDefinition("MSVC_C_ARCHITECTURE_ID") ||
|
||||||
|
mf->GetDefinition("MSVC_CXX_ARCHITECTURE_ID"))
|
||||||
|
{
|
||||||
|
const std::string pdbPath = this->GetTargetPDB();
|
||||||
|
vars["TARGET_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat(
|
||||||
|
ConvertToNinjaPath(pdbPath.c_str()).c_str(),
|
||||||
|
cmLocalGenerator::SHELL);
|
||||||
|
EnsureParentDirectoryExists(pdbPath);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cmNinjaTargetGenerator
|
cmNinjaTargetGenerator
|
||||||
|
@ -537,17 +552,7 @@ cmNinjaTargetGenerator
|
||||||
vars["DEP_FILE"] = objectFileName + ".d";;
|
vars["DEP_FILE"] = objectFileName + ".d";;
|
||||||
EnsureParentDirectoryExists(objectFileName);
|
EnsureParentDirectoryExists(objectFileName);
|
||||||
|
|
||||||
// TODO move to GetTargetPDB
|
this->SetMsvcTargetPdbVariable(vars);
|
||||||
cmMakefile* mf = this->GetMakefile();
|
|
||||||
if (mf->GetDefinition("MSVC_C_ARCHITECTURE_ID") ||
|
|
||||||
mf->GetDefinition("MSVC_CXX_ARCHITECTURE_ID"))
|
|
||||||
{
|
|
||||||
const std::string pdbPath = this->GetTargetPDB();
|
|
||||||
vars["TARGET_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat(
|
|
||||||
ConvertToNinjaPath(pdbPath.c_str()).c_str(),
|
|
||||||
cmLocalGenerator::SHELL);
|
|
||||||
EnsureParentDirectoryExists(pdbPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this->Makefile->IsOn("CMAKE_EXPORT_COMPILE_COMMANDS"))
|
if(this->Makefile->IsOn("CMAKE_EXPORT_COMPILE_COMMANDS"))
|
||||||
{
|
{
|
||||||
|
@ -643,14 +648,14 @@ cmNinjaTargetGenerator
|
||||||
|
|
||||||
void
|
void
|
||||||
cmNinjaTargetGenerator
|
cmNinjaTargetGenerator
|
||||||
::EnsureDirectoryExists(const std::string& dir)
|
::EnsureDirectoryExists(const std::string& dir) const
|
||||||
{
|
{
|
||||||
cmSystemTools::MakeDirectory(dir.c_str());
|
cmSystemTools::MakeDirectory(dir.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cmNinjaTargetGenerator
|
cmNinjaTargetGenerator
|
||||||
::EnsureParentDirectoryExists(const std::string& path)
|
::EnsureParentDirectoryExists(const std::string& path) const
|
||||||
{
|
{
|
||||||
EnsureDirectoryExists(cmSystemTools::GetParentDirectory(path.c_str()));
|
EnsureDirectoryExists(cmSystemTools::GetParentDirectory(path.c_str()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,9 @@ public:
|
||||||
std::string GetTargetName() const;
|
std::string GetTargetName() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
bool SetMsvcTargetPdbVariable(cmNinjaVars&) const;
|
||||||
|
|
||||||
cmGeneratedFileStream& GetBuildFileStream() const;
|
cmGeneratedFileStream& GetBuildFileStream() const;
|
||||||
cmGeneratedFileStream& GetRulesFileStream() const;
|
cmGeneratedFileStream& GetRulesFileStream() const;
|
||||||
|
|
||||||
|
@ -112,8 +115,8 @@ protected:
|
||||||
// Helper to add flag for windows .def file.
|
// Helper to add flag for windows .def file.
|
||||||
void AddModuleDefinitionFlag(std::string& flags);
|
void AddModuleDefinitionFlag(std::string& flags);
|
||||||
|
|
||||||
void EnsureDirectoryExists(const std::string& dir);
|
void EnsureDirectoryExists(const std::string& dir) const;
|
||||||
void EnsureParentDirectoryExists(const std::string& path);
|
void EnsureParentDirectoryExists(const std::string& path) const;
|
||||||
|
|
||||||
// write rules for Mac OS X Application Bundle content.
|
// write rules for Mac OS X Application Bundle content.
|
||||||
struct MacOSXContentGeneratorType :
|
struct MacOSXContentGeneratorType :
|
||||||
|
|
Loading…
Reference in New Issue