1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
From c88c97c806055c817b3591898933789c5976402c Mon Sep 17 00:00:00 2001
From: Matthias Klumpp <matthias@tenstral.net>
Date: Thu, 26 Jan 2023 00:29:49 +0100
Subject: [PATCH] Find packaged HPC coding conventions
---
CMakeLists.txt | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -82,23 +82,29 @@
# HPC Coding Conventions
# =============================================================================
# initialize submodule of coding conventions under cmake
-if(NOT EXISTS "${PROJECT_SOURCE_DIR}/cmake/hpc-coding-conventions/cpp/CMakeLists.txt")
- initialize_submodule("${PROJECT_SOURCE_DIR}/cmake/hpc-coding-conventions")
+if(EXISTS "/usr/share/bluebrain-hpc-coding-conventions/cpp/CMakeLists.txt")
+ set(CODING_CONV_PREFIX NMODL)
+ set(HPC_CODING_CONVENTIONS_DIR "/usr/share/bluebrain-hpc-coding-conventions")
+else()
+ if(NOT EXISTS "${PROJECT_SOURCE_DIR}/cmake/hpc-coding-conventions/cpp/CMakeLists.txt")
+ initialize_submodule("${PROJECT_SOURCE_DIR}/cmake/hpc-coding-conventions")
+ endif()
+ set(CODING_CONV_PREFIX NMODL)
+ add_subdirectory(cmake/hpc-coding-conventions/cpp)
+ set(HPC_CODING_CONVENTIONS_DIR "cmake/hpc-coding-conventions")
endif()
-set(CODING_CONV_PREFIX NMODL)
-add_subdirectory(cmake/hpc-coding-conventions/cpp)
# =============================================================================
# Enable sanitizer support if the NMODL_SANITIZERS variable is set
# =============================================================================
-include(cmake/hpc-coding-conventions/cpp/cmake/sanitizers.cmake)
+include(${HPC_CODING_CONVENTIONS_DIR}/cpp/cmake/sanitizers.cmake)
list(APPEND NMODL_EXTRA_CXX_FLAGS ${NMODL_SANITIZER_COMPILER_FLAGS})
# =============================================================================
# Initialize external libraries as submodules
# =============================================================================
set(NMODL_3RDPARTY_DIR ext)
-include(cmake/hpc-coding-conventions/cpp/cmake/3rdparty.cmake)
+include(${HPC_CODING_CONVENTIONS_DIR}/cpp/cmake/3rdparty.cmake)
cpp_cc_git_submodule(catch2 BUILD PACKAGE Catch2 REQUIRED)
if(NMODL_3RDPARTY_USE_CATCH2)
# If we're using the submodule then make sure the Catch.cmake helper can be found. In newer
@@ -167,7 +173,7 @@
# =============================================================================
message(STATUS "CHECKING FOR PYTHON")
find_package(PythonInterp 3.7 REQUIRED)
-include(cmake/hpc-coding-conventions/cpp/cmake/bbp-find-python-module.cmake)
+include(${HPC_CODING_CONVENTIONS_DIR}/cpp/cmake/bbp-find-python-module.cmake)
cpp_cc_find_python_module(jinja2 2.9.3 REQUIRED)
cpp_cc_find_python_module(pytest 3.3.0 REQUIRED)
cpp_cc_find_python_module(sympy 1.3 REQUIRED)
|