Xcode: Set object file locations using TARGET_TEMP_DIR
This avoids relying on `SYMROOT` to locate the object files. Issue: #22550
This commit is contained in:
parent
a7fb4bc475
commit
dc5fc898f6
@ -5454,9 +5454,6 @@ std::string cmGeneratorTarget::GetObjectDirectory(
|
|||||||
std::string obj_dir =
|
std::string obj_dir =
|
||||||
this->GlobalGenerator->ExpandCFGIntDir(this->ObjectDirectory, config);
|
this->GlobalGenerator->ExpandCFGIntDir(this->ObjectDirectory, config);
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
// find and replace $(PROJECT_NAME) xcode placeholder
|
|
||||||
const std::string projectName = this->LocalGenerator->GetProjectName();
|
|
||||||
cmSystemTools::ReplaceString(obj_dir, "$(PROJECT_NAME)", projectName);
|
|
||||||
// Replace Xcode's placeholder for the object file directory since
|
// Replace Xcode's placeholder for the object file directory since
|
||||||
// installation and export scripts need to know the real directory.
|
// installation and export scripts need to know the real directory.
|
||||||
// Xcode has build-time settings (e.g. for sanitizers) that affect this,
|
// Xcode has build-time settings (e.g. for sanitizers) that affect this,
|
||||||
|
@ -607,7 +607,6 @@ std::string cmGlobalXCodeGenerator::PostBuildMakeTarget(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK"
|
#define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK"
|
||||||
#define OBJECT_LIBRARY_ARTIFACT_DIR std::string()
|
|
||||||
|
|
||||||
void cmGlobalXCodeGenerator::AddExtraTargets(
|
void cmGlobalXCodeGenerator::AddExtraTargets(
|
||||||
cmLocalGenerator* root, std::vector<cmLocalGenerator*>& gens)
|
cmLocalGenerator* root, std::vector<cmLocalGenerator*>& gens)
|
||||||
@ -2519,11 +2518,14 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (gtgt->CanCompileSources()) {
|
if (gtgt->CanCompileSources()) {
|
||||||
|
std::string tmpDir =
|
||||||
|
cmStrCat(gtgt->GetSupportDirectory(), '/', this->GetCMakeCFGIntDir());
|
||||||
|
buildSettings->AddAttribute("TARGET_TEMP_DIR", this->CreateString(tmpDir));
|
||||||
|
|
||||||
std::string outDir;
|
std::string outDir;
|
||||||
if (gtgt->GetType() == cmStateEnums::OBJECT_LIBRARY) {
|
if (gtgt->GetType() == cmStateEnums::OBJECT_LIBRARY) {
|
||||||
// We cannot suppress the archive, so hide it with intermediate files.
|
// We cannot suppress the archive, so hide it with intermediate files.
|
||||||
outDir = this->GetObjectsDirectory(this->CurrentProject, configName,
|
outDir = tmpDir;
|
||||||
gtgt, OBJECT_LIBRARY_ARTIFACT_DIR);
|
|
||||||
} else {
|
} else {
|
||||||
outDir = gtgt->GetDirectory(configName);
|
outDir = gtgt->GetDirectory(configName);
|
||||||
}
|
}
|
||||||
@ -4463,16 +4465,6 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string cmGlobalXCodeGenerator::GetObjectsDirectory(
|
|
||||||
const std::string& projName, const std::string& configName,
|
|
||||||
const cmGeneratorTarget* t, const std::string& variant) const
|
|
||||||
{
|
|
||||||
std::string dir = cmStrCat(
|
|
||||||
t->GetLocalGenerator()->GetCurrentBinaryDirectory(), '/', projName,
|
|
||||||
".build/", configName, '/', t->GetName(), ".build/", variant);
|
|
||||||
return dir;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cmGlobalXCodeGenerator::ComputeArchitectures(cmMakefile* mf)
|
void cmGlobalXCodeGenerator::ComputeArchitectures(cmMakefile* mf)
|
||||||
{
|
{
|
||||||
this->Architectures.clear();
|
this->Architectures.clear();
|
||||||
@ -4596,10 +4588,8 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile(
|
|||||||
for (auto objLib : objlibs) {
|
for (auto objLib : objlibs) {
|
||||||
|
|
||||||
const std::string objLibName = objLib->GetName();
|
const std::string objLibName = objLib->GetName();
|
||||||
std::string d = cmStrCat(
|
std::string d = cmStrCat(objLib->GetSupportDirectory(), '/',
|
||||||
this->GetObjectsDirectory(this->CurrentProject, configName, objLib,
|
configName, "/lib", objLibName, ".a");
|
||||||
OBJECT_LIBRARY_ARTIFACT_DIR),
|
|
||||||
"lib", objLibName, ".a");
|
|
||||||
|
|
||||||
std::string dependency = this->ConvertToRelativeForMake(d);
|
std::string dependency = this->ConvertToRelativeForMake(d);
|
||||||
makefileStream << "\\\n\t" << dependency;
|
makefileStream << "\\\n\t" << dependency;
|
||||||
@ -4613,8 +4603,8 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile(
|
|||||||
// if building for more than one architecture
|
// if building for more than one architecture
|
||||||
// then remove those executables as well
|
// then remove those executables as well
|
||||||
if (this->Architectures.size() > 1) {
|
if (this->Architectures.size() > 1) {
|
||||||
std::string universal = this->GetObjectsDirectory(
|
std::string universal = cmStrCat(gt->GetSupportDirectory(), '/',
|
||||||
this->CurrentProject, configName, gt, "$(OBJDIR)/");
|
configName, "/$(OBJDIR)/");
|
||||||
for (const auto& architecture : this->Architectures) {
|
for (const auto& architecture : this->Architectures) {
|
||||||
std::string universalFile = cmStrCat(universal, architecture, '/',
|
std::string universalFile = cmStrCat(universal, architecture, '/',
|
||||||
gt->GetFullName(configName));
|
gt->GetFullName(configName));
|
||||||
@ -5011,14 +5001,10 @@ bool cmGlobalXCodeGenerator::ShouldStripResourcePath(cmMakefile*) const
|
|||||||
void cmGlobalXCodeGenerator::ComputeTargetObjectDirectory(
|
void cmGlobalXCodeGenerator::ComputeTargetObjectDirectory(
|
||||||
cmGeneratorTarget* gt) const
|
cmGeneratorTarget* gt) const
|
||||||
{
|
{
|
||||||
std::string configName = this->GetCMakeCFGIntDir();
|
|
||||||
auto objectDirArch = GetTargetObjectDirArch(*gt, this->ObjectDirArch);
|
auto objectDirArch = GetTargetObjectDirArch(*gt, this->ObjectDirArch);
|
||||||
|
gt->ObjectDirectory =
|
||||||
std::string dir =
|
cmStrCat(gt->GetSupportDirectory(), '/', this->GetCMakeCFGIntDir(),
|
||||||
cmStrCat(this->GetObjectsDirectory("$(PROJECT_NAME)", configName, gt,
|
"/$(OBJECT_FILE_DIR_normal:base)/", objectDirArch, '/');
|
||||||
"$(OBJECT_FILE_DIR_normal:base)/"),
|
|
||||||
objectDirArch, '/');
|
|
||||||
gt->ObjectDirectory = dir;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string cmGlobalXCodeGenerator::GetDeploymentPlatform(const cmMakefile* mf)
|
std::string cmGlobalXCodeGenerator::GetDeploymentPlatform(const cmMakefile* mf)
|
||||||
|
@ -339,11 +339,6 @@ private:
|
|||||||
|
|
||||||
std::string GetLibraryOrFrameworkPath(const std::string& path) const;
|
std::string GetLibraryOrFrameworkPath(const std::string& path) const;
|
||||||
|
|
||||||
std::string GetObjectsDirectory(const std::string& projName,
|
|
||||||
const std::string& configName,
|
|
||||||
const cmGeneratorTarget* t,
|
|
||||||
const std::string& variant) const;
|
|
||||||
|
|
||||||
static std::string GetDeploymentPlatform(const cmMakefile* mf);
|
static std::string GetDeploymentPlatform(const cmMakefile* mf);
|
||||||
|
|
||||||
void ComputeArchitectures(cmMakefile* mf);
|
void ComputeArchitectures(cmMakefile* mf);
|
||||||
|
Loading…
Reference in New Issue
Block a user