-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
107 lines (94 loc) · 3.51 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
cmake_minimum_required(VERSION 3.6.1)
project(Devstone)
# The version number.
set (Devstone_VERSION_MAJOR 0)
set (Devstone_VERSION_MINOR 0)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED OFF)
include(CheckCXXCompilerFlag)
# Check for standard to use
check_cxx_compiler_flag(-std=c++17 HAVE_FLAG_STD_CXX17)
if(HAVE_FLAG_STD_CXX17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic --std=c++17 -fPIC -g")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic --std=c++1z")
endif()
find_package(Boost COMPONENTS program_options unit_test_framework REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
## Dhrystone
# add_custom_command(OUTPUT dhry/dhry_1.o dhry/dhry_2.o
# COMMAND make
# WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/dhry
# )
## CDBoost
add_executable(cdboost-devstone
src/cdboost-devstone.cpp
src/cdboost-devstone-atomic.hpp
)
target_include_directories(cdboost-devstone
PUBLIC ${PROJECT_SOURCE_DIR}/simulators/cdboost/include
)
target_link_libraries(cdboost-devstone
${Boost_PROGRAM_OPTIONS_LIBRARY}
)
## Cadmium
add_executable(cadmium-devstone
src/cadmium-devstone.cpp
)
target_include_directories(cadmium-devstone
PUBLIC ${PROJECT_SOURCE_DIR}/simulators/cadmium/include
)
target_link_libraries(cadmium-devstone
${Boost_PROGRAM_OPTIONS_LIBRARY}
)
## Reference models used for developing and testing the model generators
add_executable(cadmium-dynamic-devstone
src/cadmium-dynamic-devstone.cpp
src/cadmium-devstone-atomic.hpp src/cadmium-event-reader.hpp
events.txt
)
target_include_directories(cadmium-dynamic-devstone
PUBLIC ${PROJECT_SOURCE_DIR}/simulators/cadmium/include
)
target_link_libraries(cadmium-dynamic-devstone
${Boost_PROGRAM_OPTIONS_LIBRARY}
)
## Reference models used for developing and testing the model generators
add_executable(cadmium-ref-LI
src/cadmium-ref-LI.cpp
src/cadmium-devstone-atomic.hpp src/cadmium-event-reader.hpp
events.txt
)
target_include_directories(cadmium-ref-LI
PUBLIC ${PROJECT_SOURCE_DIR}/simulators/cadmium/include
)
add_executable(cadmium-ref-HI
src/cadmium-ref-HI.cpp
src/cadmium-devstone-atomic.hpp src/cadmium-event-reader.hpp
events.txt
)
target_include_directories(cadmium-ref-HI
PUBLIC ${PROJECT_SOURCE_DIR}/simulators/cadmium/include
)
## Test that generated matches ref
enable_testing()
# Unit tests
FILE(GLOB TestSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} test/*_test.cpp)
foreach(testSrc ${TestSources})
get_filename_component(testName ${testSrc} NAME_WE)
add_executable(${testName}
test/main-test.cpp
${testSrc}
test/test_helpers.hpp)
target_include_directories(${testName}
PUBLIC ${PROJECT_SOURCE_DIR}/simulators/cadmium/include
)
target_link_libraries(${testName} PUBLIC ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
add_test(${testName} ${testName})
endforeach(testSrc)
##LI is 3x3
# TODO: This test should be rewritten comparing both models using DEVDiagrammer Json instead of source
add_test(NAME Cadmium_generator_LI_3x3
COMMAND test/check_generated_LI_against_ref.sh
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)