axom: devtools require llvm clang-format (#19740)

* follow-up to previous PR

* build type
This commit is contained in:
Greg Becker 2020-11-11 08:54:24 -08:00 committed by GitHub
parent 2c55d47c1e
commit 229fc11fdb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -137,6 +137,7 @@ class Axom(CMakePackage, CudaPackage):
depends_on("python", when="+devtools")
depends_on("py-sphinx", when="+devtools")
depends_on("py-shroud", when="+devtools")
depends_on("llvm+clang@10.0.0", when="+devtools", type='build')
def flag_handler(self, name, flags):
if name in ('cflags', 'cxxflags', 'fflags'):
@ -422,22 +423,9 @@ def hostconfig(self, spec, prefix):
# Only turn on clangformat support if devtools is on
if "+devtools" in spec:
cf_paths = []
lc_clangpath = "/usr/tce/packages/clang/clang-10.0.0"
cf_paths.append(pjoin(lc_clangpath, "bin/clang-format"))
cf_paths.append("/usr/bin/clang-format-10")
cf_paths.append("/usr/bin/clang-format")
cf_found = False
for path in cf_paths:
if os.path.exists(path):
cf_found = True
cfg.write(cmake_cache_entry("CLANGFORMAT_EXECUTABLE",
path))
if not cf_found:
cfg.write("# Unable to find clang-format\n\n")
cfg.write(cmake_cache_option("ENABLE_CLANGFORMAT", False))
clang_fmt_path = spec['llvm'].prefix.bin.join('clang-format')
cfg.write(cmake_cache_entry("CLANGFORMAT_EXECUTABLE",
clang_fmt_path))
else:
cfg.write("# ClangFormat disabled due to disabled devtools\n")
cfg.write(cmake_cache_option("ENABLE_CLANGFORMAT", False))