diff options
author | Jan Eilers <jan.eilers@arm.com> | 2021-12-08 10:05:47 +0000 |
---|---|---|
committer | Keith Davis <keith.davis@arm.com> | 2022-06-29 10:04:20 +0100 |
commit | a96489a2fd459bd3d73297fa5fdaef5d13a57a4e (patch) | |
tree | 2299402be2854c1bd508f57a35edc5c9059961f6 /CMakeLists.txt | |
parent | 764ac655bd301ffc8cde4c912e67499954f9ef8f (diff) | |
download | armnn-a96489a2fd459bd3d73297fa5fdaef5d13a57a4e.tar.gz |
Add jni interface for the ArmNN Delegate
* adds a version script to hide away all symbols that
are not required to use the interface
* the main purpose of the jni interface is to enable the
delegate to be used in android apps
* Add static building to patch - see patch 7 for JNI patch only
Signed-off-by: Jan Eilers <jan.eilers@arm.com>
Signed-off-by: Keith Davis <keith.davis@arm.com>
Change-Id: I9bb2d698b5fdb0d1b30cf79e6f19746310cd61b2
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 1fcadb0475..c112accdf4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,13 +60,6 @@ add_subdirectory(src/armnnSerializer) add_subdirectory(src/armnnDeserializer) add_subdirectory(src/armnnTestUtils) - -if (BUILD_ARMNN_TFLITE_DELEGATE) - set(ARMNN_SUB_PROJECT ON) - add_subdirectory(delegate) - add_definitions(-DARMNN_TF_LITE_DELEGATE) -endif() - if (BUILD_TESTS) add_subdirectory(tests) endif() @@ -443,20 +436,35 @@ foreach(lib ${armnnLibraries}) list(APPEND armnn_sources $<TARGET_OBJECTS:${lib}>) endforeach() +# The delegate needs to be placed after armnnLibraries has been fully populated. The armnn_delegate_jni library +# requires a static armnn build. +# Explanation: +# Because backends are added as object libraries they won't be linked to armnn when building armnn statically. +# A target that uses a static armnn library has to link to the object libraries in the variable armnnLibraries +# manually to include all symbols from backends. +if (BUILD_ARMNN_TFLITE_DELEGATE) + set(ARMNN_SUB_PROJECT ON) + set(ARMNN_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + add_subdirectory(delegate) + add_definitions(-DARMNN_TF_LITE_DELEGATE) +endif() + if(BUILD_BARE_METAL) add_library_ex(armnn STATIC ${armnn_sources}) else() - add_library_ex(armnn SHARED ${armnn_sources}) + if (BUILD_SHARED_LIBS) + add_library_ex(armnn SHARED ${armnn_sources}) + else() + add_library(armnn ${armnn_sources}) + endif() endif() target_compile_definitions(armnn PRIVATE "ARMNN_COMPILING_DLL") # Generate a map file for debug mode only -if(CMAKE_BUILD_TYPE MATCHES debug) - set_property(TARGET armnn APPEND_STRING PROPERTY +set_property(TARGET armnn APPEND_STRING PROPERTY LINK_FLAGS " -Wl,-Map=libarmnnMapFile.map") - message(STATUS "Linker will generate mapfile " ) -endif() +message(STATUS "Linker will generate mapfile ") target_include_directories(armnn PUBLIC |