forked from BlueBrain/MorphIO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
85 lines (69 loc) · 2.16 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
cmake_minimum_required(VERSION 3.2)
#allow using of HDF5_ROOT for building with a custom HDF5 version
cmake_policy(SET CMP0074 NEW)
project(MorphIO VERSION 2.0.0)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_VERBOSE_MAKEFILE ON)
option(BUILD_BINDINGS "Build the python bindings" ON)
option(MorphIO_CXX_WARNINGS "Compile C++ with warnings" ON)
option(MorphIO_WERROR "If compiled with warnings, additionally activate '-Werror'" ON)
option(EXTERNAL_CATCH2 "Use Catch2 from external source" OFF)
option(EXTERNAL_HIGHFIVE "Use HighFive from external source" OFF)
option(EXTERNAL_PYBIND11 "Use pybind11 from external source" OFF)
option(MORPHIO_TESTS "Build tests" ON)
option(MORPHIO_USE_DOUBLE "Use doubles instead of floats" OFF)
if (NOT DEFINED MORPHIO_ENABLE_COVERAGE)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(MORPHIO_ENABLE_COVERAGE ON)
else()
set(MORPHIO_ENABLE_COVERAGE OFF)
endif()
endif()
if(MORPHIO_USE_DOUBLE)
add_definitions(-DMORPHIO_USE_DOUBLE)
message("Floating Point Type: double")
else()
message("Floating Point Type: float")
endif()
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake)
include(CompilerFlags)
set(CMAKE_CXX_FLAGS "${FLAGS}")
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if (EXTERNAL_HIGHFIVE)
find_package(HighFive REQUIRED)
endif()
if (EXTERNAL_PYBIND11)
find_package(pybind11 REQUIRED CONFIG)
endif()
set(MORPHIO_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include/)
add_subdirectory(3rdparty)
add_subdirectory(src)
if(BUILD_BINDINGS)
add_subdirectory(binds/python)
endif(BUILD_BINDINGS)
include(GNUInstallDirs)
install(
DIRECTORY ${MORPHIO_INCLUDE_DIR}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
install(
EXPORT MorphIOTargets
NAMESPACE MorphIO::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/MorphIO
)
install(
FILES ${CMAKE_CURRENT_LIST_DIR}/CMake/MorphIOConfig.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/MorphIO
)
if (MORPHIO_TESTS)
enable_testing()
if (EXTERNAL_CATCH2)
find_package(Catch2 REQUIRED)
else()
add_subdirectory(3rdparty/Catch2)
include(3rdparty/Catch2/contrib/Catch.cmake)
endif()
add_subdirectory(tests)
endif()