forked from wenyan4work/STKFMM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
96 lines (81 loc) · 2.21 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
cmake_minimum_required(VERSION 3.10)
project(
STKFMM
VERSION 1.0
LANGUAGES CXX)
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_EXTENSIONS OFF)
# compiler flags
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# using Clang
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# using GCC
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
# using intel, disable offloading
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -qno-offload")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -qno-offload")
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
# using Visual Studio C++
endif()
set(MPI_CXX_SKIP_MPICXX
true
CACHE BOOL "The MPI-2 C++ bindings are disabled.")
# required compiler features
find_package(MPI REQUIRED)
# library
find_package(pvfmm REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(MKL CONFIG)
if(MKL_FOUND)
set(DEP_LIB MKL::MKL)
else()
find_package(OpenMP REQUIRED)
set(DEP_LIB OpenMP::OpenMP_CXX)
endif()
enable_testing()
set(BUILD_M2L
OFF
CACHE BOOL "compile M2L data generator")
set(BUILD_TEST
ON
CACHE BOOL "compile c++ test driver")
set(BUILD_DOC
OFF
CACHE BOOL "build doxygen doc")
set(PyInterface
OFF
CACHE BOOL "build python interface")
add_subdirectory(Lib)
add_subdirectory(Demo)
if(BUILD_M2L)
add_subdirectory(M2L)
endif()
if(BUILD_TEST)
add_subdirectory(Test)
endif()
if(PyInterface)
add_subdirectory(Python)
endif()
# doxygen documentation
if(BUILD_DOC)
find_package(Doxygen REQUIRED)
set(DOXYGEN_GENERATE_LATEX NO)
set(DOXYGEN_GENERATE_HTML YES)
set(DOXYGEN_GENERATE_MAN NO)
# set input and output files
set(DOXYGEN_IN ${CMAKE_SOURCE_DIR}/doc/Doxyfile.in)
set(DOXYGEN_OUT ${CMAKE_BINARY_DIR}/Doxyfile)
# request to configure the file
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
message("Doxygen build started")
# note the option ALL which allows to build the docs together with the application
add_custom_target(
doc_doxygen ALL
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen"
VERBATIM)
endif()