-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
53 lines (46 loc) · 1.62 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
cmake_minimum_required(VERSION 3.16)
#set the project name
project(SpinParser VERSION 1.0 LANGUAGES C CXX)
#define compile options
option(SPINPARSER_BUILD_TESTS "Build tests" ON)
option(SPINPARSER_BUILD_DOCUMENTATION "Build documentation" ON)
option(SPINPARSER_ENABLE_ASSERTIONS "Additional assertions for consistency checks and memory bounds enabled" OFF)
option(SPINPARSER_DISABLE_OMP "Disable OpenMP support" OFF)
option(SPINPARSER_DISABLE_MPI "Disable MPI support" OFF)
#set default build type to release
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
#locate libraries
#locate boost library
find_package(Boost 1.71 REQUIRED COMPONENTS regex thread system program_options filesystem timer date_time unit_test_framework)
#locate HDF5 library
find_package(HDF5 REQUIRED COMPONENTS C)
#locate OpenMP library
if(NOT SPINPARSER_DISABLE_OMP)
find_package(OpenMP REQUIRED)
endif()
#locate MPI library
if(NOT SPINPARSER_DISABLE_MPI)
find_package(MPI REQUIRED)
endif()
#set global compiler flags
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
#add subdirectories
add_subdirectory(src)
if(SPINPARSER_BUILD_TESTS)
enable_testing()
add_subdirectory(test)
endif()
if(SPINPARSER_BUILD_DOCUMENTATION)
add_subdirectory(doc/doc-index)
add_subdirectory(doc/doc-dev)
add_subdirectory(doc/doc-python)
endif()
#install supplemental files
install(DIRECTORY ${PROJECT_SOURCE_DIR}/examples/ DESTINATION examples)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/opt/ DESTINATION opt)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/res/ DESTINATION res)