Skip to content

Commit 4a3388e

Browse files
authored
CMake improvement : clone hpc-coding-convention module automatically (BlueBrain/CoreNeuron#368)
- if --recursive is not used, coding convention directory should exist - remove olf clang-format related cmake files fixes BlueBrain/CoreNeuron#366 CoreNEURON Repo SHA: BlueBrain/CoreNeuron@b034cf7
1 parent e479f6a commit 4a3388e

File tree

5 files changed

+37
-96
lines changed

5 files changed

+37
-96
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# =============================================================================
2+
# Copyright (C) 2016-2020 Blue Brain Project
3+
#
4+
# See top-level LICENSE file for details.
5+
# =============================================================================
6+
7+
include(FindPackageHandleStandardArgs)
8+
find_package(FindPkgConfig QUIET)
9+
10+
find_path(
11+
HpcCodingConv_PROJ
12+
NAMES setup.cfg
13+
PATHS "${CORENEURON_PROJECT_SOURCE_DIR}/CMake/hpc-coding-conventions/")
14+
15+
find_package_handle_standard_args(HpcCodingConv REQUIRED_VARS HpcCodingConv_PROJ)
16+
17+
if(NOT HpcCodingConv_FOUND)
18+
find_package(Git 1.8.3 QUIET)
19+
if(NOT ${GIT_FOUND})
20+
message(FATAL_ERROR "git not found, clone repository with --recursive")
21+
endif()
22+
message(STATUS "Sub-module CMake/hpc-coding-conventions missing: running git submodule update --init")
23+
execute_process(
24+
COMMAND
25+
${GIT_EXECUTABLE} submodule update --init --
26+
${CORENEURON_PROJECT_SOURCE_DIR}/CMake/hpc-coding-conventions
27+
WORKING_DIRECTORY ${CORENEURON_PROJECT_SOURCE_DIR})
28+
endif()

cmake/coreneuron/CMakeLists.txt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
3333
set(CORENEURON_AS_SUBPROJECT ON)
3434
endif()
3535

36+
# =============================================================================
37+
# Include cmake modules path
38+
# =============================================================================
39+
list(APPEND CMAKE_MODULE_PATH ${CORENEURON_PROJECT_SOURCE_DIR}/CMake
40+
${CORENEURON_PROJECT_SOURCE_DIR}/CMake/packages
41+
${CORENEURON_PROJECT_SOURCE_DIR}/CMake/config)
42+
3643
# =============================================================================
3744
# HPC Coding Conventions
3845
# =============================================================================
@@ -43,15 +50,9 @@ set(CORENRN_ClangFormat_EXCLUDES_RE
4350
set(CORENRN_CMakeFormat_EXCLUDES_RE
4451
".*/external/.*$$" ".*/CMake/packages/.*$$"
4552
CACHE STRING "list of regular expressions to exclude CMake files from formatting" FORCE)
53+
include(AddHpcCodingConvSubmodule)
4654
add_subdirectory(CMake/hpc-coding-conventions/cpp)
4755

48-
# =============================================================================
49-
# Include cmake modules path
50-
# =============================================================================
51-
list(APPEND CMAKE_MODULE_PATH ${CORENEURON_PROJECT_SOURCE_DIR}/CMake
52-
${CORENEURON_PROJECT_SOURCE_DIR}/CMake/packages
53-
${CORENEURON_PROJECT_SOURCE_DIR}/CMake/config)
54-
5556
# =============================================================================
5657
# Include common cmake modules
5758
# =============================================================================
@@ -62,6 +63,7 @@ include(SetRpath)
6263
include(CTest)
6364
include(AddRandom123Submodule)
6465
include(AddCLI11Submodule)
66+
6567
add_subdirectory(${CORENEURON_PROJECT_SOURCE_DIR}/external/CLI11)
6668

6769
# =============================================================================
@@ -106,7 +108,6 @@ endif()
106108
# Include cmake modules after cmake options
107109
# =============================================================================
108110
include(OpenAccHelper)
109-
include(ClangFormatHelper)
110111

111112
# =============================================================================
112113
# Common dependencies

cmake/coreneuron/ClangFormatHelper.cmake

Lines changed: 0 additions & 42 deletions
This file was deleted.

cmake/coreneuron/ClangFormatUtils.cmake

Lines changed: 0 additions & 12 deletions
This file was deleted.

cmake/coreneuron/packages/FindClangFormat.cmake

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)