diff options
author | Robert Maynard <robert.maynard@kitware.com> | 2020-07-28 18:52:36 (GMT) |
---|---|---|
committer | Robert Maynard <robert.maynard@kitware.com> | 2020-09-04 12:37:07 (GMT) |
commit | a020787a9b7ede3aa490345bd446e469fb1713d2 (patch) | |
tree | f96ef2b1d84515fda4288ffaf39e9abfb8c9cc1a /Source/cmGeneratorTarget.cxx | |
parent | 5a1750017e65727660167ae1953746a3fd3d2c7b (diff) | |
download | CMake-a020787a9b7ede3aa490345bd446e469fb1713d2.zip CMake-a020787a9b7ede3aa490345bd446e469fb1713d2.tar.gz CMake-a020787a9b7ede3aa490345bd446e469fb1713d2.tar.bz2 |
ISPC: Support generation for multiple instruction sets
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 05c8cc8..a298682 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -3302,6 +3302,27 @@ void cmGeneratorTarget::AddCUDAArchitectureFlags(std::string& flags) const } } +void cmGeneratorTarget::AddISPCTargetFlags(std::string& flags) const +{ + const std::string& property = this->GetSafeProperty("ISPC_INSTRUCTION_SETS"); + + // If ISPC_TARGET is false we don't add any architectures. + if (cmIsOff(property)) { + return; + } + + std::string const& compiler = + this->Makefile->GetSafeDefinition("CMAKE_ISPC_COMPILER_ID"); + + if (compiler == "Intel") { + std::vector<std::string> targets; + cmExpandList(property, targets); + if (!targets.empty()) { + flags += cmStrCat(" --target=", cmWrap("", targets, "", ",")); + } + } +} + void cmGeneratorTarget::AddCUDAToolkitFlags(std::string& flags) const { std::string const& compiler = @@ -5071,6 +5092,11 @@ void cmGeneratorTarget::GetTargetObjectNames( assert(!map_it->second.empty()); objects.push_back(map_it->second); } + + auto ispcObjects = this->GetGeneratedISPCObjects(config); + for (std::string const& output : ispcObjects) { + objects.push_back(cmSystemTools::GetFilenameName(output)); + } } bool cmGeneratorTarget::StrictTargetComparison::operator()( @@ -6042,6 +6068,35 @@ std::vector<std::string> cmGeneratorTarget::GetGeneratedISPCHeaders( return iter->second; } +void cmGeneratorTarget::AddISPCGeneratedObject(std::vector<std::string>&& objs, + std::string const& config) +{ + std::string config_upper; + if (!config.empty()) { + config_upper = cmSystemTools::UpperCase(config); + } + auto iter = this->ISPCGeneratedObjects.find(config_upper); + if (iter == this->ISPCGeneratedObjects.end()) { + this->ISPCGeneratedObjects.insert({ config_upper, objs }); + } else { + iter->second.insert(iter->second.end(), objs.begin(), objs.end()); + } +} + +std::vector<std::string> cmGeneratorTarget::GetGeneratedISPCObjects( + std::string const& config) const +{ + std::string config_upper; + if (!config.empty()) { + config_upper = cmSystemTools::UpperCase(config); + } + auto iter = this->ISPCGeneratedObjects.find(config_upper); + if (iter == this->ISPCGeneratedObjects.end()) { + return std::vector<std::string>{}; + } + return iter->second; +} + std::string cmGeneratorTarget::GetFrameworkVersion() const { assert(this->GetType() != cmStateEnums::INTERFACE_LIBRARY); |