-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
152 lines (131 loc) · 4.83 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
cmake_minimum_required(VERSION 3.1)
project(Himalaya VERSION 2.0.0 LANGUAGES CXX Fortran)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
# require an Eigen installation
find_package(Eigen3 3.0 REQUIRED)
find_package(Mathematica 8.0)
# if needed, set your Fortran and C++ compiler
#set (CMAKE_Fortran_COMPILER gfortran)
#set (CMAKE_CXX_COMPILER clang++)
#set (CMAKE_CXX_COMPILER icpc)
# set the build type to release. If one needs debugging symbols, compile
# with "CMAKE_BUILD_TYPE Debug"
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
# set the C++ standard
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# enable all warnings in Debug mode
if(CMAKE_BUILD_TYPE STREQUAL Debug)
if(CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic")
endif()
endif()
# set paths
set(SOURCE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/source)
set(INCLUDE_PATH ${SOURCE_PATH}/include)
#include c++ header files
include_directories(${INCLUDE_PATH})
include_directories(${INCLUDE_PATH}/hierarchies)
include_directories(${INCLUDE_PATH}/mh2_eft)
include_directories(${INCLUDE_PATH}/mh2_fo)
include_directories(${INCLUDE_PATH}/mh2l)
include_directories(${INCLUDE_PATH}/misc)
include_directories(${EIGEN3_INCLUDE_DIR})
set(EXEC_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include/himalaya")
set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib")
# setting the correct version to all headers
configure_file (
"${INCLUDE_PATH}/version.hpp.in"
"${INCLUDE_PATH}/version.hpp")
# generate himalaya.pc file for pkg-config
configure_file (
"${PROJECT_SOURCE_DIR}/cmake/himalaya.pc.in"
"${CMAKE_BINARY_DIR}/himalaya.pc"
@ONLY)
# Himalaya library files
set(HIM_LIBSOURCES
# interface
${SOURCE_PATH}/HierarchyCalculator.cpp
${SOURCE_PATH}/HierarchyObject.cpp
${SOURCE_PATH}/Himalaya_interface.cpp
# hierarchies
${SOURCE_PATH}/hierarchies/H32q2g.cpp
${SOURCE_PATH}/hierarchies/H3.cpp
${SOURCE_PATH}/hierarchies/H3q22g.cpp
${SOURCE_PATH}/hierarchies/H4.cpp
${SOURCE_PATH}/hierarchies/H5.cpp
${SOURCE_PATH}/hierarchies/H5g1.cpp
${SOURCE_PATH}/hierarchies/H6b2qg2.cpp
${SOURCE_PATH}/hierarchies/H6b.cpp
${SOURCE_PATH}/hierarchies/H6bq22g.cpp
${SOURCE_PATH}/hierarchies/H6bq2g2.cpp
${SOURCE_PATH}/hierarchies/H6.cpp
${SOURCE_PATH}/hierarchies/H6g2.cpp
${SOURCE_PATH}/hierarchies/H9.cpp
${SOURCE_PATH}/hierarchies/H9q2.cpp
# EFT calculation
${SOURCE_PATH}/mh2_eft/Mh2EFTCalculator.cpp
${SOURCE_PATH}/mh2_eft/ThresholdCalculator.cpp
${SOURCE_PATH}/mh2_eft/threshold_loop_functions.cpp
# fixed-order calculation
${SOURCE_PATH}/mh2_fo/linalg2.cpp
${SOURCE_PATH}/mh2_fo/MSSM_mass_eigenstates.cpp
${SOURCE_PATH}/mh2_fo/pv.cpp
# helpers
${SOURCE_PATH}/misc/dilog.cpp)
# DSZ library files
set(DSZ_LIBSOURCES
${SOURCE_PATH}/mh2l/DSZHiggs.cpp
${SOURCE_PATH}/mh2l/DSZHiggs.f
${SOURCE_PATH}/mh2l/functs.f)
# build the himalaya and DSZ library
add_library(DSZ_static STATIC ${DSZ_LIBSOURCES})
set_target_properties(DSZ_static PROPERTIES OUTPUT_NAME DSZ)
add_library(DSZ_shared SHARED ${DSZ_LIBSOURCES})
set_target_properties(DSZ_shared PROPERTIES OUTPUT_NAME DSZ)
add_library(Himalaya_static STATIC ${HIM_LIBSOURCES})
set_target_properties(Himalaya_static PROPERTIES OUTPUT_NAME Himalaya)
add_library(Himalaya_shared SHARED ${HIM_LIBSOURCES})
set_target_properties(Himalaya_shared PROPERTIES OUTPUT_NAME Himalaya)
target_link_libraries(Himalaya_shared PUBLIC DSZ_shared)
# set the executable
add_executable(example ${SOURCE_PATH}/example.cpp)
target_link_libraries(example Himalaya_static DSZ_static)
# create LibrayLink executable
if(Mathematica_FOUND)
set(LL_SRC ${SOURCE_PATH}/LibraryLink/Himalaya_LibraryLink.cpp)
set(LL_LIB Himalaya_LibraryLink)
include_directories(${Mathematica_INCLUDE_DIR})
include_directories(${Mathematica_MathLink_INCLUDE_DIR})
Mathematica_ADD_LIBRARY(${LL_LIB} ${LL_SRC})
target_link_libraries(${LL_LIB} PRIVATE Himalaya_shared ${Mathematica_MathLink_LIBRARIES})
set_target_properties(${LL_LIB} PROPERTIES LINK_FLAGS "${Mathematica_MathLink_LINKER_FLAGS}")
Mathematica_ABSOLUTIZE_LIBRARY_DEPENDENCIES(${LL_LIB})
endif()
# install libraries
install(
TARGETS Himalaya_static Himalaya_shared DSZ_static DSZ_shared
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
)
# install public headers
install(FILES
"${INCLUDE_PATH}/HierarchyCalculator.hpp"
"${INCLUDE_PATH}/HierarchyObject.hpp"
"${INCLUDE_PATH}/Himalaya_interface.hpp"
"${INCLUDE_PATH}/version.hpp"
DESTINATION "${INCLUDE_INSTALL_DIR}")
# install himalaya.pc file
install(FILES
"${CMAKE_BINARY_DIR}/himalaya.pc"
DESTINATION "${LIB_INSTALL_DIR}/pkgconfig")
# adding documentation
add_subdirectory(doc)
# test
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/test)
enable_testing()
add_subdirectory(test)
endif()