-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
141 lines (112 loc) · 6.31 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
# Check if cmake has the required version
CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)
cmake_policy(SET CMP0042 NEW)
project(NEMO3Ana)
include(FindROOT.cmake)
#Check the compiler and set the compile and link flags
set(CMAKE_BUILD_TYPE Debug)
set(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/lib")
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin")
set(INCLUDE_DIRECTORIES ${ROOT_INCLUDE_DIR})
include_directories( ${INCLUDE_DIRECTORIES})
set(LINK_DIRECTORIES ${ROOT_LIBRARY_DIR})
link_directories( ${LINK_DIRECTORIES})
#if (CMAKE_SYSTEM_NAME MATCHES Darwin)
# EXEC_PROGRAM("sw_vers -productVersion | cut -d . -f 1-2" OUTPUT_VARIABLE MAC_OS_VERSION)
# MESSAGE("--- Found a Mac OS X System ${MAC_OS_VERSION}")
# if (CMAKE_COMPILER_IS_GNUCXX)
# MESSAGE("--- Found GNU compiler collection")
#
# STRING(COMPARE EQUAL "10.5" "${MAC_OS_VERSION}" MAC_OS_10_5)
# IF(MAC_OS_10_5)
# SET(CMAKE_CXX_FLAGS "-m64")
# SET(CMAKE_Fortran_FLAGS "-m64")
# ENDIF(MAC_OS_10_5)
#
# SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS} -flat_namespace -single_module -undefined dynamic_lookup")
# SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -flat_namespace -single_module -undefined dynamic_lookup")
#
# # Select flags.
# set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
# set(CMAKE_CXX_FLAGS_RELEASE "-O2")
# set(CMAKE_CXX_FLAGS_DEBUG "-g -O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline")
# set(CMAKE_CXX_FLAGS_DEBUGFULL "-g3 -fno-inline -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wformat-security -fno-exceptions -fno-check-new -fno-common")
# set(CMAKE_CXX_FLAGS_PROFILE "-g3 -fno-inline -ftest-coverage -fprofile-arcs")
# set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g")
# set(CMAKE_C_FLAGS_RELEASE "-O2")
# set(CMAKE_C_FLAGS_DEBUG "-g -O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline")
# set(CMAKE_C_FLAGS_DEBUGFULL "-g3 -fno-inline -Wno-long-long -std=iso9899:1990 -Wundef -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common")
# set(CMAKE_C_FLAGS_PROFILE "-g3 -fno-inline -ftest-coverage -fprofile-arcs")
#
#
#
# endif (CMAKE_COMPILER_IS_GNUCXX)
#
#endif (CMAKE_SYSTEM_NAME MATCHES Darwin)
#Retry project header and source files
#file(GLOB CPP_FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cc)
#file(GLOB HPP_FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.h)
# fill list of source files
set(CPP_FILES
${CMAKE_CURRENT_SOURCE_DIR}/src/Fit.cc
${CMAKE_CURRENT_SOURCE_DIR}/src/DataManagement.cc
${CMAKE_CURRENT_SOURCE_DIR}/src/ProcessChannel.cc
${CMAKE_CURRENT_SOURCE_DIR}/src/Observable.cc
${CMAKE_CURRENT_SOURCE_DIR}/src/Component.cc
${CMAKE_CURRENT_SOURCE_DIR}/src/Group.cc
${CMAKE_CURRENT_SOURCE_DIR}/src/Parameter.cc
${CMAKE_CURRENT_SOURCE_DIR}/src/DataSet.cc
${CMAKE_CURRENT_SOURCE_DIR}/src/HistoCollection.cc
)
# fill list of header files
set(HPP_FILES
${CMAKE_CURRENT_SOURCE_DIR}/src/Fit.h
${CMAKE_CURRENT_SOURCE_DIR}/src/DataManagement.h
${CMAKE_CURRENT_SOURCE_DIR}/src/ProcessChannel.h
${CMAKE_CURRENT_SOURCE_DIR}/src/Observable.h
${CMAKE_CURRENT_SOURCE_DIR}/src/Component.h
${CMAKE_CURRENT_SOURCE_DIR}/src/Group.h
${CMAKE_CURRENT_SOURCE_DIR}/src/Parameter.h
${CMAKE_CURRENT_SOURCE_DIR}/src/DataSet.h
${CMAKE_CURRENT_SOURCE_DIR}/src/HistoCollection.h
)
# set everything needed for the root dictonary and create the dictionary
set(LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/src/LinkDef.h )
set(DICTIONARY ${CMAKE_CURRENT_BINARY_DIR}/Dict.cxx)
ROOT_GENERATE_DICTIONARY("${HPP_FILES}" "${LINKDEF}" "${DICTIONARY}" "${INCLUDE_DIRECTORIES}")
# add the LinkDef to the list of header files
SET(HPP_FILES ${HPP_FILES} ${LINKDEF})
# add the dictionary to the list of source files
SET(CPP_FILES ${CPP_FILES} ${DICTIONARY})
############### build the library #####################
add_library(NEMO3Ana SHARED ${CPP_FILES} ${HPP_FILES})
target_link_libraries(NEMO3Ana ${ROOT_LIBRARIES})
############### install the library ###################
install(TARGETS NEMO3Ana DESTINATION ${CMAKE_BINARY_DIR}/lib)
############### Executable to be linked to Collie ###################
find_library (ISCOLLIE CollieIO /afs/in2p3.fr/throng/nemo/users/remoto/work/collie/lib/)
IF (ISCOLLIE)
add_library(CollieCLHEP SHARED IMPORTED)
set_property(TARGET CollieCLHEP PROPERTY IMPORTED_LOCATION /afs/in2p3.fr/throng/nemo/users/remoto/work/collie/CLHEP/lib/libCollieCLHEP.so)
add_library(CollieIO SHARED IMPORTED)
set_property(TARGET CollieIO PROPERTY IMPORTED_LOCATION /afs/in2p3.fr/throng/nemo/users/remoto/work/collie/lib/libCollieIO.so)
add_library(CollieLimit SHARED IMPORTED)
set_property(TARGET CollieLimit PROPERTY IMPORTED_LOCATION /afs/in2p3.fr/throng/nemo/users/remoto/work/collie/lib/libCollieLimit.so)
include_directories(/afs/in2p3.fr/throng/nemo/users/remoto/work/collie/)
#include_directories(/afs/in2p3.fr/throng/nemo/users/remoto/work/collie/CLHEP/Units)
#include_directories(/afs/in2p3.fr/throng/nemo/users/remoto/work/collie/CLHEP/Random)
include_directories(/afs/in2p3.fr/throng/nemo/users/remoto/work/collie/io/include)
include_directories(/afs/in2p3.fr/throng/nemo/users/remoto/work/collie/limit/include)
add_executable(collieIO_EXAMPLE ${CMAKE_CURRENT_SOURCE_DIR}/src/collieIO_EXAMPLE.cc)
target_link_libraries(collieIO_EXAMPLE CollieCLHEP CollieIO CollieLimit ${ROOT_LIBRARIES})
add_executable(collieIO_BDT ${CMAKE_CURRENT_SOURCE_DIR}/src/collieIO_BDT.cc)
target_link_libraries(collieIO_BDT CollieCLHEP CollieIO CollieLimit ${ROOT_LIBRARIES})
add_executable(collieIO_En ${CMAKE_CURRENT_SOURCE_DIR}/src/collieIO_En.cc)
target_link_libraries(collieIO_En CollieCLHEP CollieIO CollieLimit ${ROOT_LIBRARIES})
add_executable(collieLC ${CMAKE_CURRENT_SOURCE_DIR}/src/collieLC.cc)
target_link_libraries(collieLC CollieCLHEP CollieIO CollieLimit ${ROOT_LIBRARIES})
add_executable(collieLC_m1s ${CMAKE_CURRENT_SOURCE_DIR}/src/collieLC_m1s.cc)
target_link_libraries(collieLC_m1s CollieCLHEP CollieIO CollieLimit ${ROOT_LIBRARIES})
add_executable(collieLC_p1s ${CMAKE_CURRENT_SOURCE_DIR}/src/collieLC_p1s.cc)
target_link_libraries(collieLC_p1s CollieCLHEP CollieIO CollieLimit ${ROOT_LIBRARIES})
ENDIF (ISCOLLIE)