-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
179 lines (152 loc) · 5.38 KB
/
CMakeLists.txt
File metadata and controls
179 lines (152 loc) · 5.38 KB
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
cmake_minimum_required(VERSION 3.5.2)
OPTION(DEBUG "DEBUG flag" OFF)
IF(DEBUG)
ADD_DEFINITIONS(-DDEBUG)
ENDIF(DEBUG)
project(fastcode)
##### Setting up the CXX flags #####
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_DEFAULT} -std=c++11 -Wall -Wextra -O3 -fno-tree-vectorize -mavx2 -mfma")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS_DEFAULT} -std=c11 -Wall -Wextra -O3 -fno-tree-vectorize -mavx2 -mfma")
##### DEBUG #####
##### Using FindCriterion.cmake we find the package ######
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/modules/")
find_package(Criterion REQUIRED)
##### Include header files #####
include_directories(
include
)
##### Source files to compile for benchmark executable #####
add_executable(benchmark
src/benchmark.cpp
src/run_benchmark.cpp
src/cpp_utils.cpp
src/penguin.c
src/hgwosca.c
src/pso.c
src/squirrel.c
src/objectives.c
src/utils.c)
##### hgwosca integration test executable ######
add_executable(test_integration_hgwosca
tests/test_integration_hgwosca.c
tests/testing_utilities.c
src/hgwosca.c
src/objectives.c
src/utils.c)
target_include_directories(test_integration_hgwosca PRIVATE ${CRITERION_INCLUDE_DIRS})
target_link_libraries(test_integration_hgwosca
PRIVATE ${CRITERION_LIBRARIES}
m)
##### hgwosca unit test ######
add_executable(test_hgwosca
tests/test_hgwosca.c
src/cpp_utils.cpp
src/hgwosca.c
src/utils.c
src/objectives.c)
target_include_directories(test_hgwosca PRIVATE ${CRITERION_INCLUDE_DIRS})
target_link_libraries(test_hgwosca PRIVATE ${CRITERION_LIBRARIES})
##### pso basic integration test executable ######
add_executable(test_integration_pso
tests/test_integration_pso.c
tests/testing_utilities.c
src/pso.c
src/objectives.c
src/utils.c)
target_include_directories(test_integration_pso PRIVATE ${CRITERION_INCLUDE_DIRS})
target_link_libraries(test_integration_pso
PRIVATE ${CRITERION_LIBRARIES}
m)
##### pso basic unit test ######
add_executable(test_pso
tests/test_pso.c
src/cpp_utils.cpp
src/pso.c
src/utils.c
src/objectives.c)
target_include_directories(test_pso PRIVATE ${CRITERION_INCLUDE_DIRS})
target_link_libraries(test_pso PRIVATE ${CRITERION_LIBRARIES})
##### squirrel integration test executable ######
add_executable(test_integration_squirrel
tests/test_integration_squirrel.c
tests/testing_utilities.c
src/squirrel.c
src/objectives.c
src/utils.c)
target_include_directories(test_integration_squirrel PRIVATE ${CRITERION_INCLUDE_DIRS})
target_link_libraries(test_integration_squirrel
PRIVATE ${CRITERION_LIBRARIES}
m)
##### squirrel unit test ######
add_executable(test_squirrel
tests/test_squirrel.c
src/cpp_utils.cpp
src/squirrel.c
src/utils.c
src/objectives.c)
target_include_directories(test_squirrel PRIVATE ${CRITERION_INCLUDE_DIRS})
target_link_libraries(test_squirrel PRIVATE ${CRITERION_LIBRARIES})
##### Penguin integration test executable ######
add_executable(test_integration_pengu
tests/test_integration_pengu.c
tests/testing_utilities.c
src/penguin.c
src/objectives.c
src/utils.c)
target_include_directories(test_integration_pengu PRIVATE ${CRITERION_INCLUDE_DIRS})
target_link_libraries(test_integration_pengu
PRIVATE ${CRITERION_LIBRARIES}
m)
##### penguin unit test ######
add_executable(test_penguin
tests/test_penguin.c
src/cpp_utils.cpp
src/penguin.c
src/utils.c
src/objectives.c)
target_include_directories(test_penguin PRIVATE ${CRITERION_INCLUDE_DIRS})
target_link_libraries(test_penguin PRIVATE ${CRITERION_LIBRARIES} m)
##### objectives unit test ######
add_executable(test_objectives
tests/test_objectives.c
src/cpp_utils.cpp
src/objectives.c
src/utils.c)
target_include_directories(test_objectives PRIVATE ${CRITERION_INCLUDE_DIRS})
target_link_libraries(test_objectives PRIVATE ${CRITERION_LIBRARIES})
##### objectives unit test ######
add_executable(test_utils
tests/test_utils.c
src/utils.c)
target_include_directories(test_utils PRIVATE ${CRITERION_INCLUDE_DIRS})
target_link_libraries(test_utils PRIVATE ${CRITERION_LIBRARIES})
##### All unit tests together #####
add_executable(test_units
tests/test_objectives.c
tests/test_hgwosca.c
tests/test_penguin.c
tests/test_squirrel.c
tests/test_pso.c
tests/test_cpp_utils.cpp
tests/test_utils.c
src/cpp_utils.cpp
src/hgwosca.c
src/penguin.c
src/squirrel.c
src/pso.c
src/objectives.c
src/utils.c
src/utils.c)
target_include_directories(test_units PRIVATE ${CRITERION_INCLUDE_DIRS})
target_link_libraries(test_units PRIVATE ${CRITERION_LIBRARIES})
enable_testing()
add_test(unit
test_units -q)
add_test(integration_hgwosca
test_integration_hgwosca -q)
add_test(integration_pengu
test_integration_pengu -q)
add_test(integration_pso
test_integration_pso -q)
add_test(integration_squirrel
test_integration_squirrel -q)