forked from ArborPFA/ArborContent
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
165 lines (122 loc) · 5.69 KB
/
CMakeLists.txt
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#################################################
# cmake file for building APRILContent framework
# @author Eté Rémi ,IPNL
# Copyright (c) CNRS / IPNL
CMAKE_MINIMUM_REQUIRED( VERSION 2.8.2 FATAL_ERROR )
#################################################
# project name
PROJECT( APRILContent )
SET( ${PROJECT_NAME}_VERSION_MAJOR 01 )
SET( ${PROJECT_NAME}_VERSION_MINOR 05 )
SET( ${PROJECT_NAME}_VERSION_PATCH 01 )
FOREACH( _path ${CMAKE_PREFIX_PATH} )
FIND_PATH(pandora_cmake_path "PandoraCMakeSettings.cmake" ${_path}/cmakemodules)
IF (pandora_cmake_path)
BREAK()
ENDIF()
ENDFOREACH()
IF (pandora_cmake_path)
LIST(APPEND CMAKE_MODULE_PATH ${pandora_cmake_path})
ENDIF()
INCLUDE(PandoraCMakeSettings)
LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
INCLUDE( PandoraCMakeSettings )
OPTION( PANDORA_MONITORING "Whether to use PandoraMonitoring (requires ROOT)" OFF )
MESSAGE( STATUS "PANDORA_MONITORING : ${PANDORA_MONITORING}" )
OPTION( APRIL_PARALLEL "Whether to use multithreading (requires OpenMP)" OFF )
MESSAGE( STATUS "APRIL_PARALLEL : ${APRIL_PARALLEL}" )
OPTION( INSTALL_DOC "Set to OFF to skip build/install Documentation" OFF )
MESSAGE( STATUS "INSTALL_DOC : ${INSTALL_DOC}" )
### SOURCE ##################################################################
#include directories
INCLUDE_DIRECTORIES( ./include )
SET( INPUT_DIRS
APRILApi APRILObjects APRILCheating APRILClustering APRILHelpers APRILMonitoring APRILPfoConstruction APRILParticleId
APRILPlugins APRILReclustering APRILTools APRILTopologicalAssociation APRILTrackClusterAssociation APRILUtility )
FILE(GLOB INPUT_DIR_INCS ./include/*.h)
SOURCE_GROUP("Header files" FILES ${INPUT_DIR_INCS} )
LIST(APPEND APRILContent_INCS ${INPUT_DIR_INCS})
FOREACH( INPUT_DIR ${INPUT_DIRS} )
FILE(GLOB_RECURSE INPUT_DIR_INCS ./include/${INPUT_DIR}/*.h)
SOURCE_GROUP("Header files\\${INPUT_DIR}" FILES ${INPUT_DIR_INCS} )
LIST(APPEND APRILContent_INCS ${INPUT_DIR_INCS})
FILE (GLOB_RECURSE INPUT_DIR_SRCS ./src/${INPUT_DIR}/*.cc )
SOURCE_GROUP("Source files\\${INPUT_DIR}" FILES ${INPUT_DIR_SRCS} )
LIST(APPEND APRILContent_SRCS ${INPUT_DIR_SRCS})
ENDFOREACH()
### C++11 check #############################################################
INCLUDE( CheckCXXCompilerFlag )
#UNSET( COMPILER_SUPPORTS_CXX11 CACHE )
#CHECK_CXX_COMPILER_FLAG( "-std=c++11" COMPILER_SUPPORTS_CXX11 )
#IF( NOT CMAKE_CXX_FLAGS )
# SET( CMAKE_CXX_FLAGS "-std=c++11" )
# SET( PROCEED_WITHOUT_CXX_FLAGS ON )
#ENDIF()
#UNSET( COMPILER_SUPPORTS_CXX_FLAGS CACHE )
#CHECK_CXX_COMPILER_FLAG( ${CMAKE_CXX_FLAGS} COMPILER_SUPPORTS_CXX_FLAGS )
#IF( NOT COMPILER_SUPPORTS_CXX_FLAGS )
# MESSAGE( STATUS "The compiler ${CMAKE_CXX_COMPILER} does not support cxx flags ${CMAKE_CXX_FLAGS}" )
# IF( NOT PROCEED_WITHOUT_CXX_FLAGS )
# MESSAGE( FATAL_ERROR "CMake abort." )
# ENDIF()
# MESSAGE( STATUS "Proceed without cxx flags ${CMAKE_CXX_FLAGS}" )
# UNSET( CMAKE_CXX_FLAGS )
#ENDIF()
if(APPLE)
SET( CMAKE_CXX_FLAGS "-Wall -Wextra -pedantic -Wno-long-long -Wno-sign-compare -fno-strict-aliasing -fopenmp ${CMAKE_CXX_FLAGS}" )
else()
SET( CMAKE_CXX_FLAGS "-Wall -Wextra -ansi -pedantic -Wno-long-long -Wno-sign-compare -Wshadow -fno-strict-aliasing -fopenmp ${CMAKE_CXX_FLAGS}" )
endif()
# -------------- packages -------------
FIND_PACKAGE( PandoraSDK 02.00.00 REQUIRED )
INCLUDE_DIRECTORIES( ${PandoraSDK_INCLUDE_DIRS} )
LINK_LIBRARIES( ${PandoraSDK_LIBRARIES} )
ADD_DEFINITIONS ( ${PandoraSDK_DEFINITIONS} )
FIND_PACKAGE( ROOT 5.26.00 REQUIRED COMPONENTS Core Tree Physics Matrix Eve Geom RGL EG TMVA ) # minimum required ROOT version
INCLUDE_DIRECTORIES( ${ROOT_INCLUDE_DIRS} )
LINK_LIBRARIES( ${ROOT_LIBRARIES} ${ROOT_COMPONENT_LIBRARIES} )
ADD_DEFINITIONS ( ${ROOT_DEFINITIONS} )
IF( PANDORA_MONITORING )
FIND_PACKAGE( PandoraMonitoring REQUIRED )
INCLUDE_DIRECTORIES( ${PandoraMonitoring_INCLUDE_DIRS} )
LINK_LIBRARIES( ${PandoraMonitoring_LIBRARIES} )
ADD_DEFINITIONS ( ${PandoraMonitoring_DEFINITIONS} )
ADD_DEFINITIONS( "-DMONITORING" )
ENDIF()
IF( APRIL_PARALLEL )
FIND_PACKAGE( OpenMP REQUIRED )
ADD_DEFINITIONS( ${OpenMP_CXX_FLAGS} )
ADD_DEFINITIONS( "-DAPRIL_PARALLEL=1" )
ENDIF()
# mlpack
FIND_PACKAGE( mlpack REQUIRED )
INCLUDE_DIRECTORIES( SYSTEM ${mlpack_INCLUDE_DIRS} )
LINK_LIBRARIES( ${mlpack_LIBRARIES} )
FIND_PACKAGE( Boost REQUIRED )
INCLUDE_DIRECTORIES( SYSTEM ${Boost_INCLUDE_DIRS} )
FIND_PACKAGE( Armadillo REQUIRED )
INCLUDE_DIRECTORIES( SYSTEM ${ARMADILLO_INCLUDE_DIRS} )
# doc
IF( INSTALL_DOC AND EXISTS "${PROJECT_SOURCE_DIR}/doc/CMakeLists.txt" )
ADD_SUBDIRECTORY( ./doc )
ELSE()
MESSAGE( STATUS "INSTALL_DOC set to OFF" )
SET( INSTALL_DOC OFF )
ENDIF()
### LIBRARY #################################################################
# add library
ADD_LIBRARY( ${PROJECT_NAME} SHARED ${APRILContent_SRCS} ${APRILContent_INCS})
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${${PROJECT_NAME}_VERSION} SOVERSION ${${PROJECT_NAME}_SOVERSION})
IF( APRIL_PARALLEL )
TARGET_LINK_LIBRARIES( ${PROJECT_NAME} gomp )
ENDIF()
### INSTALL #################################################################
# install library
INSTALL( TARGETS ${PROJECT_NAME} DESTINATION lib COMPONENT Runtime )
# install header files
INSTALL( DIRECTORY include/ DESTINATION include )
#INSTALL( FILES "ChangeLog.txt" DESTINATION "${PROJECT_SOURCE_DIR}/docs" OPTIONAL )
# display some variables and write them to cache
PANDORA_DISPLAY_STD_VARIABLES()
# generate and install following configuration files
PANDORA_GENERATE_PACKAGE_CONFIGURATION_FILES( ${PROJECT_NAME}Config.cmake ${PROJECT_NAME}ConfigVersion.cmake ${PROJECT_NAME}LibDeps.cmake )