forked from convince-project/smc_storm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
70 lines (55 loc) · 2.68 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
cmake_minimum_required(VERSION 3.5)
# set the project name and version
project(smc_storm VERSION 1.0)
# Enable compile commands export for clangd
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# specify the C++ standard
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# Make sure lib and binaries are separated
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
# search for Storm library
find_package(storm REQUIRED)
include(FetchContent)
FetchContent_Declare(
argparse
GIT_REPOSITORY https://github.com/p-ranav/argparse.git
GIT_TAG v3.0
)
FetchContent_MakeAvailable(argparse)
include_directories(include)
# Add all storm sources except cli.cpp
file(GLOB_RECURSE LIB_SRC_FILES ${PROJECT_SOURCE_DIR}/src/*/*.cpp)
add_library(${PROJECT_NAME}_lib SHARED ${LIB_SRC_FILES})
target_include_directories(${PROJECT_NAME}_lib PUBLIC ${storm_INCLUDE_DIR} ${storm-parsers_INCLUDE_DIR})
target_link_libraries(${PROJECT_NAME}_lib PUBLIC storm storm-parsers argparse)
add_executable(${PROJECT_NAME} src/cli.cpp)
target_link_libraries(${PROJECT_NAME} ${PROJECT_NAME}_lib)
include(CTest)
if(BUILD_TESTING)
find_package(GTest REQUIRED)
# Unit tests
add_executable(test_batch_buffer test/unit_tests/test_batch_buffer.cpp)
target_link_libraries(test_batch_buffer ${PROJECT_NAME}_lib GTest::gtest GTest::gtest_main)
gtest_add_tests(TARGET test_batch_buffer)
# System tests
# Copy the test files in the build folder
set(TEST_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test)
set(MODEL_DIRECTORY ${TEST_DIRECTORY}/system_tests/models)
file(GLOB_RECURSE models RELATIVE ${MODEL_DIRECTORY} ${MODEL_DIRECTORY}/*)
foreach(test_file ${models})
# Use configure_file so this is rerun each time make is invoked (as opposed to just cmake)
configure_file(${MODEL_DIRECTORY}/${test_file} models/${test_file} COPYONLY)
endforeach()
add_executable(test_jani_models test/system_tests/test_jani_models.cpp)
target_link_libraries(test_jani_models ${PROJECT_NAME}_lib GTest::gtest GTest::gtest_main)
gtest_add_tests(TARGET test_jani_models WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
add_executable(test_prism_models test/system_tests/test_prism_models.cpp)
target_link_libraries(test_prism_models ${PROJECT_NAME}_lib GTest::gtest GTest::gtest_main)
gtest_add_tests(TARGET test_prism_models WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
add_executable(test_trace_export test/system_tests/test_trace_export.cpp)
target_link_libraries(test_trace_export ${PROJECT_NAME}_lib GTest::gtest GTest::gtest_main)
gtest_add_tests(TARGET test_trace_export WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
endif()