-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
158 lines (111 loc) · 3.19 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
cmake_minimum_required(VERSION 3.0...3.8)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON)
####
# project settings
####
#set(CMAKE_C_COMPILER "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc")
#set(CMAKE_C_COMPILER "/usr/bin/cc")
#set(CMAKE_CXX_COMPILER "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++")
#set(CMAKE_CXX_COMPILER "/usr/bin/c++")
#set("{CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -lc++abi")
#set(CMAKE_C_COMPILER "/usr/bin/cc")
#set(CMAKE_CXX_COMPILER "/usr/bin/clang")
#set(CMAKE_CXX_COMPILER "/usr/local/Cellar/gcc/13.2.0/bin/c++-13")
project(GLAMER)
set(GLAMER_VERSION_MAJOR 0)
set(GLAMER_VERSION_MINOR 3)
set(GLAMER_VERSION ${GLAMER_VERSION_MAJOR}.${GLAMER_VERSION_MINOR})
#set (CMAKE_CXX_STANDARD 11)
####
# module settings
####
set(GLAMER_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/Modules")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${GLAMER_MODULE_PATH}")
include(GLAMER)
####
# dependencies
####
find_package(Threads)
if(ENABLE_FITS)
find_package(CFITSIO REQUIRED)
endif()
if(ENABLE_FFTW)
find_package(FFTW3 REQUIRED)
endif()
if(ENABLE_GSL)
find_package(GSL REQUIRED)
endif()
if(ENABLE_HEALPIX)
find_package(HEALPIX REQUIRED)
endif()
if(ENABLE_HDF5)
find_package(HDF5 REQUIRED)
endif()
if(ENABLE_CERF)
find_package(CERF REQUIRED)
endif()
if(ENABLE_EIGEN)
find_package (Eigen3 3.3 REQUIRED NO_MODULE)
endif()
####
# sources
####
add_subdirectory(NR)
add_subdirectory(CosmoLib)
add_subdirectory(SLsimLib)
####
# package
####
include(CMakePackageConfigHelpers)
export(TARGETS NR CosmoLib SLsimLib FILE GLAMERTargets.cmake)
export(PACKAGE GLAMER)
set(GLAMER_INCLUDE_DIRS
"${NR_SOURCE_DIR}/include"
"${CosmoLib_SOURCE_DIR}/include"
"${SLsimLib_SOURCE_DIR}/include"
)
set(GLAMER_LIBRARIES SLsimLib CosmoLib NR ${CMAKE_THREAD_LIBS_INIT})
set(GLAMER_DEFINITIONS)
if(ENABLE_FITS)
list(APPEND GLAMER_INCLUDE_DIRS ${CFITSIO_INCLUDE_DIRS})
list(APPEND GLAMER_LIBRARIES ${CFITSIO_LIBRARIES})
endif()
if(ENABLE_FFTW)
list(APPEND GLAMER_INCLUDE_DIRS ${FFTW3_INCLUDE_DIRS})
list(APPEND GLAMER_LIBRARIES ${FFTW3_LIBRARIES})
endif()
if(ENABLE_GSL)
list(APPEND GLAMER_INCLUDE_DIRS ${GSL_INCLUDE_DIRS})
list(APPEND GLAMER_LIBRARIES ${GSL_LIBRARIES})
endif()
if(ENABLE_HEALPIX)
list(APPEND GLAMER_INCLUDE_DIRS ${HEALPIX_INCLUDE_DIRS})
list(APPEND GLAMER_LIBRARIES ${HEALPIX_LIBRARIES})
endif()
if(ENABLE_HDF5)
list(APPEND GLAMER_INCLUDE_DIRS ${HDF5_INCLUDE_DIRS})
list(APPEND GLAMER_LIBRARIES ${HDF5_LIBRARIES})
list(APPEND GLAMER_DEFINITIONS ${HDF5_DEFINITIONS})
endif()
if(ENABLE_CERF)
list(APPEND GLAMER_INCLUDE_DIRS ${CERF_INCLUDE_DIRS})
list(APPEND GLAMER_LIBRARIES ${CERF_LIBRARIES})
list(APPEND GLAMER_DEFINITIONS ${CERF_DEFINITIONS})
endif()
if(ENABLE_EIGEN)
list(APPEND GLAMER_INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS})
list(APPEND GLAMER_LIBRARIES ${EIGEN_LIBRARIES})
list(APPEND GLAMER_DEFINITIONS ${EIGEN_DEFINITIONS})
endif()
write_basic_package_version_file(
GLAMERConfigVersion.cmake
VERSION ${GLAMER_VERSION}
COMPATIBILITY AnyNewerVersion
)
configure_file(
GLAMERConfig.cmake.in
GLAMERConfig.cmake
@ONLY
)