blob: 08cbb1b3d03ed025f92d80a45c09f6deab33e01f [file] [log] [blame]
telsoa014fcda012018-03-09 14:13:49 +00001option(BUILD_CAFFE_PARSER "Build Caffe parser" OFF)
2option(BUILD_TF_PARSER "Build Tensorflow parser" OFF)
telsoa01c577f2c2018-08-31 09:22:23 +01003option(BUILD_ONNX_PARSER "Build Onnx parser" OFF)
telsoa014fcda012018-03-09 14:13:49 +00004option(BUILD_UNIT_TESTS "Build unit tests" ON)
5option(BUILD_TESTS "Build test applications" OFF)
6option(BUILD_FOR_COVERAGE "Use no optimization and output .gcno and .gcda files" OFF)
7option(ARMCOMPUTENEON "Build with ARM Compute NEON support" OFF)
8option(ARMCOMPUTECL "Build with ARM Compute OpenCL support" OFF)
Matteo Martincighf88663c2019-08-28 16:38:53 +01009option(ARMNNREF "Build with ArmNN reference support" ON)
telsoa014fcda012018-03-09 14:13:49 +000010option(PROFILING_BACKEND_STREAMLINE "Forward the armNN profiling events to DS-5/Streamline as annotations" OFF)
telsoa01c577f2c2018-08-31 09:22:23 +010011# options used for heap profiling and leak checking
surmeh013537c2c2018-05-18 16:31:43 +010012option(HEAP_PROFILING "Build with heap profiling enabled" OFF)
telsoa01c577f2c2018-08-31 09:22:23 +010013option(LEAK_CHECKING "Build with leak checking enabled" OFF)
surmeh013537c2c2018-05-18 16:31:43 +010014option(GPERFTOOLS_ROOT "Location where the gperftools 'include' and 'lib' folders to be found" Off)
telsoa01c577f2c2018-08-31 09:22:23 +010015# options used for tensorflow lite support
16option(BUILD_TF_LITE_PARSER "Build Tensorflow Lite parser" OFF)
Nattapat Chaimanowong949f1252019-01-31 15:36:39 +000017option(BUILD_ARMNN_SERIALIZER "Build Armnn Serializer" OFF)
Jim Flynn3091b062019-02-15 14:45:04 +000018option(BUILD_ARMNN_QUANTIZER "Build ArmNN quantizer" OFF)
Éanna Ó Catháina563b922019-05-09 11:34:06 +010019option(BUILD_ACCURACY_TOOL "Build Accuracy Tool" OFF)
Nattapat Chaimanowong949f1252019-01-31 15:36:39 +000020option(FLATC_DIR "Path to Flatbuffers compiler" OFF)
telsoa01c577f2c2018-08-31 09:22:23 +010021option(TF_LITE_GENERATED_PATH "Tensorflow lite generated C++ schema location" OFF)
22option(FLATBUFFERS_ROOT "Location where the flatbuffers 'include' and 'lib' folders to be found" Off)
Matteo Martincighe7d44982019-08-05 12:16:47 +010023option(DYNAMIC_BACKEND_PATHS "Colon seperated list of paths where to load the dynamic backends from" "")
Colm Donelana21620d2019-10-11 13:09:49 +010024option(BUILD_GATORD_MOCK "Build the Gatord simulator for external profiling testing." ON)
Sadik Armagan6f86b692020-03-09 11:04:32 +000025option(BUILD_TIMELINE_DECODER "Build the Timeline Decoder for external profiling." ON)
Matthew Benthamb4e67202019-10-31 09:55:01 +000026option(SHARED_BOOST "Use dynamic linking for boost libraries" OFF)
Finn Williams2ed809c2020-04-20 21:21:07 +010027option(BUILD_BASE_PIPE_SERVER "Build the server to handle external profiling pipe traffic" ON)
telsoa014fcda012018-03-09 14:13:49 +000028
29include(SelectLibraryConfigurations)
30
31set(COMPILER_IS_GNU_LIKE 0)
32if(${CMAKE_CXX_COMPILER_ID} STREQUAL GNU OR ${CMAKE_CXX_COMPILER_ID} STREQUAL Clang)
33 set(COMPILER_IS_GNU_LIKE 1)
34endif()
35
36# Enable CCache if available and not disabled
37option(USE_CCACHE "USE_CCACHE" ON)
38find_program(CCACHE_FOUND ccache)
39if(CCACHE_FOUND AND USE_CCACHE)
40 get_property(rule_launch_compile DIRECTORY PROPERTY RULE_LAUNCH_COMPILE)
41 set_property(DIRECTORY PROPERTY RULE_LAUNCH_COMPILE "CCACHE_CPP2=yes ${rule_launch_compile} ccache")
42endif()
43
44# Enable distcc if available and not disabled
45option(USE_DISTCC "USE_DISTCC" OFF)
46find_program(DISTCC_FOUND distcc)
47if(DISTCC_FOUND AND USE_DISTCC)
48 get_property(rule_launch_compile DIRECTORY PROPERTY RULE_LAUNCH_COMPILE)
49 set_property(DIRECTORY PROPERTY RULE_LAUNCH_COMPILE "${rule_launch_compile} distcc")
50endif()
51
52# Set to release configuration by default
53if(NOT CMAKE_BUILD_TYPE)
54 set(CMAKE_BUILD_TYPE "Release")
55endif()
56
57# Compiler flags that are always set
58set(CMAKE_POSITION_INDEPENDENT_CODE ON)
59if(COMPILER_IS_GNU_LIKE)
Derek Lambertiba25aee2019-12-10 22:20:54 +000060 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -Wextra -Werror -Wold-style-cast -Wno-missing-braces -Wconversion -Wsign-conversion")
telsoa014fcda012018-03-09 14:13:49 +000061elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC)
Rob Hughesfc6bf052019-12-16 17:10:51 +000062 # Disable C4996 (use of deprecated identifier) due to https://developercommunity.visualstudio.com/content/problem/252574/deprecated-compilation-warning-for-virtual-overrid.html
63 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /MP /wd4996")
telsoa014fcda012018-03-09 14:13:49 +000064 add_definitions(-DNOMINMAX=1 -DNO_STRICT=1)
65endif()
66if("${CMAKE_SYSTEM_NAME}" STREQUAL Android)
67 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -llog")
68 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -llog")
69endif()
70
71# Compiler flags for Release builds
Matthew Benthame30054f2019-06-24 13:10:54 +010072set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG")
telsoa014fcda012018-03-09 14:13:49 +000073if(COMPILER_IS_GNU_LIKE)
74 set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
75elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC)
76 set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD /O2")
77endif()
78
79# Compiler flags for Debug builds
80if(COMPILER_IS_GNU_LIKE)
Matthew Benthame30054f2019-06-24 13:10:54 +010081 set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -O0")
telsoa014fcda012018-03-09 14:13:49 +000082elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC)
Matthew Benthame30054f2019-06-24 13:10:54 +010083 set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd /ZI /Od")
telsoa014fcda012018-03-09 14:13:49 +000084 # Disable SAFESEH which is necessary for Edit and Continue to work
85 set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /SAFESEH:NO")
86 set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /SAFESEH:NO")
87endif()
88
89# Modify RelWithDebInfo so that NDEBUG isn't defined.
90# This enables asserts.
91if (COMPILER_IS_GNU_LIKE)
92 string(REPLACE "-DNDEBUG" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
93elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC)
94 string(REPLACE "/DNDEBUG" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
95endif()
96
97# Compiler flags for code coverage measurements
98if(BUILD_FOR_COVERAGE)
99 if(NOT CMAKE_BUILD_TYPE EQUAL "Debug")
100 message(WARNING "BUILD_FOR_COVERAGE set so forcing to Debug build")
101 set(CMAKE_BUILD_TYPE "Debug")
102 endif()
103
104 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
105 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
106endif()
107
108if(BUILD_FOR_COVERAGE AND NOT BUILD_UNIT_TESTS)
109 message(WARNING "BUILD_FOR_COVERAGE set but not BUILD_UNIT_TESTS, so code coverage will not be able to run")
110endif()
111
112set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
113
114# Boost
Matthew Benthamb4e67202019-10-31 09:55:01 +0000115if(SHARED_BOOST)
116 add_definitions(-DBOOST_ALL_DYN_LINK)
117 set(Boost_USE_STATIC_LIBS OFF)
118else()
119 set(Boost_USE_STATIC_LIBS ON)
120endif()
telsoa014fcda012018-03-09 14:13:49 +0000121add_definitions("-DBOOST_ALL_NO_LIB") # Turn off auto-linking as we specify the libs manually
Francis Murtaghf8ac8292019-12-19 11:35:55 +0000122find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework system filesystem program_options)
Matthew Bentham97fb2de2019-07-12 17:26:57 +0100123include_directories(SYSTEM "${Boost_INCLUDE_DIRS}")
124link_directories(${Boost_LIBRARY_DIRS})
telsoa014fcda012018-03-09 14:13:49 +0000125
126# pthread
127find_package (Threads)
128
129# Favour the protobuf passed on command line
telsoa01c577f2c2018-08-31 09:22:23 +0100130if(BUILD_TF_PARSER OR BUILD_CAFFE_PARSER OR BUILD_ONNX_PARSER)
telsoa014fcda012018-03-09 14:13:49 +0000131 find_library(PROTOBUF_LIBRARY_DEBUG NAMES "protobufd"
132 PATHS ${PROTOBUF_ROOT}/lib
133 NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
134 find_library(PROTOBUF_LIBRARY_DEBUG NAMES "protobufd")
135
136 find_library(PROTOBUF_LIBRARY_RELEASE NAMES "protobuf"
137 PATHS ${PROTOBUF_ROOT}/lib
138 NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
139 find_library(PROTOBUF_LIBRARY_RELEASE NAMES "protobuf")
140
141 select_library_configurations(PROTOBUF)
142
143 find_path(PROTOBUF_INCLUDE_DIRS "google/protobuf/message.h"
144 PATHS ${PROTOBUF_ROOT}/include
145 NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
146 find_path(PROTOBUF_INCLUDE_DIRS "google/protobuf/message.h")
147
148 include_directories(SYSTEM "${PROTOBUF_INCLUDE_DIRS}")
149 add_definitions(-DPROTOBUF_USE_DLLS)
150endif()
151
152# Caffe and its dependencies
153if(BUILD_CAFFE_PARSER)
154 add_definitions(-DARMNN_CAFFE_PARSER)
155
156 find_path(CAFFE_GENERATED_SOURCES "caffe/proto/caffe.pb.h"
157 HINTS ${CAFFE_BUILD_ROOT}/include)
158 include_directories(SYSTEM "${CAFFE_GENERATED_SOURCES}")
159endif()
160
161if(BUILD_TF_PARSER)
162 add_definitions(-DARMNN_TF_PARSER)
163
164 find_path(TF_GENERATED_SOURCES "tensorflow/core/protobuf/saved_model.pb.cc")
165
166 # C++ sources generated for tf protobufs
167 file(GLOB_RECURSE TF_PROTOBUFS "${TF_GENERATED_SOURCES}/*.pb.cc")
168
169 # C++ headers generated for tf protobufs
170 include_directories(SYSTEM "${TF_GENERATED_SOURCES}")
171endif()
172
telsoa01c577f2c2018-08-31 09:22:23 +0100173if(BUILD_ONNX_PARSER)
174 add_definitions(-DARMNN_ONNX_PARSER)
175
176 find_path(ONNX_GENERATED_SOURCES "onnx/onnx.pb.cc")
177
178 # C++ headers generated for onnx protobufs
179 include_directories(SYSTEM "${ONNX_GENERATED_SOURCES}")
180endif()
181
Nattapat Chaimanowong949f1252019-01-31 15:36:39 +0000182# Flatbuffers support for TF Lite and Armnn Serializer
183if(BUILD_TF_LITE_PARSER OR BUILD_ARMNN_SERIALIZER)
telsoa01c577f2c2018-08-31 09:22:23 +0100184 # verify we have a valid flatbuffers include path
185 find_path(FLATBUFFERS_INCLUDE_PATH flatbuffers/flatbuffers.h
186 HINTS ${FLATBUFFERS_ROOT}/include /usr/local/include /usr/include)
187
Matthew Benthamd1ae3a62019-02-22 17:30:32 +0000188 message(STATUS "Flatbuffers headers are located at: ${FLATBUFFERS_INCLUDE_PATH}")
telsoa01c577f2c2018-08-31 09:22:23 +0100189
190 find_library(FLATBUFFERS_LIBRARY
191 NAMES libflatbuffers.a flatbuffers
192 HINTS ${FLATBUFFERS_ROOT}/lib /usr/local/lib /usr/lib)
193
Matthew Benthamd1ae3a62019-02-22 17:30:32 +0000194 message(STATUS "Flatbuffers library located at: ${FLATBUFFERS_LIBRARY}")
Nattapat Chaimanowong949f1252019-01-31 15:36:39 +0000195endif()
196
197# Flatbuffers schema support for TF Lite
198if(BUILD_TF_LITE_PARSER)
199 find_path(TF_LITE_SCHEMA_INCLUDE_PATH
200 schema_generated.h
201 HINTS ${TF_LITE_GENERATED_PATH})
202
Matthew Benthamd1ae3a62019-02-22 17:30:32 +0000203 message(STATUS "Tf Lite generated header found at: ${TF_LITE_SCHEMA_INCLUDE_PATH}")
Nattapat Chaimanowong949f1252019-01-31 15:36:39 +0000204
Matthew Benthamd1ae3a62019-02-22 17:30:32 +0000205 add_definitions(-DARMNN_TF_LITE_PARSER)
telsoa01c577f2c2018-08-31 09:22:23 +0100206endif()
207
Kevin May43a799c2019-02-08 16:31:42 +0000208if(BUILD_ARMNN_SERIALIZER)
Kevin May43a799c2019-02-08 16:31:42 +0000209 add_definitions(-DARMNN_SERIALIZER)
Matthew Bentham268509a2019-02-25 13:58:24 +0000210 add_definitions(-DARMNN_SERIALIZER_SCHEMA_PATH="${CMAKE_CURRENT_SOURCE_DIR}/src/armnnSerializer/ArmnnSchema.fbs")
Kevin May43a799c2019-02-08 16:31:42 +0000211endif()
212
telsoa014fcda012018-03-09 14:13:49 +0000213include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
Sadik Armagana97a0be2020-03-03 10:44:56 +0000214include_directories(${CMAKE_CURRENT_SOURCE_DIR}/profiling)
telsoa014fcda012018-03-09 14:13:49 +0000215
216# ARM Compute
217# Note that ARM Compute has a different folder layout depending on the branch but also on
218# whether it comes from a prepackaged archive (this is why we add several hints below)
219if(ARMCOMPUTENEON OR ARMCOMPUTECL)
220 find_path(ARMCOMPUTE_INCLUDE arm_compute/core/CL/ICLKernel.h
221 PATHS ${ARMCOMPUTE_ROOT}/include
222 PATHS ${ARMCOMPUTE_ROOT}/applications/arm_compute
223 PATHS ${ARMCOMPUTE_ROOT}
224 NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
225 find_path(ARMCOMPUTE_INCLUDE arm_compute/core/CL/ICLKernel.h)
226 include_directories(SYSTEM "${ARMCOMPUTE_INCLUDE}")
227
228 # Find the Arm Compute libraries if not already specified (the user may have already defined this in advance,
229 # e.g. if building clframework as a dependent cmake project)
230 if (NOT DEFINED ARMCOMPUTE_LIBRARIES)
231 # We link to the static variant so that customers don't need to find and build a compatible version of clframework.
232 # First try the folders specified ARMCOMPUTE_BUILD_DIR (with PATH_SUFFIXES for
233 # Windows builds)
234 find_library(ARMCOMPUTE_LIBRARY_DEBUG NAMES arm_compute-static
235 PATHS ${ARMCOMPUTE_BUILD_DIR}
236 PATH_SUFFIXES "Debug"
237 NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
238 find_library(ARMCOMPUTE_LIBRARY_RELEASE NAMES arm_compute-static
239 PATHS ${ARMCOMPUTE_BUILD_DIR}
240 PATH_SUFFIXES "Release"
241 NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
242 find_library(ARMCOMPUTE_CORE_LIBRARY_DEBUG NAMES arm_compute_core-static
243 PATHS ${ARMCOMPUTE_BUILD_DIR}
244 PATH_SUFFIXES "Debug"
245 NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
246 find_library(ARMCOMPUTE_CORE_LIBRARY_RELEASE NAMES arm_compute_core-static
247 PATHS ${ARMCOMPUTE_BUILD_DIR}
248 PATH_SUFFIXES "Release"
249 NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
250
251 # In case it wasn't there, try a default search (will work in cases where
252 # the library has been installed into a standard location)
253 find_library(ARMCOMPUTE_LIBRARY_DEBUG NAMES arm_compute-static)
254 find_library(ARMCOMPUTE_LIBRARY_RELEASE NAMES arm_compute-static)
255 find_library(ARMCOMPUTE_CORE_LIBRARY_DEBUG NAMES arm_compute_core-static)
256 find_library(ARMCOMPUTE_CORE_LIBRARY_RELEASE NAMES arm_compute_core-static)
257
Matthew Bentham6445cff2020-03-10 11:13:17 +0000258 # In case it wasn't there, try the dynamic libraries
259 # This case will get used in a linux setup where the Compute Library
260 # has been installed in a standard system library path as a dynamic library
261 find_library(ARMCOMPUTE_LIBRARY_DEBUG NAMES arm_compute)
262 find_library(ARMCOMPUTE_LIBRARY_RELEASE NAMES arm_compute)
263 find_library(ARMCOMPUTE_CORE_LIBRARY_DEBUG NAMES arm_compute_core)
264 find_library(ARMCOMPUTE_CORE_LIBRARY_RELEASE NAMES arm_compute_core)
265
telsoa014fcda012018-03-09 14:13:49 +0000266 set(ARMCOMPUTE_LIBRARIES
267 debug ${ARMCOMPUTE_LIBRARY_DEBUG} ${ARMCOMPUTE_CORE_LIBRARY_DEBUG}
268 optimized ${ARMCOMPUTE_LIBRARY_RELEASE} ${ARMCOMPUTE_CORE_LIBRARY_RELEASE} )
269 endif()
270endif()
271
272# ARM Compute NEON backend
273if(ARMCOMPUTENEON)
274 # Add preprocessor definition for ARM Compute NEON
275 add_definitions(-DARMCOMPUTENEON_ENABLED)
276 # The ARM Compute headers contain some NEON intrinsics, so we need to build armnn with NEON support on armv7
277 if(${CMAKE_SYSTEM_PROCESSOR} MATCHES armv7 AND COMPILER_IS_GNU_LIKE)
278 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon")
279 endif()
280endif()
281
282# ARM Compute OpenCL backend
283if(ARMCOMPUTECL)
284 # Always use Arm compute library OpenCL headers
285 find_path(OPENCL_INCLUDE CL/cl2.hpp
286 PATHS ${ARMCOMPUTE_ROOT}/include
287 NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
288
Matthew Bentham3b72db02018-10-11 09:47:01 +0100289 # Link against libOpenCL in opencl-1.2-stubs, but don't search there at runtime
290 link_libraries(-L${ARMCOMPUTE_BUILD_DIR}/opencl-1.2-stubs)
291 set(OPENCL_LIBRARIES OpenCL)
telsoa014fcda012018-03-09 14:13:49 +0000292
Matthew Bentham416b41d2020-02-05 22:15:26 +0000293 include_directories(SYSTEM ${OPENCL_INCLUDE})
telsoa014fcda012018-03-09 14:13:49 +0000294
295 # Add preprocessor definition for ARM Compute OpenCL
296 add_definitions(-DARMCOMPUTECL_ENABLED)
297
298 set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DARM_COMPUTE_DEBUG_ENABLED")
299endif()
300
301# Used by both Arm Compute backends, but should be added
302# to the search path after the system directories if necessary
303if(ARMCOMPUTENEON OR ARMCOMPUTECL)
304 find_path(HALF_INCLUDE half/half.hpp)
305 find_path(HALF_INCLUDE half/half.hpp
306 PATHS ${ARMCOMPUTE_ROOT}/include
307 NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
telsoa01c577f2c2018-08-31 09:22:23 +0100308 include_directories(SYSTEM ${HALF_INCLUDE})
telsoa014fcda012018-03-09 14:13:49 +0000309endif()
310
Matteo Martincighdb16dd32019-08-27 16:41:11 +0100311# ArmNN reference backend
312if(ARMNNREF)
313 add_definitions(-DARMNNREF_ENABLED)
Matteo Martincighe67edb22019-08-14 14:05:46 +0100314endif()
315
Narumol Prangnawarat60a20fb2019-12-09 17:24:41 +0000316# ArmNN dynamic backend
317if(DYNAMIC_BACKEND_PATHS)
318 add_definitions(-DARMNN_DYNAMIC_BACKEND_ENABLED)
319endif()
320
Narumol Prangnawarat867eba52020-02-03 12:29:56 +0000321if(SAMPLE_DYNAMIC_BACKEND)
322 add_definitions(-DSAMPLE_DYNAMIC_BACKEND_ENABLED)
323endif()
324
telsoa014fcda012018-03-09 14:13:49 +0000325# Streamline annotate
326if(PROFILING_BACKEND_STREAMLINE)
327 include_directories("${GATOR_ROOT}/annotate")
328 add_definitions(-DARMNN_STREAMLINE_ENABLED)
329endif()
330
telsoa01c577f2c2018-08-31 09:22:23 +0100331if(HEAP_PROFILING OR LEAK_CHECKING)
surmeh013537c2c2018-05-18 16:31:43 +0100332 # enable heap profiling for everything except for referencetests
333 if(NOT ${PROJECT_NAME} STREQUAL "referencetests")
334 find_path(HEAP_PROFILER_INCLUDE gperftools/heap-profiler.h
335 PATHS ${GPERFTOOLS_ROOT}/include
336 NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
337 include_directories(SYSTEM "${HEAP_PROFILER_INCLUDE}")
338 find_library(GPERF_TOOLS_LIBRARY
339 NAMES tcmalloc_debug
340 HINTS ${GPERFTOOLS_ROOT}/lib)
341 link_directories(${GPERFTOOLS_ROOT}/lib)
342
343 link_libraries(${GPERF_TOOLS_LIBRARY})
telsoa01c577f2c2018-08-31 09:22:23 +0100344 if (HEAP_PROFILING)
345 add_definitions("-DARMNN_HEAP_PROFILING_ENABLED=1")
346 endif()
347 if (LEAK_CHECKING)
348 add_definitions("-DARMNN_LEAK_CHECKING_ENABLED=1")
349 endif()
surmeh013537c2c2018-05-18 16:31:43 +0100350 else()
Rob Hughes721b82f2019-11-15 09:04:17 +0000351 message(STATUS "Heap profiling and leak checking are disabled for referencetests")
surmeh013537c2c2018-05-18 16:31:43 +0100352 endif()
353else()
354 # Valgrind only works with gperftools version number <= 2.4
355 CHECK_INCLUDE_FILE(valgrind/memcheck.h VALGRIND_FOUND)
356endif()
357
358
359if(NOT BUILD_CAFFE_PARSER)
360 message(STATUS "Caffe parser support is disabled")
361endif()
362
363if(NOT BUILD_TF_PARSER)
364 message(STATUS "Tensorflow parser support is disabled")
365endif()
366
telsoa01c577f2c2018-08-31 09:22:23 +0100367if(NOT BUILD_TF_LITE_PARSER)
368 message(STATUS "Tensorflow Lite parser support is disabled")
369endif()
David Beck10b4dfd2018-09-19 12:03:20 +0100370
Nattapat Chaimanowong949f1252019-01-31 15:36:39 +0000371if(NOT BUILD_ARMNN_SERIALIZER)
372 message(STATUS "Armnn Serializer support is disabled")
373endif()
374
Jim Flynn3091b062019-02-15 14:45:04 +0000375if(NOT BUILD_ARMNN_QUANTIZER)
376 message(STATUS "ArmNN Quantizer support is disabled")
377endif()
378
David Beck10b4dfd2018-09-19 12:03:20 +0100379# ArmNN source files required for all build options
380include_directories(SYSTEM third-party)