aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorJim Flynn <jim.flynn@arm.com>2022-03-25 21:24:56 +0000
committerJim Flynn <jim.flynn@arm.com>2022-04-11 14:24:34 +0100
commit870b96c643388ae88dd4245b9169f526d6a8d49e (patch)
tree44a675f1eecdbf0eff40dc4ee623e0a2f03b2f96 /cmake
parentb99799bda8fe0fb0a755eebbe2d02dbb74507c9f (diff)
downloadarmnn-870b96c643388ae88dd4245b9169f526d6a8d49e.tar.gz
IVGCVSW-6707 Enables a bare metal compile
Change-Id: Icc2f83c5f27f413758fee3e5c1445e9fc44f42c8 Signed-off-by: Jim Flynn <jim.flynn@arm.com>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/GlobalConfig.cmake22
1 files changed, 19 insertions, 3 deletions
diff --git a/cmake/GlobalConfig.cmake b/cmake/GlobalConfig.cmake
index 2c5bc837e6..2cc184c796 100644
--- a/cmake/GlobalConfig.cmake
+++ b/cmake/GlobalConfig.cmake
@@ -3,6 +3,9 @@
# Copyright 2020 NXP
# SPDX-License-Identifier: MIT
#
+
+cmake_policy(SET CMP0077 NEW)
+
option(BUILD_ONNX_PARSER "Build Onnx parser" OFF)
option(BUILD_UNIT_TESTS "Build unit tests" ON)
option(BUILD_TESTS "Build test applications" OFF)
@@ -33,6 +36,7 @@ option(BUILD_STATIC_PIPE_LIBS "Build Static PIPE libraries" OFF)
option(BUILD_PIPE_ONLY "Build the PIPE libraries only" OFF)
option(BUILD_ARMNN_TFLITE_DELEGATE "Build the Arm NN TfLite delegate" OFF)
option(BUILD_MEMORY_STRATEGY_BENCHMARK "Build the MemoryBenchmark" OFF)
+option(BUILD_BARE_METAL "Disable features requiring operating system support" OFF)
include(SelectLibraryConfigurations)
@@ -72,7 +76,8 @@ if(COMPILER_IS_GNU_LIKE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-psabi")
endif()
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC)
- # Disable C4996 (use of deprecated identifier) due to https://developercommunity.visualstudio.com/content/problem/252574/deprecated-compilation-warning-for-virtual-overrid.html
+ # Disable C4996 (use of deprecated identifier) due to
+ # https://developercommunity.visualstudio.com/content/problem/252574/deprecated-compilation-warning-for-virtual-overrid.html
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /MP /wd4996")
add_definitions(-DNO_STRICT=1)
endif()
@@ -140,7 +145,9 @@ if (NOT BUILD_PIPE_ONLY)
endif()
# pthread
-find_dependency(Threads)
+if (NOT BUILD_BARE_METAL)
+find_package(Threads)
+endif()
# Favour the protobuf passed on command line
if(BUILD_ONNX_PARSER)
@@ -345,6 +352,7 @@ if(PROFILING_BACKEND_STREAMLINE)
add_definitions(-DARMNN_STREAMLINE_ENABLED)
endif()
+if(NOT BUILD_BARE_METAL)
if(HEAP_PROFILING OR LEAK_CHECKING)
# enable heap profiling for everything except for referencetests
if(NOT ${PROJECT_NAME} STREQUAL "referencetests")
@@ -371,7 +379,7 @@ else()
# Valgrind only works with gperftools version number <= 2.4
CHECK_INCLUDE_FILE(valgrind/memcheck.h VALGRIND_FOUND)
endif()
-
+endif()
if(NOT BUILD_TF_LITE_PARSER)
message(STATUS "Tensorflow Lite parser support is disabled")
@@ -406,5 +414,13 @@ if(BUILD_PYTHON_WHL OR BUILD_PYTHON_SRC)
endif()
endif()
+if(BUILD_BARE_METAL)
+ add_definitions(-DARMNN_BUILD_BARE_METAL
+ -DARMNN_DISABLE_FILESYSTEM
+ -DARMNN_DISABLE_PROCESSES
+ -DARMNN_DISABLE_THREADS
+ -DARMNN_DISABLE_SOCKETS)
+endif()
+
# ArmNN source files required for all build options
include_directories(SYSTEM third-party)