cmGeneratorTarget: Move GetSupportDirectory from cmTarget.
This commit is contained in:
parent
526cc7dc52
commit
ce75c86ec3
|
@ -5512,3 +5512,18 @@ bool cmGeneratorTarget::HasImportLibrary() const
|
||||||
(this->GetType() == cmTarget::SHARED_LIBRARY ||
|
(this->GetType() == cmTarget::SHARED_LIBRARY ||
|
||||||
this->Target->IsExecutableWithExports()));
|
this->Target->IsExecutableWithExports()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
std::string cmGeneratorTarget::GetSupportDirectory() const
|
||||||
|
{
|
||||||
|
std::string dir = this->Makefile->GetCurrentBinaryDirectory();
|
||||||
|
dir += cmake::GetCMakeFilesDirectory();
|
||||||
|
dir += "/";
|
||||||
|
dir += this->GetName();
|
||||||
|
#if defined(__VMS)
|
||||||
|
dir += "_dir";
|
||||||
|
#else
|
||||||
|
dir += ".dir";
|
||||||
|
#endif
|
||||||
|
return dir;
|
||||||
|
}
|
||||||
|
|
|
@ -401,6 +401,9 @@ public:
|
||||||
/** Return whether or not the target has a DLL import library. */
|
/** Return whether or not the target has a DLL import library. */
|
||||||
bool HasImportLibrary() const;
|
bool HasImportLibrary() const;
|
||||||
|
|
||||||
|
/** Get a build-tree directory in which to place target support files. */
|
||||||
|
std::string GetSupportDirectory() const;
|
||||||
|
|
||||||
struct SourceFileFlags
|
struct SourceFileFlags
|
||||||
GetTargetSourceFileFlags(const cmSourceFile* sf) const;
|
GetTargetSourceFileFlags(const cmSourceFile* sf) const;
|
||||||
|
|
||||||
|
|
|
@ -2893,13 +2893,14 @@ void cmGlobalGenerator::WriteSummary()
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
this->WriteSummary(ti->second);
|
cmGeneratorTarget* gt = this->GetGeneratorTarget(ti->second);
|
||||||
fout << ti->second->GetSupportDirectory() << "\n";
|
this->WriteSummary(gt);
|
||||||
|
fout << gt->GetSupportDirectory() << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmGlobalGenerator::WriteSummary(cmTarget* target)
|
void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target)
|
||||||
{
|
{
|
||||||
// Place the labels file in a per-target support directory.
|
// Place the labels file in a per-target support directory.
|
||||||
std::string dir = target->GetSupportDirectory();
|
std::string dir = target->GetSupportDirectory();
|
||||||
|
@ -2942,17 +2943,15 @@ void cmGlobalGenerator::WriteSummary(cmTarget* target)
|
||||||
fout << "# Source files and their labels\n";
|
fout << "# Source files and their labels\n";
|
||||||
std::vector<cmSourceFile*> sources;
|
std::vector<cmSourceFile*> sources;
|
||||||
std::vector<std::string> configs;
|
std::vector<std::string> configs;
|
||||||
target->GetMakefile()->GetConfigurations(configs);
|
target->Target->GetMakefile()->GetConfigurations(configs);
|
||||||
if (configs.empty())
|
if (configs.empty())
|
||||||
{
|
{
|
||||||
configs.push_back("");
|
configs.push_back("");
|
||||||
}
|
}
|
||||||
cmGeneratorTarget* gt =
|
|
||||||
this->GetGeneratorTarget(target);
|
|
||||||
for(std::vector<std::string>::const_iterator ci = configs.begin();
|
for(std::vector<std::string>::const_iterator ci = configs.begin();
|
||||||
ci != configs.end(); ++ci)
|
ci != configs.end(); ++ci)
|
||||||
{
|
{
|
||||||
gt->GetSourceFiles(sources, *ci);
|
target->GetSourceFiles(sources, *ci);
|
||||||
}
|
}
|
||||||
std::vector<cmSourceFile*>::const_iterator sourcesEnd
|
std::vector<cmSourceFile*>::const_iterator sourcesEnd
|
||||||
= cmRemoveDuplicates(sources);
|
= cmRemoveDuplicates(sources);
|
||||||
|
|
|
@ -458,7 +458,7 @@ private:
|
||||||
void WriteRuleHashes(std::string const& pfile);
|
void WriteRuleHashes(std::string const& pfile);
|
||||||
|
|
||||||
void WriteSummary();
|
void WriteSummary();
|
||||||
void WriteSummary(cmTarget* target);
|
void WriteSummary(cmGeneratorTarget* target);
|
||||||
void FinalizeTargetCompileInfo();
|
void FinalizeTargetCompileInfo();
|
||||||
|
|
||||||
virtual void ForceLinkerLanguages();
|
virtual void ForceLinkerLanguages();
|
||||||
|
|
|
@ -361,7 +361,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
||||||
vars.CMTarget = this->Target;
|
vars.CMTarget = this->Target;
|
||||||
vars.Language = linkLanguage.c_str();
|
vars.Language = linkLanguage.c_str();
|
||||||
vars.Objects = buildObjs.c_str();
|
vars.Objects = buildObjs.c_str();
|
||||||
std::string objectDir = this->Target->GetSupportDirectory();
|
std::string objectDir = this->GeneratorTarget->GetSupportDirectory();
|
||||||
objectDir = this->Convert(objectDir,
|
objectDir = this->Convert(objectDir,
|
||||||
cmLocalGenerator::START_OUTPUT,
|
cmLocalGenerator::START_OUTPUT,
|
||||||
cmLocalGenerator::SHELL);
|
cmLocalGenerator::SHELL);
|
||||||
|
|
|
@ -572,7 +572,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
|
||||||
if(this->Target->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
|
if(this->Target->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
|
||||||
{
|
{
|
||||||
std::string name_of_def_file =
|
std::string name_of_def_file =
|
||||||
this->Target->GetSupportDirectory();
|
this->GeneratorTarget->GetSupportDirectory();
|
||||||
name_of_def_file += std::string("/") +
|
name_of_def_file += std::string("/") +
|
||||||
this->Target->GetName();
|
this->Target->GetName();
|
||||||
name_of_def_file += ".def";
|
name_of_def_file += ".def";
|
||||||
|
@ -643,7 +643,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
|
||||||
vars.CMTarget = this->Target;
|
vars.CMTarget = this->Target;
|
||||||
vars.Language = linkLanguage.c_str();
|
vars.Language = linkLanguage.c_str();
|
||||||
vars.Objects = buildObjs.c_str();
|
vars.Objects = buildObjs.c_str();
|
||||||
std::string objectDir = this->Target->GetSupportDirectory();
|
std::string objectDir = this->GeneratorTarget->GetSupportDirectory();
|
||||||
objectDir = this->Convert(objectDir,
|
objectDir = this->Convert(objectDir,
|
||||||
cmLocalGenerator::START_OUTPUT,
|
cmLocalGenerator::START_OUTPUT,
|
||||||
cmLocalGenerator::SHELL);
|
cmLocalGenerator::SHELL);
|
||||||
|
|
|
@ -557,7 +557,8 @@ cmMakefileTargetGenerator
|
||||||
this->GeneratorTarget->GetCompilePDBPath(this->ConfigName);
|
this->GeneratorTarget->GetCompilePDBPath(this->ConfigName);
|
||||||
if(targetFullPathCompilePDB.empty())
|
if(targetFullPathCompilePDB.empty())
|
||||||
{
|
{
|
||||||
targetFullPathCompilePDB = this->Target->GetSupportDirectory() + "/";
|
targetFullPathCompilePDB =
|
||||||
|
this->GeneratorTarget->GetSupportDirectory() + "/";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -594,7 +595,7 @@ cmMakefileTargetGenerator
|
||||||
cmLocalGenerator::NONE,
|
cmLocalGenerator::NONE,
|
||||||
cmLocalGenerator::SHELL);
|
cmLocalGenerator::SHELL);
|
||||||
vars.Object = shellObj.c_str();
|
vars.Object = shellObj.c_str();
|
||||||
std::string objectDir = this->Target->GetSupportDirectory();
|
std::string objectDir = this->GeneratorTarget->GetSupportDirectory();
|
||||||
objectDir = this->Convert(objectDir,
|
objectDir = this->Convert(objectDir,
|
||||||
cmLocalGenerator::START_OUTPUT,
|
cmLocalGenerator::START_OUTPUT,
|
||||||
cmLocalGenerator::SHELL);
|
cmLocalGenerator::SHELL);
|
||||||
|
|
|
@ -492,9 +492,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
||||||
{
|
{
|
||||||
if(target.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
|
if(target.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
|
||||||
{
|
{
|
||||||
std::string dllname = targetOutput;
|
|
||||||
std::string name_of_def_file
|
std::string name_of_def_file
|
||||||
= target.GetSupportDirectory();
|
= gt.GetSupportDirectory();
|
||||||
name_of_def_file += "/" + target.GetName();
|
name_of_def_file += "/" + target.GetName();
|
||||||
name_of_def_file += ".def ";
|
name_of_def_file += ".def ";
|
||||||
vars["LINK_FLAGS"] += " /DEF:";
|
vars["LINK_FLAGS"] += " /DEF:";
|
||||||
|
@ -582,7 +581,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
||||||
vars["TARGET_PDB"] = base + suffix + dbg_suffix;
|
vars["TARGET_PDB"] = base + suffix + dbg_suffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string objPath = GetTarget()->GetSupportDirectory();
|
const std::string objPath = GetGeneratorTarget()->GetSupportDirectory();
|
||||||
vars["OBJECT_DIR"] =
|
vars["OBJECT_DIR"] =
|
||||||
this->GetLocalGenerator()->ConvertToOutputFormat(
|
this->GetLocalGenerator()->ConvertToOutputFormat(
|
||||||
this->ConvertToNinjaPath(objPath), cmLocalGenerator::SHELL);
|
this->ConvertToNinjaPath(objPath), cmLocalGenerator::SHELL);
|
||||||
|
@ -634,7 +633,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
||||||
this->GetLocalGenerator()->ConvertToOutputFormat(
|
this->GetLocalGenerator()->ConvertToOutputFormat(
|
||||||
cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL);
|
cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL);
|
||||||
std::string name_of_def_file
|
std::string name_of_def_file
|
||||||
= target.GetSupportDirectory();
|
= gt.GetSupportDirectory();
|
||||||
name_of_def_file += "/" + target.GetName();
|
name_of_def_file += "/" + target.GetName();
|
||||||
name_of_def_file += ".def";
|
name_of_def_file += ".def";
|
||||||
std::string cmd = cmakeCommand;
|
std::string cmd = cmakeCommand;
|
||||||
|
|
|
@ -298,7 +298,7 @@ bool cmNinjaTargetGenerator::SetMsvcTargetPdbVariable(cmNinjaVars& vars) const
|
||||||
this->GeneratorTarget->GetCompilePDBPath(this->GetConfigName());
|
this->GeneratorTarget->GetCompilePDBPath(this->GetConfigName());
|
||||||
if(compilePdbPath.empty())
|
if(compilePdbPath.empty())
|
||||||
{
|
{
|
||||||
compilePdbPath = this->Target->GetSupportDirectory() + "/";
|
compilePdbPath = this->GeneratorTarget->GetSupportDirectory() + "/";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -567,7 +567,7 @@ cmNinjaTargetGenerator
|
||||||
std::string const language = source->GetLanguage();
|
std::string const language = source->GetLanguage();
|
||||||
std::string const sourceFileName =
|
std::string const sourceFileName =
|
||||||
language=="RC" ? source->GetFullPath() : this->GetSourceFilePath(source);
|
language=="RC" ? source->GetFullPath() : this->GetSourceFilePath(source);
|
||||||
std::string const objectDir = this->Target->GetSupportDirectory();
|
std::string const objectDir = this->GeneratorTarget->GetSupportDirectory();
|
||||||
std::string const objectFileName = this->GetObjectFilePath(source);
|
std::string const objectFileName = this->GetObjectFilePath(source);
|
||||||
std::string const objectFileDir =
|
std::string const objectFileDir =
|
||||||
cmSystemTools::GetFilenamePath(objectFileName);
|
cmSystemTools::GetFilenamePath(objectFileName);
|
||||||
|
|
|
@ -64,7 +64,7 @@ static void SetupSourceFiles(cmGeneratorTarget const* target,
|
||||||
std::string basename = cmsys::SystemTools::
|
std::string basename = cmsys::SystemTools::
|
||||||
GetFilenameWithoutLastExtension(absFile);
|
GetFilenameWithoutLastExtension(absFile);
|
||||||
|
|
||||||
std::string rcc_output_dir = target->Target->GetSupportDirectory();
|
std::string rcc_output_dir = target->GetSupportDirectory();
|
||||||
cmSystemTools::MakeDirectory(rcc_output_dir.c_str());
|
cmSystemTools::MakeDirectory(rcc_output_dir.c_str());
|
||||||
std::string rcc_output_file = rcc_output_dir;
|
std::string rcc_output_file = rcc_output_dir;
|
||||||
rcc_output_file += "/qrc_" + basename + ".cpp";
|
rcc_output_file += "/qrc_" + basename + ".cpp";
|
||||||
|
@ -833,7 +833,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
|
||||||
std::string basename = cmsys::SystemTools::
|
std::string basename = cmsys::SystemTools::
|
||||||
GetFilenameWithoutLastExtension(absFile);
|
GetFilenameWithoutLastExtension(absFile);
|
||||||
|
|
||||||
std::string rcc_output_dir = target->Target->GetSupportDirectory();
|
std::string rcc_output_dir = target->GetSupportDirectory();
|
||||||
cmSystemTools::MakeDirectory(rcc_output_dir.c_str());
|
cmSystemTools::MakeDirectory(rcc_output_dir.c_str());
|
||||||
std::string rcc_output_file = rcc_output_dir;
|
std::string rcc_output_file = rcc_output_dir;
|
||||||
rcc_output_file += "/qrc_" + basename + ".cpp";
|
rcc_output_file += "/qrc_" + basename + ".cpp";
|
||||||
|
|
|
@ -381,21 +381,6 @@ cmListFileBacktrace const& cmTarget::GetBacktrace() const
|
||||||
return this->Internal->Backtrace;
|
return this->Internal->Backtrace;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
std::string cmTarget::GetSupportDirectory() const
|
|
||||||
{
|
|
||||||
std::string dir = this->Makefile->GetCurrentBinaryDirectory();
|
|
||||||
dir += cmake::GetCMakeFilesDirectory();
|
|
||||||
dir += "/";
|
|
||||||
dir += this->Name;
|
|
||||||
#if defined(__VMS)
|
|
||||||
dir += "_dir";
|
|
||||||
#else
|
|
||||||
dir += ".dir";
|
|
||||||
#endif
|
|
||||||
return dir;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool cmTarget::IsExecutableWithExports() const
|
bool cmTarget::IsExecutableWithExports() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -282,9 +282,6 @@ public:
|
||||||
/** Get a backtrace from the creation of the target. */
|
/** Get a backtrace from the creation of the target. */
|
||||||
cmListFileBacktrace const& GetBacktrace() const;
|
cmListFileBacktrace const& GetBacktrace() const;
|
||||||
|
|
||||||
/** Get a build-tree directory in which to place target support files. */
|
|
||||||
std::string GetSupportDirectory() const;
|
|
||||||
|
|
||||||
/** @return whether this target have a well defined output file name. */
|
/** @return whether this target have a well defined output file name. */
|
||||||
bool HaveWellDefinedOutputFiles() const;
|
bool HaveWellDefinedOutputFiles() const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue