diff options
author | Finn Williams <Finn.Williams@arm.com> | 2020-11-13 13:23:15 +0000 |
---|---|---|
committer | Finn Williams <Finn.Williams@arm.com> | 2020-11-16 12:31:03 +0000 |
commit | 6f9f99024df71b6b7f7115b58d85eb100c66f3c5 (patch) | |
tree | 412f5c3b4f9ade8fa9cc66cfe84c76b5ac52b461 /delegate/CMakeLists.txt | |
parent | 72a7cf21453253ed4ac0c17c39773179c857935f (diff) | |
download | armnn-6f9f99024df71b6b7f7115b58d85eb100c66f3c5.tar.gz |
IVGCVSW-5508 Activate compiler warnings in ArmNN TfLite Delegate
Signed-off-by: Finn Williams <Finn.Williams@arm.com>
Change-Id: I1a8e2aa618ff693c61010e6150f3ca41b8ab1201
Diffstat (limited to 'delegate/CMakeLists.txt')
-rw-r--r-- | delegate/CMakeLists.txt | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/delegate/CMakeLists.txt b/delegate/CMakeLists.txt index de6566ac33..d4de4c23fe 100644 --- a/delegate/CMakeLists.txt +++ b/delegate/CMakeLists.txt @@ -6,7 +6,7 @@ cmake_minimum_required (VERSION 3.8.0) project(armnnDelegate) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -Wextra -Werror -Wold-style-cast -Wno-missing-braces -Wconversion -Wsign-conversion") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") @@ -72,9 +72,18 @@ find_package(TfLite REQUIRED MODULE) target_link_libraries(armnnDelegate ${TfLite_LIB}) -target_include_directories(armnnDelegate - PRIVATE - ${TfLite_INCLUDE_DIR}) +# Various tflite header files are not warning clean +# We can't change compilation flags on header files directly, so we need to add them to an interface library first +add_library(tflite_headers INTERFACE) +target_include_directories(tflite_headers INTERFACE $<BUILD_INTERFACE:${TfLite_INCLUDE_DIR}> + $<INSTALL_INTERFACE:include/tflite_headers>) + +target_compile_options(tflite_headers INTERFACE $<$<CXX_COMPILER_ID:GNU>:-Wno-conversion + -Wno-sign-conversion + -Wno-unused-parameter + -Wno-unused-function>) + +target_link_libraries(armnnDelegate tflite_headers) ## Add Flatbuffers dependency find_package(Flatbuffers REQUIRED MODULE) @@ -82,9 +91,14 @@ find_package(Flatbuffers REQUIRED MODULE) target_link_libraries(armnnDelegate ${Flatbuffers_LIB}) -target_include_directories(armnnDelegate - PRIVATE - ${Flatbuffers_INCLUDE_DIR}) +# include/flatbuffers/flatbuffers.h is not warning clean +# We can't change compilation flags on header files directly, so we need to add them to an interface library first +add_library(flatbuffer_headers INTERFACE) +target_include_directories(flatbuffer_headers INTERFACE $<BUILD_INTERFACE:${Flatbuffers_INCLUDE_DIR}> + $<INSTALL_INTERFACE:include/flatbuffer_headers>) +target_compile_options(flatbuffer_headers INTERFACE $<$<CXX_COMPILER_ID:GNU>:-Wno-sign-conversion>) + +target_link_libraries(armnnDelegate flatbuffer_headers) option(BUILD_UNIT_TESTS "Build unit tests" ON) if(BUILD_UNIT_TESTS) @@ -121,20 +135,19 @@ if(BUILD_UNIT_TESTS) target_link_libraries(DelegateUnitTests armnnDelegate) target_link_libraries(DelegateUnitTests Armnn::armnnUtils) - target_include_directories(DelegateUnitTests - PRIVATE - ${TfLite_INCLUDE_DIR}) +target_link_libraries(DelegateUnitTests tflite_headers) + +target_link_libraries(DelegateUnitTests flatbuffer_headers) - target_include_directories(DelegateUnitTests - PRIVATE - ${Flatbuffers_INCLUDE_DIR}) endif() #################################################### ## Export targets set(armnn_delegate_export_targets) list(APPEND armnn_delegate_export_targets - armnnDelegate) + armnnDelegate + tflite_headers + flatbuffer_headers) install( TARGETS ${armnn_delegate_export_targets} |