[nnc] tflite schema moved to separate target (#1092)
authorIvan Vagin/AI Tools Lab /SRR/Engineer/삼성전자 <ivan.vagin@samsung.com>
Tue, 21 Aug 2018 18:20:27 +0000 (21:20 +0300)
committerРоман Михайлович Русяев/AI Tools Lab /SRR/Staff Engineer/삼성전자 <r.rusyaev@samsung.com>
Tue, 21 Aug 2018 18:20:27 +0000 (21:20 +0300)
Moved tflite schema to separate target

contrib/nnc/libs/frontend/tflite/CMakeLists.txt

index 2486323..8f0e01d 100644 (file)
@@ -1,5 +1,9 @@
 nncc_find_package(FlatBuffers OPTIONAL)
 
+###################
+# SCHEMA          #
+###################
+
 # Compile flatbuffers schemas
 # Produces FB_GEN_SOURCES and FB_GEN_INCLUDE_DIRS variables
 set(GENERATED_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated")
@@ -8,6 +12,10 @@ FlatBuffers_Generate(FB_GEN
                      ${CMAKE_CURRENT_SOURCE_DIR}/schema
                      schema_v3.fbs)
 
+add_nncc_library(tflite_schema STATIC ${FB_GEN_SOURCES})
+target_link_libraries(tflite_schema PUBLIC flatbuffers)
+target_include_directories(tflite_schema PUBLIC ${FB_GEN_INCLUDE_DIRS})
+
 ###################
 # TFLITE importer #
 ###################
@@ -19,14 +27,13 @@ set(tflite_importer_sources ${CMAKE_CURRENT_SOURCE_DIR}/src/tflite_walker.cpp
                             ${CMAKE_CURRENT_SOURCE_DIR}/src/tflite_v3_importer.cpp
                             ${CMAKE_CURRENT_SOURCE_DIR}/src/tflite_plugin.cpp)
 file(GLOB tflite_importer_headers include/*.h)
-list(APPEND tflite_importer_headers ${FB_GEN_SOURCES})
 
 set(tflite_import tflite_import)
 add_library(${tflite_import} SHARED ${tflite_importer_sources} ${tflite_importer_headers})
 
-target_include_directories(${tflite_import} PUBLIC ${FB_GEN_INCLUDE_DIRS})
 target_include_directories(${tflite_import} PUBLIC include)
 
+target_link_libraries(${tflite_import} PUBLIC tflite_schema)
 target_link_libraries(${tflite_import} PUBLIC flatbuffers)
 target_link_libraries(${tflite_import} PUBLIC ${nn_import_common})
 target_link_libraries(${tflite_import} PUBLIC nnc_support)
@@ -43,4 +50,5 @@ file(GLOB tflite_example_sources examples/*)
 set(tflite_import_example tflite_import_example)
 add_executable(${tflite_import_example} ${tflite_example_sources} ${OPTIONS_SRC})
 
+target_link_libraries(${tflite_import_example} PUBLIC tflite_schema)
 target_link_libraries(${tflite_import_example} PRIVATE ${tflite_import})