From b4e6720edc20ac561716a4681ae1e72c8489f619 Mon Sep 17 00:00:00 2001 From: Matthew Bentham Date: Thu, 31 Oct 2019 09:55:01 +0000 Subject: Github #277 Add option to use shared boost libraries Pass -DSHARED_BOOST=ON to cmake to link dynamically to boost. This makes it possible to use standard package-installed boost libraries in a native build. Change-Id: I6cbd72fae8b0cf8ae07f4382ab0510854c1623fd Signed-off-by: Matthew Bentham --- cmake/GlobalConfig.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmake/GlobalConfig.cmake b/cmake/GlobalConfig.cmake index 2c1989e006..af579488e6 100644 --- a/cmake/GlobalConfig.cmake +++ b/cmake/GlobalConfig.cmake @@ -22,6 +22,7 @@ option(TF_LITE_GENERATED_PATH "Tensorflow lite generated C++ schema location" OF option(FLATBUFFERS_ROOT "Location where the flatbuffers 'include' and 'lib' folders to be found" Off) option(DYNAMIC_BACKEND_PATHS "Colon seperated list of paths where to load the dynamic backends from" "") option(BUILD_GATORD_MOCK "Build the Gatord simulator for external profiling testing." ON) +option(SHARED_BOOST "Use dynamic linking for boost libraries" OFF) include(SelectLibraryConfigurations) @@ -108,8 +109,13 @@ endif() set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH}) # Boost +if(SHARED_BOOST) + add_definitions(-DBOOST_ALL_DYN_LINK) + set(Boost_USE_STATIC_LIBS OFF) +else() + set(Boost_USE_STATIC_LIBS ON) +endif() add_definitions("-DBOOST_ALL_NO_LIB") # Turn off auto-linking as we specify the libs manually -set(Boost_USE_STATIC_LIBS ON) find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework system filesystem log program_options) include_directories(SYSTEM "${Boost_INCLUDE_DIRS}") link_directories(${Boost_LIBRARY_DIRS}) -- cgit v1.2.1