-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
146 lines (116 loc) · 4 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
cmake_minimum_required(VERSION 3.1)
project(motion-ca)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
option(BUILD_VIZ "build the visualization (requires SFML)" ON)
include_directories(include)
add_library(model SHARED
src/Point.cpp
src/Heading.cpp
src/Agent.cpp
src/ModelStats.cpp
src/Model.cpp
src/Network.cpp
src/Rule.cpp
src/MovementRule.cpp
src/LCA.cpp
src/LCAFactory.cpp
src/Range.cpp
src/transition_parser.cpp
src/TotalisticRule.cpp)
find_package(Threads REQUIRED)
# add_executable(one_d_lattice
# src/OneDLattice.cpp
# src/one_dimensional_lattice.cpp)
# target_link_libraries(one_d_lattice model pthread)
add_executable(velocity_experiment
src/velocity_experiment.cpp)
target_link_libraries(velocity_experiment model pthread)
add_executable(eval_at src/eval_at.cpp)
target_link_libraries(eval_at model)
# add_executable(velocity_experiment_time
# src/velocity_experiment_time.cpp)
# target_link_libraries(velocity_experiment_time model pthread)
# add_executable(levy_viz
# src/levy_viz.cpp)
# target_link_libraries(levy_viz model)
# add_executable(network_statistics
# src/network_statistics.cpp)
# target_link_libraries(network_statistics model)
# add_executable(random_spatial
# src/random_spatial.cpp)
# target_link_libraries(random_spatial model pthread)
# add_executable(random_regular
# src/random_regular_networks.cpp
# src/OneDLattice.cpp)
# target_link_libraries(random_regular model pthread)
# add_executable(density_sweep
# src/density_sweep.cpp)
# target_link_libraries(density_sweep model pthread)
# add_executable(velocity_sweep
# src/velocity_sweep.cpp)
# target_link_libraries(velocity_sweep model pthread)
# add_executable(density_history
# src/aggregate_density_history.cpp)
# target_link_libraries(density_history model)
# add_executable(synchronization
# src/synchronization.cpp)
# target_link_libraries(synchronization model pthread)
# add_executable(majority_history
# src/majority_history.cpp)
# target_link_libraries(majority_history model)
if(BUILD_VIZ)
set(CMAKE_MODULE_PATH "/usr/share/SFML/cmake/Modules" ${CMAKE_MODULE_PATH})
find_package(SFML 2 COMPONENTS graphics window system REQUIRED)
add_executable(sim_viz
src/sim_viz.cpp)
target_link_libraries(sim_viz model sfml-graphics sfml-window sfml-system)
endif(BUILD_VIZ)
configure_file(
scripts/levy_ca_experiment.sh.in
scripts/levy_ca_experiment.sh @ONLY)
configure_file(
scripts/ca_performance.gp.in
scripts/ca_performance.gp @ONLY)
## Build googletest and testcases
configure_file(CMakeLists.txt.in googletest-download/CMakeLists.txt)
# configure googletest
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
RESULT_VARIABLE result
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download )
if(result)
message(FATAL_ERROR "CMake step for googletest failed: ${result}")
endif()
# build googletest
execute_process(COMMAND ${CMAKE_COMMAND} --build .
RESULT_VARIABLE result
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download )
if(result)
message(FATAL_ERROR "Build step for googletest failed: ${result}")
endif()
# Prevent overriding the parent project's compiler/linker
# settings on Windows
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
# Add googletest directly to our build. This defines
# the gtest and gtest_main targets.
add_subdirectory(${CMAKE_BINARY_DIR}/googletest-src
${CMAKE_BINARY_DIR}/googletest-build
EXCLUDE_FROM_ALL)
# The gtest/gtest_main targets carry header search path
# dependencies automatically when using CMake 2.8.11 or
# later. Otherwise we have to add them here ourselves.
if (CMAKE_VERSION VERSION_LESS 2.8.11)
include_directories("${gtest_SOURCE_DIR}/include")
endif()
enable_testing()
add_executable(model_tests
test/point_test.cpp
test/heading_test.cpp
test/agent_test.cpp
test/model_test.cpp
test/network_test.cpp
test/model_stats_test.cpp
# test/rule_test.cpp
test/range_test.cpp)
target_link_libraries(model_tests model gmock_main)
add_test(ModelTests model_tests)