-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
87 lines (75 loc) · 2.22 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
86
cmake_minimum_required(VERSION 3.23)
project(ode_solver)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
add_compile_options(-fsanitize=address)
add_link_options(-fsanitize=address)
################################
# Fetching dependencies
################################
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
FetchContent_Declare(
json
URL https://github.com/nlohmann/json/releases/download/v3.11.2/json.tar.xz
)
FetchContent_MakeAvailable(json)
################################
# muParser
################################
SET( muParser_SRC
deps/muParser.cpp
deps/muParserBase.cpp
deps/muParserBytecode.cpp
deps/muParserCallback.cpp
deps/muParserError.cpp
deps/muParserTokenReader.cpp)
################################
# Unit Tests
################################
enable_testing()
add_executable(unit_test
test/unit_test.cpp
src/ODESolver.h
src/ImplicitSolver.h
src/ExplicitEuler.h
src/ExplicitEuler.cpp
src/ImplicitEuler.cpp
src/ImplicitEuler.h
src/RungeKutta.cpp
src/RungeKutta.h
src/utilities.cpp
src/AdamsBashforthTwo.cpp
src/AdamsBashforthTwo.h
src/Heun.cpp
src/Heun.h
${muParser_SRC})
target_link_libraries(unit_test GTest::gtest_main)
include(GoogleTest)
gtest_add_tests(unit_test "" AUTO)
################################
# Main executable
################################
add_executable(solver src/solver.cpp
src/ODESolver.h
src/ImplicitSolver.h
src/ExplicitEuler.h
src/ExplicitEuler.cpp
src/ImplicitEuler.cpp
src/ImplicitEuler.h
src/RungeKutta.cpp
src/RungeKutta.h
src/utilities.h
src/utilities.cpp
src/AdamsBashforthTwo.cpp
src/AdamsBashforthTwo.h
src/Heun.cpp
src/Heun.h
${muParser_SRC})
include_directories(deps/include)
target_link_libraries(solver nlohmann_json::nlohmann_json)