-
Notifications
You must be signed in to change notification settings - Fork 39
/
CMakeLists.txt
109 lines (87 loc) · 2.78 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
# TOAST
# This minimum version is mostly set in order to get a newer version
# of the FindMPI check. Note that you can easily install a newer cmake version
# using conda or pip.
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
foreach(policy
CMP0048
CMP0074
CMP0077
CMP0063
)
if(POLICY ${policy})
cmake_policy(SET ${policy} NEW)
endif()
endforeach()
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/src/toast/RELEASE REL_VERSION)
string(REGEX REPLACE "^([0-9]+\\.[0-9]+)\\..*" "\\1" MAJMIN_VERSION "${REL_VERSION}")
project(toast VERSION ${MAJMIN_VERSION} LANGUAGES C CXX)
# Force C++11
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Set symbol visibility to hidden to be consistent with pybind11
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
# Auxiliary files
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
# Use GNUInstallDirs to install libraries into correct locations on all
# platforms.
include(GNUInstallDirs)
# Build defaults
include(BuildType)
# We are building libraries that will eventually be linked into shared
# modules. All code should be built with PIC.
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# External packages
# In some situations (like building python wheels), it is useful to statically link to
# our external dependencies. This allows us to ship self-contained compiled
# extensions. We check a variable here, and if set, we look for static versions of
# our dependencies.
#
if(NOT TOAST_STATIC_DEPS AND NOT $ENV{TOAST_STATIC_DEPS} STREQUAL "")
set(TOAST_STATIC_DEPS $ENV{TOAST_STATIC_DEPS})
endif()
# OpenMP
find_package(OpenMP)
if(TOAST_STATIC_DEPS)
set(BLA_STATIC TRUE)
set(FFTW_USE_STATIC_LIBS TRUE)
set(AATM_USE_STATIC_LIBS TRUE)
set(SUITESPARSE_USE_STATIC_LIBS TRUE)
endif()
# First look for MKL, since that will provide both FFT support and BLAS/LAPACK
find_package(MKL)
if(MKL_FOUND)
# Use MKL for BLAS / LAPACK
set(BLAS_LIBRARIES "${MKL_LIBRARIES}")
set(LAPACK_LIBRARIES "${MKL_LIBRARIES}")
set(BLAS_FOUND TRUE)
set(LAPACK_FOUND TRUE)
else()
# Search for FFTW instead
find_package(FFTW)
if(NOT FFTW_FOUND)
message(FATAL_ERROR "Could not find a supported FFT library (MKL or FFTW)")
endif()
find_package(BLAS)
find_package(LAPACK)
endif()
if(BLAS_FOUND)
if(LAPACK_FOUND)
find_package(LAPACKnames)
else()
if($ENV{READTHEDOCS} STREQUAL "")
message(FATAL_ERROR "Could not find a working LAPACK installation")
endif()
endif()
else()
if($ENV{READTHEDOCS} STREQUAL "")
message(FATAL_ERROR "Could not find a working BLAS installation")
endif()
endif()
find_package(AATM)
find_package(SuiteSparse)
find_package(PythonInterp REQUIRED)
# Internal products
enable_testing()
add_subdirectory(src)
add_subdirectory(pipelines)