summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-12-15 12:40:26 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-12-15 12:40:34 (GMT)
commit67f12dd1d606e3e1fe04d75d29f29db41aec5dda (patch)
treede0be0cce300084dc3353b5a5ee88bb7b31ad033 /Source
parent38dbbae26ca1bc5f6c65b38f596e74899a19cae1 (diff)
parentc9a50f35565dcc1df8bd82126ecced95e60c29e4 (diff)
downloadCMake-67f12dd1d606e3e1fe04d75d29f29db41aec5dda.zip
CMake-67f12dd1d606e3e1fe04d75d29f29db41aec5dda.tar.gz
CMake-67f12dd1d606e3e1fe04d75d29f29db41aec5dda.tar.bz2
Merge topic 'ispc_control_header_suffixes'
c9a50f3556 ISPC: Generated Headers suffix configurable with a better default Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5597
Diffstat (limited to 'Source')
-rw-r--r--Source/cmCoreTryCompile.cxx2
-rw-r--r--Source/cmLocalGenerator.cxx16
-rw-r--r--Source/cmMakefileTargetGenerator.cxx7
-rw-r--r--Source/cmNinjaTargetGenerator.cxx7
-rw-r--r--Source/cmTarget.cxx1
5 files changed, 27 insertions, 6 deletions
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 77a6d4b..6672aa6 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -201,6 +201,7 @@ std::string const kCMAKE_CUDA_ARCHITECTURES = "CMAKE_CUDA_ARCHITECTURES";
std::string const kCMAKE_CUDA_RUNTIME_LIBRARY = "CMAKE_CUDA_RUNTIME_LIBRARY";
std::string const kCMAKE_ENABLE_EXPORTS = "CMAKE_ENABLE_EXPORTS";
std::string const kCMAKE_ISPC_INSTRUCTION_SETS = "CMAKE_ISPC_INSTRUCTION_SETS";
+std::string const kCMAKE_ISPC_HEADER_SUFFIX = "CMAKE_ISPC_HEADER_SUFFIX";
std::string const kCMAKE_LINK_SEARCH_END_STATIC =
"CMAKE_LINK_SEARCH_END_STATIC";
std::string const kCMAKE_LINK_SEARCH_START_STATIC =
@@ -718,6 +719,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
vars.insert(kCMAKE_CUDA_RUNTIME_LIBRARY);
vars.insert(kCMAKE_ENABLE_EXPORTS);
vars.insert(kCMAKE_ISPC_INSTRUCTION_SETS);
+ vars.insert(kCMAKE_ISPC_HEADER_SUFFIX);
vars.insert(kCMAKE_LINK_SEARCH_END_STATIC);
vars.insert(kCMAKE_LINK_SEARCH_START_STATIC);
vars.insert(kCMAKE_OSX_ARCHITECTURES);
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 282f785..7b1c531 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2438,9 +2438,12 @@ void cmLocalGenerator::AddISPCDependencies(cmGeneratorTarget* target)
return;
}
- std::vector<std::string> ispcSuffixes =
+ cmProp ispcHeaderSuffixProp = target->GetProperty("ISPC_HEADER_SUFFIX");
+ assert(ispcHeaderSuffixProp != nullptr);
+
+ std::vector<std::string> ispcArchSuffixes =
detail::ComputeISPCObjectSuffixes(target);
- const bool extra_objects = (ispcSuffixes.size() > 1);
+ const bool extra_objects = (ispcArchSuffixes.size() > 1);
std::vector<std::string> configsList =
this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
@@ -2463,14 +2466,19 @@ void cmLocalGenerator::AddISPCDependencies(cmGeneratorTarget* target)
const std::string& lang = sf->GetLanguage();
if (lang == "ISPC") {
std::string const& objectName = target->GetObjectName(sf);
+
+ // Drop both ".obj" and the source file extension
std::string ispcSource =
cmSystemTools::GetFilenameWithoutLastExtension(objectName);
+ ispcSource =
+ cmSystemTools::GetFilenameWithoutLastExtension(ispcSource);
- auto headerPath = cmStrCat(headerDir, '/', ispcSource, ".h");
+ auto headerPath =
+ cmStrCat(headerDir, '/', ispcSource, *ispcHeaderSuffixProp);
target->AddISPCGeneratedHeader(headerPath, config);
if (extra_objects) {
std::vector<std::string> objs = detail::ComputeISPCExtraObjects(
- objectName, rootObjectDir, ispcSuffixes);
+ objectName, rootObjectDir, ispcArchSuffixes);
target->AddISPCGeneratedObject(std::move(objs), config);
}
}
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index ee47e46..1f23424 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -644,6 +644,11 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
if (lang == "ISPC") {
std::string ispcSource =
cmSystemTools::GetFilenameWithoutLastExtension(objectName);
+ ispcSource = cmSystemTools::GetFilenameWithoutLastExtension(ispcSource);
+
+ cmProp ispcSuffixProp =
+ this->GeneratorTarget->GetProperty("ISPC_HEADER_SUFFIX");
+ assert(ispcSuffixProp != nullptr);
std::string directory = this->GeneratorTarget->GetObjectDirectory(config);
if (cmProp prop =
@@ -651,7 +656,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
directory =
cmStrCat(this->LocalGenerator->GetBinaryDirectory(), '/', *prop);
}
- ispcHeaderRelative = cmStrCat(directory, '/', ispcSource, ".h");
+ ispcHeaderRelative = cmStrCat(directory, '/', ispcSource, *ispcSuffixProp);
ispcHeaderForShell = this->LocalGenerator->ConvertToOutputFormat(
ispcHeaderRelative, cmOutputConverter::SHELL);
}
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 838cf4c..9075563 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -1356,6 +1356,11 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
this->GeneratorTarget->GetObjectName(source);
std::string ispcSource =
cmSystemTools::GetFilenameWithoutLastExtension(objectName);
+ ispcSource = cmSystemTools::GetFilenameWithoutLastExtension(ispcSource);
+
+ cmProp ispcSuffixProp =
+ this->GeneratorTarget->GetProperty("ISPC_HEADER_SUFFIX");
+ assert(ispcSuffixProp != nullptr);
std::string ispcHeaderDirectory =
this->GeneratorTarget->GetObjectDirectory(config);
@@ -1366,7 +1371,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
}
std::string ispcHeader =
- cmStrCat(ispcHeaderDirectory, '/', ispcSource, ".h");
+ cmStrCat(ispcHeaderDirectory, '/', ispcSource, *ispcSuffixProp);
ispcHeader = this->ConvertToNinjaPath(ispcHeader);
// Make sure ninja knows what command generates the header
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 9db5dc6..778fb89 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -369,6 +369,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
initProp("JOB_POOL_PRECOMPILE_HEADER");
initProp("ISPC_COMPILER_LAUNCHER");
initProp("ISPC_HEADER_DIRECTORY");
+ initPropValue("ISPC_HEADER_SUFFIX", "_ispc.h");
initProp("ISPC_INSTRUCTION_SETS");
initProp("LINK_SEARCH_START_STATIC");
initProp("LINK_SEARCH_END_STATIC");