Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# http://editorconfig.org

root = true

[{*.cmake,CMakeLists.txt}]
insert_final_newline = true
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# User presets should not be committed to source control
CMakeUserPresets.json
90 changes: 53 additions & 37 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,54 +7,66 @@ cmake_minimum_required(VERSION 3.5...3.20)

project(boost_numeric_odeint VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)

option(BOOST_NUMERIC_ODEINT_NO_ADAPTORS "Build odeint without boost::compute and boost::mpi support" OFF)

# Enable grouping of targets in IDE views
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

add_library(boost_numeric_odeint INTERFACE)
add_library(Boost::numeric_odeint ALIAS boost_numeric_odeint)

target_include_directories(boost_numeric_odeint INTERFACE include)

if(BOOST_NUMERIC_ODEINT_NO_ADAPTORS)
set(BOOST_ODEINT_REQUIRED_COMPONENTS
assert
config
core
fusion
iterator
math
mpl
multi_array
numeric_ublas
preprocessor
range
static_assert
throw_exception
type_traits
units
utility)
if(NOT BOOST_NUMERIC_ODEINT_NO_ADAPTORS)
list(APPEND BOOST_ODEINT_REQUIRED_COMPONENTS compute)
if(BOOST_ENABLE_MPI)
list(APPEND BOOST_ODEINT_REQUIRED_COMPONENTS mpi)
endif()
endif()
find_package(Boost REQUIRED COMPONENTS ${BOOST_ODEINT_REQUIRED_COMPONENTS})

target_link_libraries(boost_numeric_odeint
INTERFACE
Boost::assert
Boost::config
Boost::core
Boost::fusion
Boost::iterator
Boost::math
Boost::mpl
Boost::multi_array
Boost::numeric_ublas
Boost::preprocessor
Boost::range
Boost::static_assert
Boost::throw_exception
Boost::type_traits
Boost::units
Boost::utility
)
target_link_libraries(boost_numeric_odeint
INTERFACE
Boost::assert
Boost::config
Boost::core
Boost::fusion
Boost::iterator
Boost::math
Boost::mpl
Boost::multi_array
Boost::numeric_ublas
Boost::preprocessor
Boost::range
Boost::static_assert
Boost::throw_exception
Boost::type_traits
Boost::units
Boost::utility
)

else()
if(NOT BOOST_NUMERIC_ODEINT_NO_ADAPTORS)

target_link_libraries(boost_numeric_odeint
INTERFACE
Boost::assert
Boost::compute
Boost::config
Boost::core
Boost::fusion
Boost::iterator
Boost::math
Boost::mpl
Boost::multi_array
Boost::numeric_ublas
Boost::preprocessor
Boost::range
Boost::static_assert
Boost::throw_exception
Boost::type_traits
Boost::units
Boost::utility
)

# From CMake 3.30 linking against MPI when it does not exist gives errors
Expand All @@ -67,6 +79,10 @@ else()

endif()

if(BOOST_BUILD_EXAMPLES AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/examples/CMakeLists.txt")
add_subdirectory(examples)
endif()

if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")

add_subdirectory(test)
Expand Down
47 changes: 47 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
function(add_example name)
cmake_parse_arguments(PARSE_ARGV 1 ARG "" "CXX_STANDARD;FOLDER" "")
add_executable("${name}" "${name}.cpp")
target_compile_definitions("${name}" PRIVATE "BOOST_ALL_NO_LIB=1")
target_link_libraries("${name}" PRIVATE Boost::numeric_odeint)
if(NOT ARG_FOLDER)
set(ARG_FOLDER "Examples")
endif()
set_target_properties("${name}" PROPERTIES FOLDER "${ARG_FOLDER}")
if(ARG_CXX_STANDARD)
set_target_properties("${name}" PROPERTIES CXX_STANDARD "${ARG_CXX_STANDARD}")
endif()
endfunction()

add_example(harmonic_oscillator)
add_example(solar_system)
add_example(chaotic_system)
add_example(stiff_system)
add_example(fpu)
add_example(phase_oscillator_ensemble)
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_example(harmonic_oscillator_units)
endif()
add_example(stuart_landau)
add_example(two_dimensional_phase_lattice)
add_example(bulirsch_stoer)
add_example(elliptic_functions)
add_example(resizing_lattice)
add_example(list_lattice)
add_example(stepper_details)
add_example(my_vector)
add_example(lorenz)
add_example(lorenz_point)
add_example(van_der_pol_stiff)
add_example(simple1d)
add_example(stochastic_euler)
add_example(generation_functions)
add_example(heun)
add_example(bind_member_functions)
add_example(bind_member_functions_cpp11 CXX_STANDARD 14)
add_example(molecular_dynamics CXX_STANDARD 14)
add_example(molecular_dynamics_cells CXX_STANDARD 14)
add_example(abm_precision)
add_example(integrate_times)
add_example(find_crossing CXX_STANDARD 14)

add_subdirectory(multiprecision)
2 changes: 2 additions & 0 deletions examples/multiprecision/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
add_example(lorenz_mp FOLDER "Examples/Multiprecision")
add_example(cmp_precision FOLDER "Examples/Multiprecision")
Loading