|
|
@@ -3390,9 +3390,9 @@ void cmGeneratorTarget::AddCUDAArchitectureFlags(cmBuildStep compileOrLink,
|
|
|
const std::string& config,
|
|
|
std::string& flags) const
|
|
|
{
|
|
|
- std::string property = this->GetSafeProperty("CUDA_ARCHITECTURES");
|
|
|
+ std::string arch = this->GetSafeProperty("CUDA_ARCHITECTURES");
|
|
|
|
|
|
- if (property.empty()) {
|
|
|
+ if (arch.empty()) {
|
|
|
switch (this->GetPolicyStatusCMP0104()) {
|
|
|
case cmPolicies::WARN:
|
|
|
if (!this->LocalGenerator->GetCMakeInstance()->GetIsInTryCompile()) {
|
|
|
@@ -3414,7 +3414,7 @@ void cmGeneratorTarget::AddCUDAArchitectureFlags(cmBuildStep compileOrLink,
|
|
|
}
|
|
|
|
|
|
// If CUDA_ARCHITECTURES is false we don't add any architectures.
|
|
|
- if (cmIsOff(property)) {
|
|
|
+ if (cmIsOff(arch)) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -3423,23 +3423,22 @@ void cmGeneratorTarget::AddCUDAArchitectureFlags(cmBuildStep compileOrLink,
|
|
|
const bool ipoEnabled = this->IsIPOEnabled("CUDA", config);
|
|
|
|
|
|
// Check for special modes: `all`, `all-major`.
|
|
|
- if (property == "all" || property == "all-major") {
|
|
|
+ if (arch == "all" || arch == "all-major") {
|
|
|
if (compiler == "NVIDIA" &&
|
|
|
cmSystemTools::VersionCompare(
|
|
|
cmSystemTools::OP_GREATER_EQUAL,
|
|
|
this->Makefile->GetDefinition("CMAKE_CUDA_COMPILER_VERSION"),
|
|
|
"11.5")) {
|
|
|
- flags = cmStrCat(flags, " -arch=", property);
|
|
|
+ flags = cmStrCat(flags, " -arch=", arch);
|
|
|
return;
|
|
|
}
|
|
|
- if (property == "all") {
|
|
|
- property =
|
|
|
- *this->Makefile->GetDefinition("CMAKE_CUDA_ARCHITECTURES_ALL");
|
|
|
- } else if (property == "all-major") {
|
|
|
- property =
|
|
|
+ if (arch == "all") {
|
|
|
+ arch = *this->Makefile->GetDefinition("CMAKE_CUDA_ARCHITECTURES_ALL");
|
|
|
+ } else if (arch == "all-major") {
|
|
|
+ arch =
|
|
|
*this->Makefile->GetDefinition("CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR");
|
|
|
}
|
|
|
- } else if (property == "native") {
|
|
|
+ } else if (arch == "native") {
|
|
|
cmValue native =
|
|
|
this->Makefile->GetDefinition("CMAKE_CUDA_ARCHITECTURES_NATIVE");
|
|
|
if (native.IsEmpty()) {
|
|
|
@@ -3452,10 +3451,10 @@ void cmGeneratorTarget::AddCUDAArchitectureFlags(cmBuildStep compileOrLink,
|
|
|
cmSystemTools::OP_GREATER_EQUAL,
|
|
|
this->Makefile->GetDefinition("CMAKE_CUDA_COMPILER_VERSION"),
|
|
|
"11.6")) {
|
|
|
- flags = cmStrCat(flags, " -arch=", property);
|
|
|
+ flags = cmStrCat(flags, " -arch=", arch);
|
|
|
return;
|
|
|
}
|
|
|
- property = *native;
|
|
|
+ arch = *native;
|
|
|
}
|
|
|
|
|
|
struct CudaArchitecture
|
|
|
@@ -3467,7 +3466,7 @@ void cmGeneratorTarget::AddCUDAArchitectureFlags(cmBuildStep compileOrLink,
|
|
|
std::vector<CudaArchitecture> architectures;
|
|
|
|
|
|
{
|
|
|
- cmList options(property);
|
|
|
+ cmList options(arch);
|
|
|
|
|
|
for (auto& option : options) {
|
|
|
CudaArchitecture architecture;
|
|
|
@@ -3549,10 +3548,10 @@ void cmGeneratorTarget::AddCUDAArchitectureFlags(cmBuildStep compileOrLink,
|
|
|
|
|
|
void cmGeneratorTarget::AddISPCTargetFlags(std::string& flags) const
|
|
|
{
|
|
|
- const std::string& property = this->GetSafeProperty("ISPC_INSTRUCTION_SETS");
|
|
|
+ const std::string& arch = this->GetSafeProperty("ISPC_INSTRUCTION_SETS");
|
|
|
|
|
|
// If ISPC_TARGET is false we don't add any architectures.
|
|
|
- if (cmIsOff(property)) {
|
|
|
+ if (cmIsOff(arch)) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -3560,7 +3559,7 @@ void cmGeneratorTarget::AddISPCTargetFlags(std::string& flags) const
|
|
|
this->Makefile->GetSafeDefinition("CMAKE_ISPC_COMPILER_ID");
|
|
|
|
|
|
if (compiler == "Intel") {
|
|
|
- cmList targets(property);
|
|
|
+ cmList targets(arch);
|
|
|
if (!targets.empty()) {
|
|
|
flags += cmStrCat(" --target=", cmWrap("", targets, "", ","));
|
|
|
}
|
|
|
@@ -3569,20 +3568,20 @@ void cmGeneratorTarget::AddISPCTargetFlags(std::string& flags) const
|
|
|
|
|
|
void cmGeneratorTarget::AddHIPArchitectureFlags(std::string& flags) const
|
|
|
{
|
|
|
- const std::string& property = this->GetSafeProperty("HIP_ARCHITECTURES");
|
|
|
+ const std::string& arch = this->GetSafeProperty("HIP_ARCHITECTURES");
|
|
|
|
|
|
- if (property.empty()) {
|
|
|
+ if (arch.empty()) {
|
|
|
this->Makefile->IssueMessage(MessageType::FATAL_ERROR,
|
|
|
"HIP_ARCHITECTURES is empty for target \"" +
|
|
|
this->GetName() + "\".");
|
|
|
}
|
|
|
|
|
|
// If HIP_ARCHITECTURES is false we don't add any architectures.
|
|
|
- if (cmIsOff(property)) {
|
|
|
+ if (cmIsOff(arch)) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- cmList options(property);
|
|
|
+ cmList options(arch);
|
|
|
|
|
|
for (std::string& option : options) {
|
|
|
flags += " --offload-arch=" + option;
|