Pavel Macenauer | 59e057f | 2020-04-15 14:17:26 +0000 | [diff] [blame] | 1 | # |
Ryan OShea | b554054 | 2022-07-06 09:52:52 +0100 | [diff] [blame] | 2 | # Copyright © 2022-2023 Arm Ltd and Contributors. All rights reserved. |
Pavel Macenauer | 59e057f | 2020-04-15 14:17:26 +0000 | [diff] [blame] | 3 | # Copyright 2020 NXP |
| 4 | # SPDX-License-Identifier: MIT |
| 5 | # |
Jim Flynn | 870b96c | 2022-03-25 21:24:56 +0000 | [diff] [blame] | 6 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 7 | option(BUILD_ONNX_PARSER "Build Onnx parser" OFF) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 8 | option(BUILD_UNIT_TESTS "Build unit tests" ON) |
| 9 | option(BUILD_TESTS "Build test applications" OFF) |
Ryan OShea | a3dc95e | 2023-03-20 11:10:40 +0000 | [diff] [blame] | 10 | option(ARMNN_SAMPLE_APPS_ENABLED "Build Sample ArmNN Applications" ON) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 11 | option(BUILD_FOR_COVERAGE "Use no optimization and output .gcno and .gcda files" OFF) |
| 12 | option(ARMCOMPUTENEON "Build with ARM Compute NEON support" OFF) |
| 13 | option(ARMCOMPUTECL "Build with ARM Compute OpenCL support" OFF) |
Matteo Martincigh | f88663c | 2019-08-28 16:38:53 +0100 | [diff] [blame] | 14 | option(ARMNNREF "Build with ArmNN reference support" ON) |
Matthew Sloyan | d646b55 | 2022-10-10 12:42:16 +0100 | [diff] [blame] | 15 | option(ARMNNTOSAREF "Build with TOSA reference support" OFF) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 16 | option(PROFILING_BACKEND_STREAMLINE "Forward the armNN profiling events to DS-5/Streamline as annotations" OFF) |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 17 | # options used for heap profiling and leak checking |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 18 | option(HEAP_PROFILING "Build with heap profiling enabled" OFF) |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 19 | option(LEAK_CHECKING "Build with leak checking enabled" OFF) |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 20 | option(GPERFTOOLS_ROOT "Location where the gperftools 'include' and 'lib' folders to be found" Off) |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 21 | # options used for tensorflow lite support |
| 22 | option(BUILD_TF_LITE_PARSER "Build Tensorflow Lite parser" OFF) |
Nattapat Chaimanowong | 949f125 | 2019-01-31 15:36:39 +0000 | [diff] [blame] | 23 | option(BUILD_ARMNN_SERIALIZER "Build Armnn Serializer" OFF) |
Éanna Ó Catháin | a563b92 | 2019-05-09 11:34:06 +0100 | [diff] [blame] | 24 | option(BUILD_ACCURACY_TOOL "Build Accuracy Tool" OFF) |
Nattapat Chaimanowong | 949f125 | 2019-01-31 15:36:39 +0000 | [diff] [blame] | 25 | option(FLATC_DIR "Path to Flatbuffers compiler" OFF) |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 26 | option(TF_LITE_GENERATED_PATH "Tensorflow lite generated C++ schema location" OFF) |
| 27 | option(FLATBUFFERS_ROOT "Location where the flatbuffers 'include' and 'lib' folders to be found" Off) |
Matthew Sloyan | d646b55 | 2022-10-10 12:42:16 +0100 | [diff] [blame] | 28 | option(TOSA_SERIALIZATION_LIB_ROOT "Location where the TOSA Serialization Library 'include' and 'lib' folders can be found" OFF) |
| 29 | option(TOSA_REFERENCE_MODEL_ROOT "Location where the TOSA Reference Model 'include' and 'lib' folders can be found" OFF) |
Matthew Sloyan | 67fd526 | 2022-12-07 19:28:18 +0000 | [diff] [blame] | 30 | option(TOSA_REFERENCE_MODEL_OUTPUT "TOSA Reference Model output is printed during layer support checks" ON) |
Matteo Martincigh | e7d4498 | 2019-08-05 12:16:47 +0100 | [diff] [blame] | 31 | option(DYNAMIC_BACKEND_PATHS "Colon seperated list of paths where to load the dynamic backends from" "") |
Colm Donelan | 0dbe00a | 2020-06-03 08:00:28 +0100 | [diff] [blame] | 32 | option(SAMPLE_DYNAMIC_BACKEND "Include the sample dynamic backend and its tests in the build" OFF) |
Colm Donelan | a21620d | 2019-10-11 13:09:49 +0100 | [diff] [blame] | 33 | option(BUILD_GATORD_MOCK "Build the Gatord simulator for external profiling testing." ON) |
Sadik Armagan | 6f86b69 | 2020-03-09 11:04:32 +0000 | [diff] [blame] | 34 | option(BUILD_TIMELINE_DECODER "Build the Timeline Decoder for external profiling." ON) |
Finn Williams | 2ed809c | 2020-04-20 21:21:07 +0100 | [diff] [blame] | 35 | option(BUILD_BASE_PIPE_SERVER "Build the server to handle external profiling pipe traffic" ON) |
Pavel Macenauer | 59e057f | 2020-04-15 14:17:26 +0000 | [diff] [blame] | 36 | option(BUILD_PYTHON_WHL "Build Python wheel package" OFF) |
| 37 | option(BUILD_PYTHON_SRC "Build Python source package" OFF) |
Jim Flynn | bbfe603 | 2020-07-20 16:57:44 +0100 | [diff] [blame] | 38 | option(BUILD_STATIC_PIPE_LIBS "Build Static PIPE libraries" OFF) |
| 39 | option(BUILD_PIPE_ONLY "Build the PIPE libraries only" OFF) |
Teresa Charlin | ad1b3d7 | 2023-03-14 12:10:28 +0000 | [diff] [blame] | 40 | option(BUILD_CLASSIC_DELEGATE "Build the Arm NN TfLite delegate" OFF) |
| 41 | option(BUILD_OPAQUE_DELEGATE "Build the Arm NN TfLite Opaque delegate" OFF) |
Jim Flynn | e1fdd28 | 2021-10-26 21:26:10 +0100 | [diff] [blame] | 42 | option(BUILD_MEMORY_STRATEGY_BENCHMARK "Build the MemoryBenchmark" OFF) |
Jim Flynn | 870b96c | 2022-03-25 21:24:56 +0000 | [diff] [blame] | 43 | option(BUILD_BARE_METAL "Disable features requiring operating system support" OFF) |
Jan Eilers | a96489a | 2021-12-08 10:05:47 +0000 | [diff] [blame] | 44 | option(BUILD_SHARED_LIBS "Determines if Armnn will be built statically or dynamically. |
| 45 | This is an experimental feature and not fully supported. |
| 46 | Only the ArmNN core and the Delegate can be built statically." ON) |
Ryan OShea | b554054 | 2022-07-06 09:52:52 +0100 | [diff] [blame] | 47 | option(EXECUTE_NETWORK_STATIC " This is a limited experimental build that is entirely static. |
| 48 | It currently only supports being set by changing the current CMake default options like so: |
| 49 | BUILD_TF_LITE_PARSER=1/0 |
| 50 | BUILD_ARMNN_SERIALIZER=1/0 |
| 51 | ARMCOMPUTENEON=1/0 |
| 52 | ARMNNREF=1/0 |
| 53 | ARMCOMPUTECL=0 |
| 54 | BUILD_ONNX_PARSER=0 |
Teresa Charlin | ad1b3d7 | 2023-03-14 12:10:28 +0000 | [diff] [blame] | 55 | BUILD_CLASSIC_DELEGATE=0 |
| 56 | BUILD_OPAQUE_DELEGATE=0 |
Ryan OShea | b554054 | 2022-07-06 09:52:52 +0100 | [diff] [blame] | 57 | BUILD_TIMELINE_DECODER=0 |
| 58 | BUILD_BASE_PIPE_SERVER=0 |
| 59 | BUILD_UNIT_TESTS=0 |
Ryan OShea | a3dc95e | 2023-03-20 11:10:40 +0000 | [diff] [blame] | 60 | ARMNN_SAMPLE_APPS_ENABLED=0 |
| 61 | BUILD_SHARED_LIBS=0 |
| 62 | BUILD_GATORD_MOCK=0 |
| 63 | HEAP_PROFILING=0 |
| 64 | LEAK_CHECKING=0" OFF) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 65 | |
Teresa Charlin | ad1b3d7 | 2023-03-14 12:10:28 +0000 | [diff] [blame] | 66 | if(BUILD_ARMNN_TFLITE_DELEGATE) |
| 67 | message(BUILD_ARMNN_TFLITE_DELEGATE option is deprecated, it will be removed in 24.02, please use BUILD_CLASSIC_DELEGATE instead) |
| 68 | set(BUILD_CLASSIC_DELEGATE 1) |
| 69 | endif() |
| 70 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 71 | include(SelectLibraryConfigurations) |
| 72 | |
| 73 | set(COMPILER_IS_GNU_LIKE 0) |
Jim Flynn | 82262f5 | 2020-07-16 11:23:45 +0100 | [diff] [blame] | 74 | if(${CMAKE_CXX_COMPILER_ID} STREQUAL GNU OR |
| 75 | ${CMAKE_CXX_COMPILER_ID} STREQUAL Clang OR |
| 76 | ${CMAKE_CXX_COMPILER_ID} STREQUAL AppleClang) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 77 | set(COMPILER_IS_GNU_LIKE 1) |
| 78 | endif() |
| 79 | |
| 80 | # Enable CCache if available and not disabled |
| 81 | option(USE_CCACHE "USE_CCACHE" ON) |
| 82 | find_program(CCACHE_FOUND ccache) |
| 83 | if(CCACHE_FOUND AND USE_CCACHE) |
| 84 | get_property(rule_launch_compile DIRECTORY PROPERTY RULE_LAUNCH_COMPILE) |
| 85 | set_property(DIRECTORY PROPERTY RULE_LAUNCH_COMPILE "CCACHE_CPP2=yes ${rule_launch_compile} ccache") |
| 86 | endif() |
| 87 | |
| 88 | # Enable distcc if available and not disabled |
| 89 | option(USE_DISTCC "USE_DISTCC" OFF) |
| 90 | find_program(DISTCC_FOUND distcc) |
| 91 | if(DISTCC_FOUND AND USE_DISTCC) |
| 92 | get_property(rule_launch_compile DIRECTORY PROPERTY RULE_LAUNCH_COMPILE) |
| 93 | set_property(DIRECTORY PROPERTY RULE_LAUNCH_COMPILE "${rule_launch_compile} distcc") |
| 94 | endif() |
| 95 | |
| 96 | # Set to release configuration by default |
| 97 | if(NOT CMAKE_BUILD_TYPE) |
| 98 | set(CMAKE_BUILD_TYPE "Release") |
| 99 | endif() |
| 100 | |
| 101 | # Compiler flags that are always set |
| 102 | set(CMAKE_POSITION_INDEPENDENT_CODE ON) |
| 103 | if(COMPILER_IS_GNU_LIKE) |
Ryan OShea | 238ecd9 | 2023-03-07 11:44:23 +0000 | [diff] [blame] | 104 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wall -Wextra -Werror -Wold-style-cast -Wno-missing-braces -Wconversion -Wsign-conversion") |
Finn Williams | 3d62614 | 2021-08-11 13:04:32 +0100 | [diff] [blame] | 105 | if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") |
| 106 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-psabi") |
| 107 | endif() |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 108 | elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC) |
Jim Flynn | 870b96c | 2022-03-25 21:24:56 +0000 | [diff] [blame] | 109 | # Disable C4996 (use of deprecated identifier) due to |
| 110 | # https://developercommunity.visualstudio.com/content/problem/252574/deprecated-compilation-warning-for-virtual-overrid.html |
Rob Hughes | fc6bf05 | 2019-12-16 17:10:51 +0000 | [diff] [blame] | 111 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /MP /wd4996") |
Rob Hughes | bc873d2 | 2020-05-20 13:11:37 +0100 | [diff] [blame] | 112 | add_definitions(-DNO_STRICT=1) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 113 | endif() |
| 114 | if("${CMAKE_SYSTEM_NAME}" STREQUAL Android) |
Keith Davis | b8942bf | 2021-05-31 11:22:35 +0100 | [diff] [blame] | 115 | # -lz is necessary for when building with ACL set with compressed kernels |
| 116 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -llog -lz") |
| 117 | set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -llog -lz") |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 118 | endif() |
| 119 | |
| 120 | # Compiler flags for Release builds |
Matthew Bentham | e30054f | 2019-06-24 13:10:54 +0100 | [diff] [blame] | 121 | set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG") |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 122 | if(COMPILER_IS_GNU_LIKE) |
| 123 | set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3") |
| 124 | elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC) |
| 125 | set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD /O2") |
| 126 | endif() |
| 127 | |
| 128 | # Compiler flags for Debug builds |
| 129 | if(COMPILER_IS_GNU_LIKE) |
Matthew Bentham | e30054f | 2019-06-24 13:10:54 +0100 | [diff] [blame] | 130 | set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -O0") |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 131 | elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC) |
Matthew Bentham | e30054f | 2019-06-24 13:10:54 +0100 | [diff] [blame] | 132 | set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd /ZI /Od") |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 133 | # Disable SAFESEH which is necessary for Edit and Continue to work |
| 134 | set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /SAFESEH:NO") |
| 135 | set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /SAFESEH:NO") |
| 136 | endif() |
| 137 | |
| 138 | # Modify RelWithDebInfo so that NDEBUG isn't defined. |
| 139 | # This enables asserts. |
| 140 | if (COMPILER_IS_GNU_LIKE) |
| 141 | string(REPLACE "-DNDEBUG" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") |
| 142 | elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC) |
| 143 | string(REPLACE "/DNDEBUG" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") |
| 144 | endif() |
| 145 | |
| 146 | # Compiler flags for code coverage measurements |
| 147 | if(BUILD_FOR_COVERAGE) |
| 148 | if(NOT CMAKE_BUILD_TYPE EQUAL "Debug") |
| 149 | message(WARNING "BUILD_FOR_COVERAGE set so forcing to Debug build") |
| 150 | set(CMAKE_BUILD_TYPE "Debug") |
| 151 | endif() |
| 152 | |
| 153 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage") |
| 154 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage") |
| 155 | endif() |
| 156 | |
| 157 | if(BUILD_FOR_COVERAGE AND NOT BUILD_UNIT_TESTS) |
| 158 | message(WARNING "BUILD_FOR_COVERAGE set but not BUILD_UNIT_TESTS, so code coverage will not be able to run") |
| 159 | endif() |
| 160 | |
| 161 | set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH}) |
| 162 | |
Derek Lamberti | eac4adb | 2020-08-25 13:05:59 +0100 | [diff] [blame] | 163 | include(CMakeFindDependencyMacro) |
| 164 | |
Ryan OShea | b554054 | 2022-07-06 09:52:52 +0100 | [diff] [blame] | 165 | |
| 166 | if(EXECUTE_NETWORK_STATIC) |
| 167 | add_definitions(-DARMNN_DISABLE_SOCKETS |
Ryan OShea | a3dc95e | 2023-03-20 11:10:40 +0000 | [diff] [blame] | 168 | -DARMNN_STUB_PROFILING |
| 169 | -DARMNN_DISABLE_DYNAMIC_BACKENDS) |
| 170 | set(ARMNN_SAMPLE_APPS_ENABLED 0) |
| 171 | set(DISABLE_DYNAMIC_BACKENDS 1) |
| 172 | set(BUILD_SHARED_LIBS 0) |
Ryan OShea | b554054 | 2022-07-06 09:52:52 +0100 | [diff] [blame] | 173 | endif() |
| 174 | |
| 175 | if(BUILD_BARE_METAL) |
| 176 | add_definitions(-DARMNN_BUILD_BARE_METAL |
Ryan OShea | a3dc95e | 2023-03-20 11:10:40 +0000 | [diff] [blame] | 177 | -DARMNN_DISABLE_FILESYSTEM |
| 178 | -DARMNN_DISABLE_PROCESSES |
| 179 | -DARMNN_DISABLE_THREADS |
| 180 | -DARMNN_DISABLE_SOCKETS |
| 181 | -DARMNN_STUB_PROFILING |
| 182 | -DARMNN_DISABLE_DYNAMIC_BACKENDS) |
| 183 | set(DISABLE_DYNAMIC_BACKENDS 1) |
| 184 | set(BUILD_SHARED_LIBS 0) |
Ryan OShea | b554054 | 2022-07-06 09:52:52 +0100 | [diff] [blame] | 185 | endif() |
| 186 | |
Jim Flynn | bbfe603 | 2020-07-20 16:57:44 +0100 | [diff] [blame] | 187 | if (NOT BUILD_PIPE_ONLY) |
Jim Flynn | bbfe603 | 2020-07-20 16:57:44 +0100 | [diff] [blame] | 188 | # cxxopts (Alternative to boost::program_options) |
Vincent ABRIOU | 5494019 | 2020-09-03 13:02:43 +0200 | [diff] [blame] | 189 | find_path(CXXOPTS_INCLUDE cxxopts/cxxopts.hpp PATHS third-party NO_CMAKE_FIND_ROOT_PATH) |
Jim Flynn | bbfe603 | 2020-07-20 16:57:44 +0100 | [diff] [blame] | 190 | include_directories(SYSTEM "${CXXOPTS_INCLUDE}") |
| 191 | endif() |
Jan Eilers | 7e98983 | 2020-06-19 11:47:21 +0100 | [diff] [blame] | 192 | |
Jim Flynn | bbfe603 | 2020-07-20 16:57:44 +0100 | [diff] [blame] | 193 | if (NOT BUILD_PIPE_ONLY) |
| 194 | # ghc (Alternative to boost::filesystem) |
Vincent ABRIOU | 5494019 | 2020-09-03 13:02:43 +0200 | [diff] [blame] | 195 | find_path(GHC_INCLUDE ghc/filesystem.hpp PATHS third-party NO_CMAKE_FIND_ROOT_PATH) |
Jim Flynn | bbfe603 | 2020-07-20 16:57:44 +0100 | [diff] [blame] | 196 | include_directories(SYSTEM "${GHC_INCLUDE}") |
| 197 | endif() |
Jan Eilers | 307fd34 | 2020-06-23 14:16:04 +0100 | [diff] [blame] | 198 | |
Nikhil Raj | 23a6d00 | 2023-01-17 11:24:01 +0000 | [diff] [blame] | 199 | # JNI_BUILD has DBUILD_SHARED_LIBS set to 0 and not finding libs while building |
Teresa Charlin | ad1b3d7 | 2023-03-14 12:10:28 +0000 | [diff] [blame] | 200 | # hence added NOT BUILD_CLASSIC_DELEGATE/BUILD_OPAQUE_DELEGATE condition |
| 201 | if(NOT BUILD_SHARED_LIBS AND NOT BUILD_CLASSIC_DELEGATE AND NOT BUILD_OPAQUE_DELEGATE) |
Ryan OShea | b554054 | 2022-07-06 09:52:52 +0100 | [diff] [blame] | 202 | set(CMAKE_FIND_LIBRARY_SUFFIXES .a .lib) |
| 203 | endif() |
| 204 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 205 | # pthread |
Jim Flynn | 870b96c | 2022-03-25 21:24:56 +0000 | [diff] [blame] | 206 | if (NOT BUILD_BARE_METAL) |
| 207 | find_package(Threads) |
| 208 | endif() |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 209 | |
Ryan OShea | b554054 | 2022-07-06 09:52:52 +0100 | [diff] [blame] | 210 | if (EXECUTE_NETWORK_STATIC) |
| 211 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc -static -pthread") |
| 212 | endif() |
| 213 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 214 | # Favour the protobuf passed on command line |
Nikhil Raj | 5d955cf | 2021-04-19 16:59:48 +0100 | [diff] [blame] | 215 | if(BUILD_ONNX_PARSER) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 216 | find_library(PROTOBUF_LIBRARY_DEBUG NAMES "protobufd" |
| 217 | PATHS ${PROTOBUF_ROOT}/lib |
| 218 | NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) |
| 219 | find_library(PROTOBUF_LIBRARY_DEBUG NAMES "protobufd") |
| 220 | |
| 221 | find_library(PROTOBUF_LIBRARY_RELEASE NAMES "protobuf" |
| 222 | PATHS ${PROTOBUF_ROOT}/lib |
| 223 | NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) |
| 224 | find_library(PROTOBUF_LIBRARY_RELEASE NAMES "protobuf") |
| 225 | |
| 226 | select_library_configurations(PROTOBUF) |
| 227 | |
| 228 | find_path(PROTOBUF_INCLUDE_DIRS "google/protobuf/message.h" |
| 229 | PATHS ${PROTOBUF_ROOT}/include |
| 230 | NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) |
| 231 | find_path(PROTOBUF_INCLUDE_DIRS "google/protobuf/message.h") |
| 232 | |
| 233 | include_directories(SYSTEM "${PROTOBUF_INCLUDE_DIRS}") |
| 234 | add_definitions(-DPROTOBUF_USE_DLLS) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 235 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 236 | add_definitions(-DARMNN_ONNX_PARSER) |
| 237 | |
| 238 | find_path(ONNX_GENERATED_SOURCES "onnx/onnx.pb.cc") |
| 239 | |
| 240 | # C++ headers generated for onnx protobufs |
| 241 | include_directories(SYSTEM "${ONNX_GENERATED_SOURCES}") |
| 242 | endif() |
| 243 | |
Teresa Charlin | ad1b3d7 | 2023-03-14 12:10:28 +0000 | [diff] [blame] | 244 | if(BUILD_CLASSIC_DELEGATE) |
Sadik Armagan | 5d03e31 | 2020-11-17 16:43:56 +0000 | [diff] [blame] | 245 | add_definitions(-DARMNN_TFLITE_DELEGATE) |
| 246 | endif() |
Matthew Sloyan | 9cb5bb6 | 2023-03-06 17:09:22 +0000 | [diff] [blame] | 247 | |
Teresa Charlin | ad1b3d7 | 2023-03-14 12:10:28 +0000 | [diff] [blame] | 248 | if(BUILD_OPAQUE_DELEGATE) |
Matthew Sloyan | 9cb5bb6 | 2023-03-06 17:09:22 +0000 | [diff] [blame] | 249 | add_definitions(-DARMNN_TFLITE_OPAQUE_DELEGATE) |
| 250 | endif() |
| 251 | |
Cathal Corbett | 9c9d5b9 | 2022-08-17 17:30:16 +0100 | [diff] [blame] | 252 | # Flatbuffers support for TF Lite, Armnn Serializer or the TOSA backend. |
| 253 | if(BUILD_TF_LITE_PARSER OR BUILD_ARMNN_SERIALIZER OR ARMNNTOSAREF) |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 254 | # verify we have a valid flatbuffers include path |
| 255 | find_path(FLATBUFFERS_INCLUDE_PATH flatbuffers/flatbuffers.h |
| 256 | HINTS ${FLATBUFFERS_ROOT}/include /usr/local/include /usr/include) |
| 257 | |
Matthew Bentham | d1ae3a6 | 2019-02-22 17:30:32 +0000 | [diff] [blame] | 258 | message(STATUS "Flatbuffers headers are located at: ${FLATBUFFERS_INCLUDE_PATH}") |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 259 | |
| 260 | find_library(FLATBUFFERS_LIBRARY |
| 261 | NAMES libflatbuffers.a flatbuffers |
| 262 | HINTS ${FLATBUFFERS_ROOT}/lib /usr/local/lib /usr/lib) |
| 263 | |
Matthew Bentham | d1ae3a6 | 2019-02-22 17:30:32 +0000 | [diff] [blame] | 264 | message(STATUS "Flatbuffers library located at: ${FLATBUFFERS_LIBRARY}") |
Nattapat Chaimanowong | 949f125 | 2019-01-31 15:36:39 +0000 | [diff] [blame] | 265 | endif() |
| 266 | |
| 267 | # Flatbuffers schema support for TF Lite |
| 268 | if(BUILD_TF_LITE_PARSER) |
| 269 | find_path(TF_LITE_SCHEMA_INCLUDE_PATH |
| 270 | schema_generated.h |
| 271 | HINTS ${TF_LITE_GENERATED_PATH}) |
| 272 | |
Matthew Bentham | d1ae3a6 | 2019-02-22 17:30:32 +0000 | [diff] [blame] | 273 | message(STATUS "Tf Lite generated header found at: ${TF_LITE_SCHEMA_INCLUDE_PATH}") |
Nattapat Chaimanowong | 949f125 | 2019-01-31 15:36:39 +0000 | [diff] [blame] | 274 | |
Matthew Bentham | d1ae3a6 | 2019-02-22 17:30:32 +0000 | [diff] [blame] | 275 | add_definitions(-DARMNN_TF_LITE_PARSER) |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 276 | endif() |
| 277 | |
Kevin May | 43a799c | 2019-02-08 16:31:42 +0000 | [diff] [blame] | 278 | if(BUILD_ARMNN_SERIALIZER) |
Kevin May | 43a799c | 2019-02-08 16:31:42 +0000 | [diff] [blame] | 279 | add_definitions(-DARMNN_SERIALIZER) |
Matthew Bentham | 268509a | 2019-02-25 13:58:24 +0000 | [diff] [blame] | 280 | add_definitions(-DARMNN_SERIALIZER_SCHEMA_PATH="${CMAKE_CURRENT_SOURCE_DIR}/src/armnnSerializer/ArmnnSchema.fbs") |
Kevin May | 43a799c | 2019-02-08 16:31:42 +0000 | [diff] [blame] | 281 | endif() |
| 282 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 283 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) |
Sadik Armagan | a97a0be | 2020-03-03 10:44:56 +0000 | [diff] [blame] | 284 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/profiling) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 285 | |
| 286 | # ARM Compute |
| 287 | # Note that ARM Compute has a different folder layout depending on the branch but also on |
| 288 | # whether it comes from a prepackaged archive (this is why we add several hints below) |
| 289 | if(ARMCOMPUTENEON OR ARMCOMPUTECL) |
Francis Murtagh | 82490ee | 2020-11-04 13:33:41 +0000 | [diff] [blame] | 290 | find_path(ARMCOMPUTE_INCLUDE arm_compute/core/CL/OpenCL.h |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 291 | PATHS ${ARMCOMPUTE_ROOT}/include |
| 292 | PATHS ${ARMCOMPUTE_ROOT}/applications/arm_compute |
| 293 | PATHS ${ARMCOMPUTE_ROOT} |
| 294 | NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) |
Francis Murtagh | 82490ee | 2020-11-04 13:33:41 +0000 | [diff] [blame] | 295 | find_path(ARMCOMPUTE_INCLUDE arm_compute/core/CL/OpenCL.h) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 296 | include_directories(SYSTEM "${ARMCOMPUTE_INCLUDE}") |
| 297 | |
| 298 | # Find the Arm Compute libraries if not already specified (the user may have already defined this in advance, |
| 299 | # e.g. if building clframework as a dependent cmake project) |
| 300 | if (NOT DEFINED ARMCOMPUTE_LIBRARIES) |
| 301 | # We link to the static variant so that customers don't need to find and build a compatible version of clframework. |
| 302 | # First try the folders specified ARMCOMPUTE_BUILD_DIR (with PATH_SUFFIXES for |
| 303 | # Windows builds) |
Matthew Bentham | 2624dd7 | 2020-05-20 10:44:18 +0100 | [diff] [blame] | 304 | if ((NOT DEFINED ARMCOMPUTE_BUILD_DIR) AND (DEFINED ARMCOMPUTE_ROOT)) |
| 305 | # Default build directory for ComputeLibrary is under the root |
| 306 | set(ARMCOMPUTE_BUILD_DIR ${ARMCOMPUTE_ROOT}/build) |
| 307 | endif() |
| 308 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 309 | find_library(ARMCOMPUTE_LIBRARY_DEBUG NAMES arm_compute-static |
| 310 | PATHS ${ARMCOMPUTE_BUILD_DIR} |
| 311 | PATH_SUFFIXES "Debug" |
| 312 | NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) |
| 313 | find_library(ARMCOMPUTE_LIBRARY_RELEASE NAMES arm_compute-static |
| 314 | PATHS ${ARMCOMPUTE_BUILD_DIR} |
| 315 | PATH_SUFFIXES "Release" |
| 316 | NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 317 | |
| 318 | # In case it wasn't there, try a default search (will work in cases where |
| 319 | # the library has been installed into a standard location) |
| 320 | find_library(ARMCOMPUTE_LIBRARY_DEBUG NAMES arm_compute-static) |
| 321 | find_library(ARMCOMPUTE_LIBRARY_RELEASE NAMES arm_compute-static) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 322 | |
Matthew Bentham | 6445cff | 2020-03-10 11:13:17 +0000 | [diff] [blame] | 323 | # In case it wasn't there, try the dynamic libraries |
| 324 | # This case will get used in a linux setup where the Compute Library |
| 325 | # has been installed in a standard system library path as a dynamic library |
| 326 | find_library(ARMCOMPUTE_LIBRARY_DEBUG NAMES arm_compute) |
| 327 | find_library(ARMCOMPUTE_LIBRARY_RELEASE NAMES arm_compute) |
Matthew Bentham | 6445cff | 2020-03-10 11:13:17 +0000 | [diff] [blame] | 328 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 329 | set(ARMCOMPUTE_LIBRARIES |
Nikhil Raj | 4179c6a | 2023-11-24 10:19:40 +0000 | [diff] [blame] | 330 | debug ${ARMCOMPUTE_LIBRARY_DEBUG} |
| 331 | optimized ${ARMCOMPUTE_LIBRARY_RELEASE} ) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 332 | endif() |
| 333 | endif() |
| 334 | |
| 335 | # ARM Compute NEON backend |
| 336 | if(ARMCOMPUTENEON) |
| 337 | # Add preprocessor definition for ARM Compute NEON |
| 338 | add_definitions(-DARMCOMPUTENEON_ENABLED) |
| 339 | # The ARM Compute headers contain some NEON intrinsics, so we need to build armnn with NEON support on armv7 |
| 340 | if(${CMAKE_SYSTEM_PROCESSOR} MATCHES armv7 AND COMPILER_IS_GNU_LIKE) |
| 341 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon") |
| 342 | endif() |
| 343 | endif() |
| 344 | |
| 345 | # ARM Compute OpenCL backend |
| 346 | if(ARMCOMPUTECL) |
Nikhil Raj | b55d366 | 2021-02-11 14:49:19 +0000 | [diff] [blame] | 347 | # verify we have a valid flatbuffers include path |
| 348 | find_path(FLATBUFFERS_INCLUDE_PATH flatbuffers/flatbuffers.h |
| 349 | HINTS ${FLATBUFFERS_ROOT}/include /usr/local/include /usr/include) |
| 350 | |
| 351 | message(STATUS "Flatbuffers headers are located at: ${FLATBUFFERS_INCLUDE_PATH}") |
| 352 | |
| 353 | find_library(FLATBUFFERS_LIBRARY |
| 354 | NAMES libflatbuffers.a flatbuffers |
| 355 | HINTS ${FLATBUFFERS_ROOT}/lib /usr/local/lib /usr/lib) |
| 356 | |
| 357 | message(STATUS "Flatbuffers library located at: ${FLATBUFFERS_LIBRARY}") |
| 358 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 359 | # Always use Arm compute library OpenCL headers |
Nikhil Raj | 407cddf | 2021-11-30 09:57:08 +0000 | [diff] [blame] | 360 | find_path(OPENCL_INCLUDE CL/opencl.hpp |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 361 | PATHS ${ARMCOMPUTE_ROOT}/include |
| 362 | NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) |
| 363 | |
Matthew Bentham | 3b72db0 | 2018-10-11 09:47:01 +0100 | [diff] [blame] | 364 | # Link against libOpenCL in opencl-1.2-stubs, but don't search there at runtime |
| 365 | link_libraries(-L${ARMCOMPUTE_BUILD_DIR}/opencl-1.2-stubs) |
| 366 | set(OPENCL_LIBRARIES OpenCL) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 367 | |
Matthew Bentham | 416b41d | 2020-02-05 22:15:26 +0000 | [diff] [blame] | 368 | include_directories(SYSTEM ${OPENCL_INCLUDE}) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 369 | |
| 370 | # Add preprocessor definition for ARM Compute OpenCL |
| 371 | add_definitions(-DARMCOMPUTECL_ENABLED) |
| 372 | |
| 373 | set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DARM_COMPUTE_DEBUG_ENABLED") |
| 374 | endif() |
| 375 | |
| 376 | # Used by both Arm Compute backends, but should be added |
| 377 | # to the search path after the system directories if necessary |
| 378 | if(ARMCOMPUTENEON OR ARMCOMPUTECL) |
| 379 | find_path(HALF_INCLUDE half/half.hpp) |
| 380 | find_path(HALF_INCLUDE half/half.hpp |
| 381 | PATHS ${ARMCOMPUTE_ROOT}/include |
| 382 | NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 383 | include_directories(SYSTEM ${HALF_INCLUDE}) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 384 | endif() |
| 385 | |
Matteo Martincigh | db16dd3 | 2019-08-27 16:41:11 +0100 | [diff] [blame] | 386 | # ArmNN reference backend |
| 387 | if(ARMNNREF) |
| 388 | add_definitions(-DARMNNREF_ENABLED) |
Matteo Martincigh | e67edb2 | 2019-08-14 14:05:46 +0100 | [diff] [blame] | 389 | endif() |
| 390 | |
Matthew Sloyan | c01da45 | 2023-01-23 10:20:04 +0000 | [diff] [blame] | 391 | # If a backend requires TOSA common, add it here. |
Cathal Corbett | 9c9d5b9 | 2022-08-17 17:30:16 +0100 | [diff] [blame] | 392 | if(ARMNNTOSAREF) |
Matthew Sloyan | c01da45 | 2023-01-23 10:20:04 +0000 | [diff] [blame] | 393 | set(ARMNNTOSACOMMON ON) |
| 394 | endif() |
| 395 | |
| 396 | if(ARMNNTOSACOMMON) |
| 397 | # Locate the includes for the TOSA serialization library as it is needed for TOSA common and TOSA backends. |
Cathal Corbett | 9c9d5b9 | 2022-08-17 17:30:16 +0100 | [diff] [blame] | 398 | message(STATUS "TOSA serialization library root set to ${TOSA_SERIALIZATION_LIB_ROOT}") |
| 399 | |
Matthew Sloyan | d646b55 | 2022-10-10 12:42:16 +0100 | [diff] [blame] | 400 | find_path(TOSA_SERIALIZATION_LIB_INCLUDE tosa_serialization_handler.h |
| 401 | HINTS ${TOSA_SERIALIZATION_LIB_ROOT}/include) |
Cathal Corbett | 9c9d5b9 | 2022-08-17 17:30:16 +0100 | [diff] [blame] | 402 | message(STATUS "TOSA serialization library include directory located at: ${TOSA_SERIALIZATION_LIB_INCLUDE}") |
| 403 | |
| 404 | find_library(TOSA_SERIALIZATION_LIB |
Matthew Sloyan | d646b55 | 2022-10-10 12:42:16 +0100 | [diff] [blame] | 405 | NAMES tosa_serialization_lib.a tosa_serialization_lib |
| 406 | HINTS ${TOSA_SERIALIZATION_LIB_ROOT}/lib /usr/local/lib /usr/lib) |
Cathal Corbett | 9c9d5b9 | 2022-08-17 17:30:16 +0100 | [diff] [blame] | 407 | message(STATUS "TOSA serialization library set to ${TOSA_SERIALIZATION_LIB}") |
Matthew Sloyan | d646b55 | 2022-10-10 12:42:16 +0100 | [diff] [blame] | 408 | |
Matthew Sloyan | c01da45 | 2023-01-23 10:20:04 +0000 | [diff] [blame] | 409 | # Include required headers for TOSA Serialization Library |
| 410 | include_directories(SYSTEM ${FLATBUFFERS_INCLUDE_PATH}) |
| 411 | include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/third-party/half) |
| 412 | include_directories(SYSTEM ${TOSA_SERIALIZATION_LIB_INCLUDE}) |
| 413 | endif() |
| 414 | |
| 415 | # ArmNN TOSA reference backend |
| 416 | if(ARMNNTOSAREF) |
| 417 | # Locate the includes for the TOSA Reference Model, which is specific to the TOSA Reference Backend. |
Matthew Sloyan | d646b55 | 2022-10-10 12:42:16 +0100 | [diff] [blame] | 418 | message(STATUS "TOSA Reference Model root set to ${TOSA_REFERENCE_MODEL_ROOT}") |
| 419 | |
| 420 | find_path(TOSA_REFERENCE_MODEL_INCLUDE model_runner.h |
| 421 | HINTS ${TOSA_REFERENCE_MODEL_ROOT}/include) |
| 422 | message(STATUS "TOSA Reference Model include directory located at: ${TOSA_REFERENCE_MODEL_INCLUDE}") |
| 423 | |
Matthew Sloyan | c01da45 | 2023-01-23 10:20:04 +0000 | [diff] [blame] | 424 | include_directories(SYSTEM ${TOSA_REFERENCE_MODEL_INCLUDE}) |
| 425 | |
Matthew Sloyan | d646b55 | 2022-10-10 12:42:16 +0100 | [diff] [blame] | 426 | find_library(TOSA_REFERENCE_MODEL_LIB |
| 427 | NAMES tosa_reference_model_lib.a tosa_reference_model_lib |
| 428 | HINTS ${TOSA_REFERENCE_MODEL_ROOT}/lib /usr/local/lib /usr/lib) |
| 429 | message(STATUS "TOSA Reference Model set to ${TOSA_REFERENCE_MODEL_LIB}") |
Matthew Sloyan | 67fd526 | 2022-12-07 19:28:18 +0000 | [diff] [blame] | 430 | |
| 431 | if(TOSA_REFERENCE_MODEL_OUTPUT) |
| 432 | add_definitions("-DTOSA_REFERENCE_MODEL_OUTPUT=1") |
| 433 | endif() |
Cathal Corbett | 9c9d5b9 | 2022-08-17 17:30:16 +0100 | [diff] [blame] | 434 | endif() |
| 435 | |
Colm Donelan | aa93d98 | 2020-06-28 08:16:46 +0100 | [diff] [blame] | 436 | # This is the root for the dynamic backend tests to search for dynamic |
| 437 | # backends. By default it will be the project build directory. |
Rob Hughes | 35c31c0 | 2020-08-17 15:47:20 +0100 | [diff] [blame] | 438 | add_definitions(-DDYNAMIC_BACKEND_BUILD_DIR="${PROJECT_BINARY_DIR}") |
Colm Donelan | aa93d98 | 2020-06-28 08:16:46 +0100 | [diff] [blame] | 439 | |
Narumol Prangnawarat | 60a20fb | 2019-12-09 17:24:41 +0000 | [diff] [blame] | 440 | # ArmNN dynamic backend |
| 441 | if(DYNAMIC_BACKEND_PATHS) |
| 442 | add_definitions(-DARMNN_DYNAMIC_BACKEND_ENABLED) |
| 443 | endif() |
| 444 | |
Narumol Prangnawarat | 867eba5 | 2020-02-03 12:29:56 +0000 | [diff] [blame] | 445 | if(SAMPLE_DYNAMIC_BACKEND) |
| 446 | add_definitions(-DSAMPLE_DYNAMIC_BACKEND_ENABLED) |
| 447 | endif() |
| 448 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 449 | # Streamline annotate |
| 450 | if(PROFILING_BACKEND_STREAMLINE) |
| 451 | include_directories("${GATOR_ROOT}/annotate") |
| 452 | add_definitions(-DARMNN_STREAMLINE_ENABLED) |
| 453 | endif() |
| 454 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 455 | if(HEAP_PROFILING OR LEAK_CHECKING) |
Kevin May | 1bbfaca | 2022-11-22 11:58:05 +0000 | [diff] [blame] | 456 | find_path(HEAP_PROFILER_INCLUDE gperftools/heap-profiler.h |
| 457 | PATHS ${GPERFTOOLS_ROOT}/include |
| 458 | NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) |
| 459 | include_directories(SYSTEM "${HEAP_PROFILER_INCLUDE}") |
| 460 | find_library(GPERF_TOOLS_LIBRARY |
| 461 | NAMES tcmalloc_debug |
| 462 | HINTS ${GPERFTOOLS_ROOT}/lib) |
| 463 | link_directories(${GPERFTOOLS_ROOT}/lib) |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 464 | |
Kevin May | 1bbfaca | 2022-11-22 11:58:05 +0000 | [diff] [blame] | 465 | link_libraries(${GPERF_TOOLS_LIBRARY}) |
| 466 | if (HEAP_PROFILING) |
| 467 | add_definitions("-DARMNN_HEAP_PROFILING_ENABLED=1") |
| 468 | endif() |
| 469 | if (LEAK_CHECKING) |
| 470 | add_definitions("-DARMNN_LEAK_CHECKING_ENABLED=1") |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 471 | endif() |
| 472 | else() |
| 473 | # Valgrind only works with gperftools version number <= 2.4 |
Ryan OShea | a3dc95e | 2023-03-20 11:10:40 +0000 | [diff] [blame] | 474 | include(CheckIncludeFiles) |
| 475 | CHECK_INCLUDE_FILES("valgrind/memcheck.h" VALGRIND_FOUND) |
Jim Flynn | 870b96c | 2022-03-25 21:24:56 +0000 | [diff] [blame] | 476 | endif() |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 477 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 478 | if(NOT BUILD_TF_LITE_PARSER) |
| 479 | message(STATUS "Tensorflow Lite parser support is disabled") |
| 480 | endif() |
David Beck | 10b4dfd | 2018-09-19 12:03:20 +0100 | [diff] [blame] | 481 | |
Nattapat Chaimanowong | 949f125 | 2019-01-31 15:36:39 +0000 | [diff] [blame] | 482 | if(NOT BUILD_ARMNN_SERIALIZER) |
| 483 | message(STATUS "Armnn Serializer support is disabled") |
| 484 | endif() |
| 485 | |
Pavel Macenauer | 59e057f | 2020-04-15 14:17:26 +0000 | [diff] [blame] | 486 | if(NOT BUILD_PYTHON_WHL) |
| 487 | message(STATUS "PyArmNN wheel package is disabled") |
| 488 | endif() |
| 489 | |
| 490 | if(NOT BUILD_PYTHON_SRC) |
| 491 | message(STATUS "PyArmNN source package is disabled") |
| 492 | endif() |
| 493 | |
| 494 | if(BUILD_PYTHON_WHL OR BUILD_PYTHON_SRC) |
| 495 | find_package(PythonInterp 3 REQUIRED) |
| 496 | if(NOT ${PYTHONINTERP_FOUND}) |
| 497 | message(FATAL_ERROR "Python 3.x required to build PyArmNN, but not found") |
| 498 | endif() |
| 499 | |
| 500 | find_package(PythonLibs 3 REQUIRED) |
| 501 | if(NOT ${PYTHONLIBS_FOUND}) |
| 502 | message(FATAL_ERROR "Python 3.x development package required to build PyArmNN, but not found") |
| 503 | endif() |
| 504 | |
| 505 | find_package(SWIG 4 REQUIRED) |
| 506 | if(NOT ${SWIG_FOUND}) |
| 507 | message(FATAL_ERROR "SWIG 4.x requried to build PyArmNN, but not found") |
| 508 | endif() |
| 509 | endif() |
| 510 | |
David Beck | 10b4dfd | 2018-09-19 12:03:20 +0100 | [diff] [blame] | 511 | # ArmNN source files required for all build options |
| 512 | include_directories(SYSTEM third-party) |