diff options
author | Robert Maynard <robert.maynard@kitware.com> | 2020-12-10 21:08:24 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-12-14 18:13:09 (GMT) |
commit | c9a50f35565dcc1df8bd82126ecced95e60c29e4 (patch) | |
tree | ede35e80def43d76af7378632f05115c0b43bea7 /Source/cmLocalGenerator.cxx | |
parent | 6aff058ab4a2d54a316dbaa536572ad71efb8b51 (diff) | |
download | CMake-c9a50f35565dcc1df8bd82126ecced95e60c29e4.zip CMake-c9a50f35565dcc1df8bd82126ecced95e60c29e4.tar.gz CMake-c9a50f35565dcc1df8bd82126ecced95e60c29e4.tar.bz2 |
ISPC: Generated Headers suffix configurable with a better default
The target property `ISPC_HEADER_SUFFIX` and associated global
variable now can control the suffix used when generating the
C/C++ interoperability ISPC headers.
In addition the default suffix is now "_ispc.h" which matches the
common convention that the ISPC compiler team uses and recommends.
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r-- | Source/cmLocalGenerator.cxx | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 368f278..884d15d 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2426,9 +2426,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); @@ -2451,14 +2454,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); } } |