summaryrefslogtreecommitdiffstats
path: root/Source/cmCoreTryCompile.cxx
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2020-08-28 19:03:39 (GMT)
committerZack Galbreath <zack.galbreath@kitware.com>2021-06-07 19:25:33 (GMT)
commitb50bfc89131e55685aa41146254b37d26049b4d5 (patch)
treee6ed45ba63b75decf4c9436fac6139174850370b /Source/cmCoreTryCompile.cxx
parentff0d2858e1e47af8e849318b411b1fbd8579a053 (diff)
downloadCMake-b50bfc89131e55685aa41146254b37d26049b4d5.zip
CMake-b50bfc89131e55685aa41146254b37d26049b4d5.tar.gz
CMake-b50bfc89131e55685aa41146254b37d26049b4d5.tar.bz2
HIP: Add language to CMake
Diffstat (limited to 'Source/cmCoreTryCompile.cxx')
-rw-r--r--Source/cmCoreTryCompile.cxx21
1 files changed, 20 insertions, 1 deletions
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 5399fd0..8ecf264 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -189,6 +189,8 @@ SETUP_LANGUAGE(cuda_properties, CUDA);
// NOLINTNEXTLINE(bugprone-suspicious-missing-comma)
SETUP_LANGUAGE(fortran_properties, Fortran);
// NOLINTNEXTLINE(bugprone-suspicious-missing-comma)
+SETUP_LANGUAGE(hip_properties, HIP);
+// NOLINTNEXTLINE(bugprone-suspicious-missing-comma)
SETUP_LANGUAGE(objc_properties, OBJC);
// NOLINTNEXTLINE(bugprone-suspicious-missing-comma)
SETUP_LANGUAGE(objcxx_properties, OBJCXX);
@@ -201,6 +203,8 @@ SETUP_LANGUAGE(swift_properties, Swift);
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_HIP_ARCHITECTURES = "CMAKE_HIP_ARCHITECTURES";
+std::string const kCMAKE_HIP_RUNTIME_LIBRARY = "CMAKE_HIP_RUNTIME_LIBRARY";
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 =
@@ -274,6 +278,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
LanguageStandardState cState("C");
LanguageStandardState cudaState("CUDA");
LanguageStandardState cxxState("CXX");
+ LanguageStandardState hipState("HIP");
LanguageStandardState objcState("OBJC");
LanguageStandardState objcxxState("OBJCXX");
std::vector<std::string> targets;
@@ -323,6 +328,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
} else if (cState.UpdateIfMatches(argv, i) ||
cxxState.UpdateIfMatches(argv, i) ||
cudaState.UpdateIfMatches(argv, i) ||
+ hipState.UpdateIfMatches(argv, i) ||
objcState.UpdateIfMatches(argv, i) ||
objcxxState.UpdateIfMatches(argv, i)) {
continue;
@@ -428,6 +434,9 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
if (!cudaState.Validate(this->Makefile)) {
return -1;
}
+ if (!hipState.Validate(this->Makefile)) {
+ return -1;
+ }
if (!cxxState.Validate(this->Makefile)) {
return -1;
}
@@ -715,6 +724,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
vars.insert(
&fortran_properties[lang_property_start],
&fortran_properties[lang_property_start + lang_property_size]);
+ vars.insert(&hip_properties[lang_property_start],
+ &hip_properties[lang_property_start + lang_property_size]);
vars.insert(&objc_properties[lang_property_start],
&objc_properties[lang_property_start + lang_property_size]);
vars.insert(
@@ -727,6 +738,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
vars.insert(kCMAKE_CUDA_ARCHITECTURES);
vars.insert(kCMAKE_CUDA_RUNTIME_LIBRARY);
vars.insert(kCMAKE_ENABLE_EXPORTS);
+ vars.insert(kCMAKE_HIP_ARCHITECTURES);
+ vars.insert(kCMAKE_HIP_RUNTIME_LIBRARY);
vars.insert(kCMAKE_ISPC_INSTRUCTION_SETS);
vars.insert(kCMAKE_ISPC_HEADER_SUFFIX);
vars.insert(kCMAKE_LINK_SEARCH_END_STATIC);
@@ -761,6 +774,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
vars.insert(
&fortran_properties[pie_property_start],
&fortran_properties[pie_property_start + pie_property_size]);
+ vars.insert(&hip_properties[pie_property_start],
+ &hip_properties[pie_property_start + pie_property_size]);
vars.insert(&objc_properties[pie_property_start],
&objc_properties[pie_property_start + pie_property_size]);
vars.insert(
@@ -835,6 +850,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
cState.Enabled(testLangs.find("C") != testLangs.end());
cxxState.Enabled(testLangs.find("CXX") != testLangs.end());
cudaState.Enabled(testLangs.find("CUDA") != testLangs.end());
+ hipState.Enabled(testLangs.find("HIP") != testLangs.end());
objcState.Enabled(testLangs.find("OBJC") != testLangs.end());
objcxxState.Enabled(testLangs.find("OBJCXX") != testLangs.end());
@@ -842,7 +858,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
bool honorStandard = true;
if (cState.DidNone() && cxxState.DidNone() && objcState.DidNone() &&
- objcxxState.DidNone() && cudaState.DidNone()) {
+ objcxxState.DidNone() && cudaState.DidNone() && hipState.DidNone()) {
switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0067)) {
case cmPolicies::WARN:
warnCMP0067 = this->Makefile->PolicyOptionalWarningEnabled(
@@ -872,6 +888,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
warnCMP0067, warnCMP0067Variables);
cudaState.LoadUnsetPropertyValues(this->Makefile, honorStandard,
warnCMP0067, warnCMP0067Variables);
+ hipState.LoadUnsetPropertyValues(this->Makefile, honorStandard,
+ warnCMP0067, warnCMP0067Variables);
objcState.LoadUnsetPropertyValues(this->Makefile, honorStandard,
warnCMP0067, warnCMP0067Variables);
objcxxState.LoadUnsetPropertyValues(this->Makefile, honorStandard,
@@ -894,6 +912,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
cState.WriteProperties(fout, targetName);
cxxState.WriteProperties(fout, targetName);
cudaState.WriteProperties(fout, targetName);
+ hipState.WriteProperties(fout, targetName);
objcState.WriteProperties(fout, targetName);
objcxxState.WriteProperties(fout, targetName);