-
Notifications
You must be signed in to change notification settings - Fork 287
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
71 lines (57 loc) · 2.35 KB
/
CMakeLists.txt
File metadata and controls
71 lines (57 loc) · 2.35 KB
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
cmake_minimum_required(VERSION 3.15)
project(QuantExt CXX)
enable_testing()
get_library_name("QuantExt" QLE_LIB_NAME)
set_ql_library_name()
if (ORE_BUILD_TESTS)
SET(COMPONENTS_CONDITIONAL "unit_test_framework")
else()
SET(COMPONENTS_CONDITIONAL "")
endif()
find_package (Boost REQUIRED COMPONENTS ${COMPONENTS_CONDITIONAL} date_time thread serialization timer log_setup log filesystem OPTIONAL_COMPONENTS system chrono)
if (ORE_ENABLE_PARALLEL_UNIT_TEST_RUNNER AND UNIX AND NOT APPLE)
find_library(RT_LIBRARY rt REQUIRED)
endif()
find_package (Eigen3 3.3 NO_MODULE)
if (TARGET Eigen3::Eigen)
if(MSVC AND EXISTS ${Eigen3_INCLUDE_DIRS})
# for conan configuration
include_directories(${Eigen3_INCLUDE_DIRS})
add_compile_definitions(ORE_USE_EIGEN)
else()
get_target_property(Eigen3_include_dir Eigen3::Eigen INTERFACE_INCLUDE_DIRECTORIES)
if(EXISTS ${Eigen3_include_dir})
include_directories(${Eigen3_include_dir})
add_compile_definitions(ORE_USE_EIGEN)
elseif(NOT EXISTS ${Eigen3_include_dir} AND DEFINED ENV{Eigen3_INCLUDE_DIR})
# cases in which returned directory does not exist but an environment variable is set
include_directories($ENV{Eigen3_INCLUDE_DIR})
add_compile_definitions(ORE_USE_EIGEN)
else()
message([WARNING] " -- Could not find Eigen3 include directories. Building without Eigen3. Please set 'Eigen3_INCLUDE_DIR' in environment variables.")
endif()
endif()
endif()
if (ORE_PYTHON_INTEGRATION)
# manylinux environments do not have Development.Embed which will cause failure, but all other platforms require it
if(MANYLINUX)
find_package(Python COMPONENTS Interpreter Development.Module)
else()
find_package(Python COMPONENTS Interpreter Development)
endif()
include_directories(${Python_INCLUDE_DIRS})
endif()
include_directories(${Boost_INCLUDE_DIRS})
include_directories(${QUANTLIB_SOURCE_DIR})
include_directories(${ORETEST_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
add_link_directory_if_exists("${QUANTLIB_SOURCE_DIR}/build/ql")
add_link_directory_if_exists("${CMAKE_BINARY_DIR}/QuantLib/ql")
generate_git_hash(ore_qle)
add_subdirectory("qle")
if (ORE_BUILD_DOC)
add_subdirectory("doc")
endif()
if (ORE_BUILD_TESTS)
add_subdirectory("test")
endif()