From c3da2680f605e705c95811c7ba93770e200e5dc0 Mon Sep 17 00:00:00 2001 From: Rob Hughes Date: Tue, 7 Jan 2020 13:26:42 +0000 Subject: Support different flatbuffer libs for debug and release The existing FLATBUFFERS_LIBRARY variable is still honoured, but if not specified then we use CMake's find_library to find the debug and release variants, using PATH_SUFFIXES to help separate debug and release. This is the same approach we use for the armcompute libs. Change-Id: I21e8da3f76669dbfb8dbdf49046f9db46cba50a2 Signed-off-by: Robert Hughes --- src/armnnTfLiteParser/CMakeLists.txt | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/armnnTfLiteParser/CMakeLists.txt b/src/armnnTfLiteParser/CMakeLists.txt index ae60079ab6..97c55a1d08 100755 --- a/src/armnnTfLiteParser/CMakeLists.txt +++ b/src/armnnTfLiteParser/CMakeLists.txt @@ -19,7 +19,21 @@ if(BUILD_TF_LITE_PARSER) target_include_directories(armnnTfLiteParser SYSTEM PRIVATE "${TF_LITE_SCHEMA_INCLUDE_PATH}") target_link_libraries(armnnTfLiteParser ${Boost_FILESYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY}) - target_link_libraries(armnnTfLiteParser armnn ${FLATBUFFERS_LIBRARY}) + + # If user has explicitly specified flatbuffers lib then use that, + # otherwise search for it based on FLATBUFFERS_BUILD_DIR + if (FLATBUFFERS_LIBRARY) + target_link_libraries(armnnTfLiteParser armnn ${FLATBUFFERS_LIBRARY}) + else() + # Use PATH_SUFFIXES to help find separate libs for debug/release on Windows builds + find_library(FLATBUFFERS_LIBRARY_DEBUG NAMES flatbuffers + HINTS ${FLATBUFFERS_BUILD_DIR} + PATH_SUFFIXES "Debug") + find_library(FLATBUFFERS_LIBRARY_RELEASE NAMES flatbuffers + HINTS ${FLATBUFFERS_BUILD_DIR} + PATH_SUFFIXES "Release") + target_link_libraries(armnnTfLiteParser armnn debug ${FLATBUFFERS_LIBRARY_DEBUG} optimized ${FLATBUFFERS_LIBRARY_RELEASE}) + endif() set_target_properties(armnnTfLiteParser PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} ) -- cgit v1.2.1