-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
133 lines (106 loc) · 4.89 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
cmake_minimum_required (VERSION 2.8.11)
project (HEPLike)
enable_testing()
message("######################################################")
message("# #")
message("# HEPLike software V1.0 #")
message("# J.Bhom, M.Chrzaszcz #")
message("# #")
message("# Documentation: #")
message("# https://github.com/mchrzasz/HEPLike #")
message("# GPL 3 license #")
message("# #")
message("######################################################")
list(APPEND CMAKE_PREFIX_PATH $ENV{ROOTSYS}/build)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} $ENV{ROOTSYS}/etc/cmake)
set(CMAKE_MACOSX_RPATH TRUE) # use @rpath keyword for the macOS rpath
###########################
#
# Compile seetings
#
###########################
# Add -fPIC for 64 bit systems
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
endif()
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
###########################
#
# Packages search
#
###########################
# looking for yaml-cpp
find_package(Yaml-cpp)
# looking for boost
find_package(Boost REQUIRED)
# GSL
find_package(GSL REQUIRED)
# ROOT:
find_package(ROOT REQUIRED COMPONENTS MathCore RIO Hist Tree Net)
include(${ROOT_USE_FILE})
include_directories(${CMAKE_SOURCE_DIR}/include ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
add_definitions(${ROOT_CXX_FLAGS})
###########################
#
# Config Variables
#
###########################
if(NOT DEFINED EXECUTABLE)
set(EXECUTABLE FALSE)
endif()
if(NOT DEFINED USE_ROOT)
set(USE_ROOT TRUE)
endif()
###########################
#
# Libraries
#
###########################
if(USE_ROOT)
file(GLOB HL_SOURCES ${CMAKE_SOURCE_DIR}/src/*.cc)
else()
file(GLOB HL_SOURCES ${CMAKE_SOURCE_DIR}/src/HL_Stats.cc ${CMAKE_SOURCE_DIR}/src/HL_nDimGaussian.cc ${CMAKE_SOURCE_DIR}/src/HL_nDimBifurGaussian.cc ${CMAKE_SOURCE_DIR}/src/HL_Limit.cc ${CMAKE_SOURCE_DIR}/src/HL_Gaussian.cc ${CMAKE_SOURCE_DIR}/src/HL_Data.cc ${CMAKE_SOURCE_DIR}/src/HL_BifurGaussian.cc )
endif()
add_library(HEPLike_static ${HL_SOURCES})
add_library(HEPLike_shared SHARED ${HL_SOURCES})
set_target_properties(HEPLike_static PROPERTIES OUTPUT_NAME HEPLike)
set_target_properties(HEPLike_shared PROPERTIES OUTPUT_NAME HEPLike)
target_link_libraries(HEPLike_shared PRIVATE ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${GSL_LIBRARIES} )
###########################
#
# Executables
#
###########################
if(EXECUTABLE AND USE_ROOT)
execute_process (
COMMAND bash -c "ln -s ../data_toy/ data"
)
add_executable(Br_example main/Br_example.cc)
add_executable(BrBifurGaussian_example main/BrBifurGaussian_example.cc)
add_executable(Limit_example main/Limit_example.cc)
add_executable(Ndim_Gaussian main/Ndim_Gaussian.cc)
add_executable(ProfLikelihood_example main/ProfLikelihood_example.cc)
add_executable(Ndim_BifurGaussian_example main/Ndim_BifurGaussian_example.cc)
add_executable(Ndim_Likelihood_example main/Ndim_Likelihood_example.cc)
add_executable(Data_Fit_example main/Data_Fit_example.cc)
add_executable(Test_YAML main/Test_YAML.cc)
target_link_libraries(Br_example HEPLike_shared yaml-cpp ${ROOT_LIBRARIES} ${Boost_LIBRARIES} )
target_link_libraries(BrBifurGaussian_example HEPLike_static yaml-cpp ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${GSL_LIBRARIES} )
target_link_libraries(Limit_example HEPLike_static yaml-cpp ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${GSL_LIBRARIES})
target_link_libraries(Ndim_Gaussian HEPLike_static yaml-cpp ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${GSL_LIBRARIES})
target_link_libraries(ProfLikelihood_example HEPLike_static yaml-cpp ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${GSL_LIBRARIES})
target_link_libraries(Ndim_BifurGaussian_example HEPLike_static yaml-cpp ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${GSL_LIBRARIES})
target_link_libraries(Ndim_Likelihood_example HEPLike_static yaml-cpp ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${GSL_LIBRARIES})
target_link_libraries(Data_Fit_example HEPLike_static yaml-cpp ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${GSL_LIBRARIES})
target_link_libraries(Test_YAML HEPLike_static yaml-cpp ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${GSL_LIBRARIES})
add_test(HL_Test_YAML Test_YAML ../data_toy/examples/test_3dimassym.yaml)
add_test(HL_Limit Limit_example xterm)
add_test(HL_Br_example Br_example)
add_test(HL_BrBifurGaussian_example BrBifurGaussian_example)
add_test(HL_Ndim_Gaussian Ndim_Gaussian)
add_test(HL_ProfLikelihood_example ProfLikelihood_example ${CMAKE_CURRENT_BINARY_DIR})
add_test(HL_Ndim_BifurGaussian_example Ndim_BifurGaussian_example)
endif()