Skip to content

Commit 4ceef5e

Browse files
aphecetcheBarthelemy
authored andcommitted
[QC-207] CMake migration (#197)
Start migration of cmake towards what is done in AliceO2 repo For the moment we consider tests should be ran only within the correct alienv environment, so LD_LIBRARY_PATH should be correct.
1 parent 16a5b73 commit 4ceef5e

31 files changed

Lines changed: 888 additions & 1553 deletions

.cmake-format.py

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# How wide to allow formatted cmake files
2+
line_width = 80
3+
4+
# How many spaces to tab for indent
5+
tab_size = 2
6+
7+
# If arglists are longer than this, break them always
8+
max_subargs_per_line = 5
9+
10+
# If true, separate flow control names from their parentheses with a space
11+
separate_ctrl_name_with_space = False
12+
13+
# If true, separate function names from parentheses with a space
14+
separate_fn_name_with_space = False
15+
16+
# If a statement is wrapped to more than one line, than dangle the closing
17+
# parenthesis on it's own line
18+
dangle_parens = False
19+
20+
# What character to use for bulleted lists
21+
bullet_char = '*'
22+
23+
# What character to use as punctuation after numerals in an enumerated list
24+
enum_char = '.'
25+
26+
# What style line endings to use in the output.
27+
line_ending = 'unix'
28+
29+
# Format command names consistently as 'lower' or 'upper' case
30+
command_case = 'canonical'
31+
32+
# Format keywords consistently as 'lower' or 'upper' case
33+
keyword_case = 'upper'
34+
35+
# Specify structure for custom cmake functions
36+
# * = ZERO_OR_MORE
37+
# + = ONE_OR_MORE
38+
additional_commands = {
39+
"add_root_dictionary": {
40+
"kwargs": {
41+
"LINKDEF": '+',
42+
"HEADERS": '*',
43+
"BASENAME": '*',
44+
}
45+
},
46+
"find_package_handle_standard_args": {
47+
"flags": ["CONFIG_MODE"],
48+
"kwargs": {
49+
"DEFAULT_MSG": '*',
50+
"REQUIRED_VARS": '*',
51+
"VERSION_VAR": '*',
52+
"HANDLE_COMPONENTS": '*',
53+
"FAIL_MESSAGE": '*'
54+
}
55+
}
56+
}
57+
58+
# A list of command names which should always be wrapped
59+
always_wrap = []
60+
61+
# Specify the order of wrapping algorithms during successive reflow attempts
62+
algorithm_order = [0, 1, 2, 3, 4]
63+
64+
# If true, the argument lists which are known to be sortable will be sorted
65+
# lexicographicall
66+
autosort = False
67+
68+
# enable comment markup parsing and reflow
69+
enable_markup = True
70+
71+
# If comment markup is enabled, don't reflow the first comment block in
72+
# eachlistfile. Use this to preserve formatting of your
73+
# copyright/licensestatements.
74+
first_comment_is_literal = False
75+
76+
# If comment markup is enabled, don't reflow any comment block which matchesthis
77+
# (regex) pattern. Default is `None` (disabled).
78+
literal_comment_pattern = None
79+
80+
# Regular expression to match preformat fences in comments
81+
# default=r'^\s*([`~]{3}[`~]*)(.*)$'
82+
fence_pattern = '^\\s*([`~]{3}[`~]*)(.*)$'
83+
84+
# Regular expression to match rulers in comments
85+
# default=r'^\s*[^\w\s]{3}.*[^\w\s]{3}$'
86+
ruler_pattern = '^\\s*[^\\w\\s]{3}.*[^\\w\\s]{3}$'
87+
88+
# If true, emit the unicode byte-order mark (BOM) at the start of the file
89+
emit_byteorder_mark = False
90+
91+
# If a comment line starts with at least this many consecutive hash characters,
92+
# then don't lstrip() them off. This allows for lazy hash rulers where the first
93+
# hash char is not separated by space
94+
hashruler_min_length = 10
95+
96+
# If true, then insert a space between the first hash char and remaining hash
97+
# chars in a hash ruler, and normalize it's length to fill the column
98+
canonicalize_hashrulers = True
99+
100+
# Specify the encoding of the input file. Defaults to utf-8.
101+
input_encoding = 'utf-8'
102+
103+
# Specify the encoding of the output file. Defaults to utf-8. Note that cmake
104+
# only claims to support utf-8 so be careful when using anything else
105+
output_encoding = 'utf-8'
106+
107+
# A dictionary containing any per-command configuration overrides. Currently
108+
# only `command_case` is supported.
109+
per_command = {}

CMakeLists.txt

Lines changed: 51 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,39 @@
11
# ---- CMake options ----
22

3-
cmake_minimum_required(VERSION 3.5.2 FATAL_ERROR)
4-
5-
# Set cmake policy by version: https://cmake.org/cmake/help/latest/manual/cmake-policies.7.html
6-
if(${CMAKE_VERSION} VERSION_LESS 3.12)
7-
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
8-
else()
9-
cmake_policy(VERSION 3.12)
10-
endif()
3+
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
114

125
enable_testing()
136

147
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
158

169
include(CMakeParseArguments)
17-
include(QCModulesUtils)
1810
include(GNUInstallDirs)
1911

2012
# ---- Project ----
2113

22-
project(
23-
QualityControl
24-
VERSION
25-
0.13.0 # TODO update this automatically when there are new releases
26-
DESCRIPTION
27-
"O2 Data Quality Control Framework"
28-
LANGUAGES CXX
29-
)
14+
project(QualityControl
15+
VERSION 0.13.0 # TODO update this automatically when there are new
16+
# releases
17+
DESCRIPTION "O2 Data Quality Control Framework"
18+
LANGUAGES CXX C)
19+
20+
# Set CMAKE_INSTALL_LIBDIR explicitly to lib (to avoid lib64 on CC7)
21+
set(CMAKE_INSTALL_LIBDIR lib)
22+
23+
include(GNUInstallDirs)
3024

31-
set(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/lib")
32-
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin")
33-
set(INCLUDE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/include")
25+
if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
26+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
27+
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR})
28+
endif()
29+
if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
30+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY
31+
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
32+
endif()
33+
if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
34+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY
35+
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
36+
endif()
3437

3538
# ---- End Project ----
3639
# The line above is necessary for the generation of doxygen by travis
@@ -40,15 +43,20 @@ set(INCLUDE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/include")
4043
# Set the default build type to "RelWithDebInfo"
4144
if(NOT CMAKE_BUILD_TYPE)
4245
set(
43-
CMAKE_BUILD_TYPE "RelWithDebInfo"
44-
CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel Coverage."
45-
FORCE
46-
)
46+
CMAKE_BUILD_TYPE
47+
"RelWithDebInfo"
48+
CACHE
49+
STRING
50+
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel Coverage."
51+
FORCE)
4752
endif(NOT CMAKE_BUILD_TYPE)
4853

54+
option(BUILD_SHARED_LIBS "Build shared libs" ON)
55+
4956
# Build targets with install rpath on Mac to dramatically speed up installation
5057
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
51-
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
58+
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib"
59+
isSystemDir)
5260
if("${isSystemDir}" STREQUAL "-1")
5361
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
5462
set(CMAKE_INSTALL_RPATH "@loader_path/../lib")
@@ -72,45 +80,39 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
7280

7381
# ---- Dependencies ----
7482

75-
find_package(
76-
Boost 1.58
77-
COMPONENTS
78-
container
79-
unit_test_framework
80-
program_options
81-
system
82-
log
83-
signals
84-
system
85-
)
83+
find_package(Boost 1.58
84+
COMPONENTS container
85+
unit_test_framework
86+
program_options
87+
system
88+
log
89+
signals
90+
system)
8691
find_package(Git QUIET)
8792
find_package(Configuration REQUIRED)
8893
find_package(Monitoring REQUIRED)
8994
find_package(MySQL)
9095
find_package(Common REQUIRED)
9196
find_package(InfoLogger REQUIRED)
92-
find_package(AliceO2 REQUIRED)
97+
find_package(ms_gsl MODULE REQUIRED)
98+
find_package(O2 MODULE REQUIRED)
9399
find_package(CURL REQUIRED)
94-
find_package(ZeroMQ REQUIRED)
95-
find_package(Arrow REQUIRED)
96-
find_package(GLFW)
97-
find_package(FairRoot REQUIRED)
100+
find_package(GLFW NAMES glfw3 CONFIG)
98101
find_package(FairMQ REQUIRED)
99102
find_package(FairLogger REQUIRED)
100-
find_package(
101-
ROOT 6.06.02
102-
COMPONENTS
103-
RHTTP
104-
Gui
105-
REQUIRED
106-
)
103+
find_package(ROOT 6.06.02 COMPONENTS RHTTP Gui REQUIRED)
107104

108105
set(ENABLE_MYSQL ON)
109106
if(NOT (MYSQL_FOUND AND TARGET ROOT::RMySQL))
110107
set(ENABLE_MYSQL OFF)
111-
message(STATUS "MySQL or ROOT::RMySQL not found, the corresponding classes won't be built.")
108+
message(
109+
STATUS
110+
"MySQL or ROOT::RMySQL not found, the corresponding classes won't be built."
111+
)
112112
endif()
113113

114+
configure_file(getTestDataDirectory.cxx.in getTestDataDirectory.cxx)
115+
114116
# ---- Subdirectories ----
115117

116118
add_subdirectory(Framework)

0 commit comments

Comments
 (0)