blob: 0979d552dea66fe4f4eac188b8413693c773ad66 [file] [log] [blame]
telsoa014fcda012018-03-09 14:13:49 +00001# UnitTests
2include(CheckIncludeFiles)
3
4include_directories(SYSTEM "${THIRD_PARTY_INCLUDE_DIRS}")
5
6# Setup the inference test framework
7set(inference_test_sources
8 ClassifierTestCaseData.hpp
9 InferenceModel.hpp
10 InferenceTest.hpp
11 InferenceTest.inl
12 InferenceTest.cpp
13 InferenceTestImage.hpp
14 InferenceTestImage.cpp)
15add_library_ex(inferenceTest STATIC ${inference_test_sources})
16target_include_directories(inferenceTest PRIVATE ../src/armnnUtils)
17
18if(BUILD_CAFFE_PARSER)
19 macro(CaffeParserTest testName sources)
20 add_executable_ex(${testName} ${sources})
21 target_include_directories(${testName} PRIVATE ../src/armnnUtils)
22 set_target_properties(${testName} PROPERTIES COMPILE_FLAGS "${CAFFE_PARSER_TEST_ADDITIONAL_COMPILE_FLAGS}")
23
24 target_link_libraries(${testName} inferenceTest)
25 target_link_libraries(${testName} armnnCaffeParser)
26 target_link_libraries(${testName} armnn)
27 target_link_libraries(${testName} ${CMAKE_THREAD_LIBS_INIT})
28 if(OPENCL_LIBRARIES)
29 target_link_libraries(${testName} ${OPENCL_LIBRARIES})
30 endif()
31 target_link_libraries(${testName}
32 ${Boost_SYSTEM_LIBRARY}
33 ${Boost_FILESYSTEM_LIBRARY}
34 ${Boost_PROGRAM_OPTIONS_LIBRARY})
35 addDllCopyCommands(${testName})
36 endmacro()
37
38 set(CaffeCifar10AcrossChannels-Armnn_sources
39 CaffeCifar10AcrossChannels-Armnn/CaffeCifar10AcrossChannels-Armnn.cpp
40 Cifar10Database.hpp
41 Cifar10Database.cpp)
42 CaffeParserTest(CaffeCifar10AcrossChannels-Armnn "${CaffeCifar10AcrossChannels-Armnn_sources}")
43
44 set(CaffeMnist-Armnn_sources
45 CaffeMnist-Armnn/CaffeMnist-Armnn.cpp
46 MnistDatabase.hpp
47 MnistDatabase.cpp)
48 CaffeParserTest(CaffeMnist-Armnn "${CaffeMnist-Armnn_sources}")
49
50 set(CaffeAlexNet-Armnn_sources
51 CaffeAlexNet-Armnn/CaffeAlexNet-Armnn.cpp
telsoa01c577f2c2018-08-31 09:22:23 +010052 CaffePreprocessor.hpp
53 CaffePreprocessor.cpp)
telsoa014fcda012018-03-09 14:13:49 +000054 CaffeParserTest(CaffeAlexNet-Armnn "${CaffeAlexNet-Armnn_sources}")
55
56 set(MultipleNetworksCifar10_SRC
57 MultipleNetworksCifar10/MultipleNetworksCifar10.cpp
58 Cifar10Database.hpp
59 Cifar10Database.cpp)
60 CaffeParserTest(MultipleNetworksCifar10 "${MultipleNetworksCifar10_SRC}")
61
62 set(CaffeResNet-Armnn_sources
63 CaffeResNet-Armnn/CaffeResNet-Armnn.cpp
telsoa01c577f2c2018-08-31 09:22:23 +010064 CaffePreprocessor.hpp
65 CaffePreprocessor.cpp)
telsoa014fcda012018-03-09 14:13:49 +000066 CaffeParserTest(CaffeResNet-Armnn "${CaffeResNet-Armnn_sources}")
67
68 set(CaffeVGG-Armnn_sources
69 CaffeVGG-Armnn/CaffeVGG-Armnn.cpp
telsoa01c577f2c2018-08-31 09:22:23 +010070 CaffePreprocessor.hpp
71 CaffePreprocessor.cpp)
telsoa014fcda012018-03-09 14:13:49 +000072 CaffeParserTest(CaffeVGG-Armnn "${CaffeVGG-Armnn_sources}")
73
74 set(CaffeInception_BN-Armnn_sources
75 CaffeInception_BN-Armnn/CaffeInception_BN-Armnn.cpp
telsoa01c577f2c2018-08-31 09:22:23 +010076 CaffePreprocessor.hpp
77 CaffePreprocessor.cpp)
telsoa014fcda012018-03-09 14:13:49 +000078 CaffeParserTest(CaffeInception_BN-Armnn "${CaffeInception_BN-Armnn_sources}")
79
80 set(CaffeYolo-Armnn_sources
81 CaffeYolo-Armnn/CaffeYolo-Armnn.cpp
82 YoloDatabase.hpp
83 YoloDatabase.cpp
84 YoloInferenceTest.hpp)
85 CaffeParserTest(CaffeYolo-Armnn "${CaffeYolo-Armnn_sources}")
86endif()
87
surmeh01bceff2f2018-03-29 16:29:27 +010088if(BUILD_TF_PARSER)
89 macro(TfParserTest testName sources)
90 add_executable_ex(${testName} ${sources})
91 target_include_directories(${testName} PRIVATE ../src/armnnUtils)
92
93 target_link_libraries(${testName} inferenceTest)
94 target_link_libraries(${testName} armnnTfParser)
95 target_link_libraries(${testName} armnn)
96 target_link_libraries(${testName} ${CMAKE_THREAD_LIBS_INIT})
97 if(OPENCL_LIBRARIES)
98 target_link_libraries(${testName} ${OPENCL_LIBRARIES})
99 endif()
100 target_link_libraries(${testName}
101 ${Boost_SYSTEM_LIBRARY}
102 ${Boost_FILESYSTEM_LIBRARY}
103 ${Boost_PROGRAM_OPTIONS_LIBRARY})
104 addDllCopyCommands(${testName})
105 endmacro()
106
107 set(TfMnist-Armnn_sources
108 TfMnist-Armnn/TfMnist-Armnn.cpp
109 MnistDatabase.hpp
110 MnistDatabase.cpp)
111 TfParserTest(TfMnist-Armnn "${TfMnist-Armnn_sources}")
112
113 set(TfCifar10-Armnn_sources
114 TfCifar10-Armnn/TfCifar10-Armnn.cpp
115 Cifar10Database.hpp
116 Cifar10Database.cpp)
117 TfParserTest(TfCifar10-Armnn "${TfCifar10-Armnn_sources}")
118
119 set(TfMobileNet-Armnn_sources
120 TfMobileNet-Armnn/TfMobileNet-Armnn.cpp
telsoa01c577f2c2018-08-31 09:22:23 +0100121 ImagePreprocessor.hpp
122 ImagePreprocessor.cpp)
surmeh01bceff2f2018-03-29 16:29:27 +0100123 TfParserTest(TfMobileNet-Armnn "${TfMobileNet-Armnn_sources}")
124
125 set(TfInceptionV3-Armnn_sources
126 TfInceptionV3-Armnn/TfInceptionV3-Armnn.cpp
telsoa01c577f2c2018-08-31 09:22:23 +0100127 ImagePreprocessor.hpp
128 ImagePreprocessor.cpp)
surmeh01bceff2f2018-03-29 16:29:27 +0100129 TfParserTest(TfInceptionV3-Armnn "${TfInceptionV3-Armnn_sources}")
surmeh013537c2c2018-05-18 16:31:43 +0100130
131 set(TfResNext-Armnn_sources
132 TfResNext_Quantized-Armnn/TfResNext_Quantized-Armnn.cpp
telsoa01c577f2c2018-08-31 09:22:23 +0100133 CaffePreprocessor.hpp
134 CaffePreprocessor.cpp)
surmeh013537c2c2018-05-18 16:31:43 +0100135 TfParserTest(TfResNext-Armnn "${TfResNext-Armnn_sources}")
surmeh01bceff2f2018-03-29 16:29:27 +0100136endif()
137
telsoa01c577f2c2018-08-31 09:22:23 +0100138if (BUILD_TF_LITE_PARSER)
139 macro(TfLiteParserTest testName sources)
140 add_executable_ex(${testName} ${sources})
141 target_include_directories(${testName} PRIVATE ../src/armnnUtils)
142
143 target_link_libraries(${testName} inferenceTest)
144 target_link_libraries(${testName} armnnTfLiteParser)
145 target_link_libraries(${testName} armnn)
146 target_link_libraries(${testName} ${CMAKE_THREAD_LIBS_INIT})
147 if(OPENCL_LIBRARIES)
148 target_link_libraries(${testName} ${OPENCL_LIBRARIES})
149 endif()
150 target_link_libraries(${testName}
151 ${Boost_SYSTEM_LIBRARY}
152 ${Boost_FILESYSTEM_LIBRARY}
153 ${Boost_PROGRAM_OPTIONS_LIBRARY})
154 addDllCopyCommands(${testName})
155 endmacro()
156
157 set(TfLiteMobilenetQuantized-Armnn_sources
158 TfLiteMobilenetQuantized-Armnn/TfLiteMobilenetQuantized-Armnn.cpp
159 ImagePreprocessor.hpp
160 ImagePreprocessor.cpp)
161 TfLiteParserTest(TfLiteMobilenetQuantized-Armnn "${TfLiteMobilenetQuantized-Armnn_sources}")
162endif()
163
164if (BUILD_ONNX_PARSER)
165 macro(OnnxParserTest testName sources)
166 add_executable_ex(${testName} ${sources})
167 target_include_directories(${testName} PRIVATE ../src/armnnUtils)
168
169 target_link_libraries(${testName} inferenceTest)
170 target_link_libraries(${testName} armnnOnnxParser)
171 target_link_libraries(${testName} armnn)
172 target_link_libraries(${testName} ${CMAKE_THREAD_LIBS_INIT})
173 if(OPENCL_LIBRARIES)
174 target_link_libraries(${testName} ${OPENCL_LIBRARIES})
175 endif()
176 target_link_libraries(${testName}
177 ${Boost_SYSTEM_LIBRARY}
178 ${Boost_FILESYSTEM_LIBRARY}
179 ${Boost_PROGRAM_OPTIONS_LIBRARY})
180 addDllCopyCommands(${testName})
181 endmacro()
182
183 set(OnnxMnist-Armnn_sources
184 OnnxMnist-Armnn/OnnxMnist-Armnn.cpp
185 MnistDatabase.hpp
186 MnistDatabase.cpp)
187 OnnxParserTest(OnnxMnist-Armnn "${OnnxMnist-Armnn_sources}")
188
189 set(OnnxMobileNet-Armnn_sources
190 OnnxMobileNet-Armnn/OnnxMobileNet-Armnn.cpp
191 ImagePreprocessor.hpp
192 ImagePreprocessor.cpp)
193 OnnxParserTest(OnnxMobileNet-Armnn "${OnnxMobileNet-Armnn_sources}")
194endif()
195
196if (BUILD_CAFFE_PARSER OR BUILD_TF_PARSER OR BUILD_TF_LITE_PARSER OR BUILD_ONNX_PARSER)
telsoa014fcda012018-03-09 14:13:49 +0000197 set(ExecuteNetwork_sources
198 ExecuteNetwork/ExecuteNetwork.cpp)
199
200 add_executable_ex(ExecuteNetwork ${ExecuteNetwork_sources})
201 target_include_directories(ExecuteNetwork PRIVATE ../src/armnnUtils)
telsoa01c577f2c2018-08-31 09:22:23 +0100202 target_include_directories(ExecuteNetwork PRIVATE ../src/armnn)
telsoa014fcda012018-03-09 14:13:49 +0000203
204 if (BUILD_CAFFE_PARSER)
205 target_link_libraries(ExecuteNetwork armnnCaffeParser)
206 endif()
surmeh01bceff2f2018-03-29 16:29:27 +0100207 if (BUILD_TF_PARSER)
208 target_link_libraries(ExecuteNetwork armnnTfParser)
209 endif()
telsoa01c577f2c2018-08-31 09:22:23 +0100210
211 if (BUILD_TF_LITE_PARSER)
212 target_link_libraries(ExecuteNetwork armnnTfLiteParser)
213 endif()
214 if (BUILD_ONNX_PARSER)
215 target_link_libraries(ExecuteNetwork armnnOnnxParser)
216 endif()
217
telsoa014fcda012018-03-09 14:13:49 +0000218 target_link_libraries(ExecuteNetwork armnn)
219 target_link_libraries(ExecuteNetwork ${CMAKE_THREAD_LIBS_INIT})
220 if(OPENCL_LIBRARIES)
221 target_link_libraries(ExecuteNetwork ${OPENCL_LIBRARIES})
222 endif()
223 target_link_libraries(ExecuteNetwork
224 ${Boost_SYSTEM_LIBRARY}
225 ${Boost_FILESYSTEM_LIBRARY}
226 ${Boost_PROGRAM_OPTIONS_LIBRARY})
227 addDllCopyCommands(ExecuteNetwork)
228endif()