Use -fPIC build flag for tflite only (#4175)
author오형석/On-Device Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Wed, 9 Jan 2019 04:15:33 +0000 (13:15 +0900)
committer박세희/On-Device Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com>
Wed, 9 Jan 2019 04:15:33 +0000 (13:15 +0900)
* Use -fPIC build flag for tflite only

Instead of global setting, use -fPIC build flag for tenroflow lite only

Signed-off-by: Hyeongseok Oh <hseok82.oh@samsung.com>
* Specify to build tensorflow lite library static

cmake/option/option_armv7l-linux.cmake
externals/CMakeLists.txt

index b295b4a..42988bc 100644 (file)
@@ -18,7 +18,6 @@ set(FLAGS_COMMON ${FLAGS_COMMON}
     "-mfpu=neon-vfpv4"
     "-funsafe-math-optimizations"
     "-ftree-vectorize"
-    "-fPIC"
     )
 
 # remove warning from arm cl
index fcbdae9..2644984 100644 (file)
@@ -86,9 +86,10 @@ if("${TARGET_OS}" STREQUAL "android")
   list(APPEND TFLITE_INCLUDES "${NDK_DIR}")
 endif()
 
-add_library(tensorflow-lite ${TFLITE_SRCS})
+add_library(tensorflow-lite STATIC ${TFLITE_SRCS})
 target_include_directories(tensorflow-lite SYSTEM PUBLIC ${TFLITE_INCLUDES})
 target_compile_definitions(tensorflow-lite PUBLIC "GEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK")
+target_compile_options(tensorflow-lite PRIVATE -fPIC)
 if(BUILD_TFLITE_BENCHMARK_MODEL)
   target_compile_definitions(tensorflow-lite PUBLIC "TFLITE_PROFILING_ENABLED")
 endif()