Ninja: prepare msvc pdb cleanup
This commit is contained in:
parent
c478d55e31
commit
59cbc28b92
|
@ -459,23 +459,23 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string path;
|
|
||||||
if (!this->TargetNameImport.empty()) {
|
if (!this->TargetNameImport.empty()) {
|
||||||
path = this->GetLocalGenerator()->ConvertToOutputFormat(
|
const std::string impLibPath = this->GetLocalGenerator()
|
||||||
targetOutputImplib.c_str(), cmLocalGenerator::SHELL);
|
->ConvertToOutputFormat(targetOutputImplib.c_str(),
|
||||||
vars["TARGET_IMPLIB"] = path;
|
cmLocalGenerator::SHELL);
|
||||||
EnsureParentDirectoryExists(path);
|
vars["TARGET_IMPLIB"] = impLibPath;
|
||||||
|
EnsureParentDirectoryExists(impLibPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
cmMakefile* mf = this->GetMakefile();
|
cmMakefile* mf = this->GetMakefile();
|
||||||
if (mf->GetDefinition("MSVC_C_ARCHITECTURE_ID") ||
|
if (mf->GetDefinition("MSVC_C_ARCHITECTURE_ID") ||
|
||||||
mf->GetDefinition("MSVC_CXX_ARCHITECTURE_ID"))
|
mf->GetDefinition("MSVC_CXX_ARCHITECTURE_ID"))
|
||||||
{
|
{
|
||||||
path = this->GetTargetPDB();
|
const std::string pdbPath = this->GetTargetPDB();
|
||||||
vars["TARGET_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat(
|
vars["TARGET_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat(
|
||||||
ConvertToNinjaPath(path.c_str()).c_str(),
|
ConvertToNinjaPath(pdbPath.c_str()).c_str(),
|
||||||
cmLocalGenerator::SHELL);
|
cmLocalGenerator::SHELL);
|
||||||
EnsureParentDirectoryExists(path);
|
EnsureParentDirectoryExists(pdbPath);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -494,9 +494,9 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
||||||
|
|
||||||
if (mf->IsOn("CMAKE_COMPILER_IS_MINGW"))
|
if (mf->IsOn("CMAKE_COMPILER_IS_MINGW"))
|
||||||
{
|
{
|
||||||
path = GetTarget()->GetSupportDirectory();
|
const std::string objPath = GetTarget()->GetSupportDirectory();
|
||||||
vars["OBJECT_DIR"] = ConvertToNinjaPath(path.c_str());
|
vars["OBJECT_DIR"] = ConvertToNinjaPath(objPath.c_str());
|
||||||
EnsureDirectoryExists(path);
|
EnsureDirectoryExists(objPath);
|
||||||
// ar.exe can't handle backslashes in rsp files (implictly used by gcc)
|
// ar.exe can't handle backslashes in rsp files (implictly used by gcc)
|
||||||
std::string& linkLibraries = vars["LINK_LIBRARIES"];
|
std::string& linkLibraries = vars["LINK_LIBRARIES"];
|
||||||
std::replace(linkLibraries.begin(), linkLibraries.end(), '\\', '/');
|
std::replace(linkLibraries.begin(), linkLibraries.end(), '\\', '/');
|
||||||
|
@ -527,10 +527,10 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
||||||
// If we have any PRE_LINK commands, we need to go back to HOME_OUTPUT for
|
// If we have any PRE_LINK commands, we need to go back to HOME_OUTPUT for
|
||||||
// the link commands.
|
// the link commands.
|
||||||
if (!preLinkCmdLines.empty()) {
|
if (!preLinkCmdLines.empty()) {
|
||||||
path = this->GetLocalGenerator()->ConvertToOutputFormat(
|
const std::string homeOutDir = this->GetLocalGenerator()
|
||||||
this->GetMakefile()->GetHomeOutputDirectory(),
|
->ConvertToOutputFormat(this->GetMakefile()->GetHomeOutputDirectory(),
|
||||||
cmLocalGenerator::SHELL);
|
cmLocalGenerator::SHELL);
|
||||||
preLinkCmdLines.push_back("cd " + path);
|
preLinkCmdLines.push_back("cd " + homeOutDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
vars["PRE_LINK"] =
|
vars["PRE_LINK"] =
|
||||||
|
|
|
@ -542,9 +542,11 @@ cmNinjaTargetGenerator
|
||||||
if (mf->GetDefinition("MSVC_C_ARCHITECTURE_ID") ||
|
if (mf->GetDefinition("MSVC_C_ARCHITECTURE_ID") ||
|
||||||
mf->GetDefinition("MSVC_CXX_ARCHITECTURE_ID"))
|
mf->GetDefinition("MSVC_CXX_ARCHITECTURE_ID"))
|
||||||
{
|
{
|
||||||
|
const std::string pdbPath = this->GetTargetPDB();
|
||||||
vars["TARGET_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat(
|
vars["TARGET_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat(
|
||||||
ConvertToNinjaPath(GetTargetPDB().c_str()).c_str(),
|
ConvertToNinjaPath(pdbPath.c_str()).c_str(),
|
||||||
cmLocalGenerator::SHELL);
|
cmLocalGenerator::SHELL);
|
||||||
|
EnsureParentDirectoryExists(pdbPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this->Makefile->IsOn("CMAKE_EXPORT_COMPILE_COMMANDS"))
|
if(this->Makefile->IsOn("CMAKE_EXPORT_COMPILE_COMMANDS"))
|
||||||
|
|
Loading…
Reference in New Issue