Skip to content

Commit

Permalink
Add an extension point to allow inserting external libraries and defi…
Browse files Browse the repository at this point in the history
…nitions
  • Loading branch information
auto-differentiation-dev committed Jul 20, 2022
1 parent 9325cfc commit a803df3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,6 @@ nbproject
.dir-locals.el
Build.props
Directory.Build.props

# optional folder for extension projects
/ext
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ option(QL_USE_STD_CLASSES "Enable all QL_USE_STD_ options" OFF)
option(QL_USE_STD_SHARED_PTR "Use standard smart pointers instead of Boost ones" OFF)
option(QL_USE_STD_FUNCTION "Use std::function and std::bind instead of Boost ones" OFF)
option(QL_USE_STD_TUPLE "Use std::tuple instead of boost::tuple" OFF)
set(QL_EXTRA_LINK_LIBRARIES "" CACHE STRING "Optional extra link libraries to add to QuantLib")

# Convenience option to activate all STD options
if (QL_USE_STD_CLASSES)
Expand Down Expand Up @@ -204,6 +205,11 @@ endif()
include(CTest)
include(Platform)

# extension subdirectory if it exists (hook for external projects)
if(EXISTS ${PROJECT_SOURCE_DIR}/ext AND EXISTS ${PROJECT_SOURCE_DIR}/ext/CMakeLists.txt)
add_subdirectory(ext)
endif()

# Add subdirectories
add_subdirectory(ql)
if (QL_BUILD_EXAMPLES)
Expand Down
4 changes: 4 additions & 0 deletions ql/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2332,6 +2332,10 @@ target_compile_definitions(ql_library PRIVATE
target_compile_options(ql_library PRIVATE
${OpenMP_CXX_FLAGS})

if(NOT "${QL_EXTRA_LINK_LIBRARIES}" STREQUAL "")
target_link_libraries(ql_library PUBLIC ${QL_EXTRA_LINK_LIBRARIES})
endif()

target_include_directories(ql_library PUBLIC
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
Expand Down

0 comments on commit a803df3

Please sign in to comment.