From: 박종현/On-Device Lab(SR)/Staff Engineer/삼성전자 Date: Tue, 29 Jan 2019 09:56:11 +0000 (+0900) Subject: Rollback Protocol Buffer 3.6.1 integration (#2949) X-Git-Tag: nncc_backup~909 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c7f7bccba0c70e34fb6133edac3504a55308969e;p=platform%2Fcore%2Fml%2Fnnfw.git Rollback Protocol Buffer 3.6.1 integration (#2949) Let's rollback to previous Protocol Buffer import routine. Signed-off-by: Jonghyun Park --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 859c017..abd31fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,7 +34,7 @@ message(STATUS "Use '${CMAKE_BUILD_TYPE}' configuration") ### Configuration ### option(DOWNLOAD_PROTOBUF "Download Protocol Buffer source" ON) -option(BUILD_PROTOBUF "Locally build Protocol Buffer from the downloaded source" ON) +option(BUILD_PROTOBUF "Locally build Protocol Buffer from the downloaded source" OFF) option(DOWNLOAD_EIGEN "Download Eigen source" ON) option(DOWNLOAD_FARMHASH "Download farmhash source" ON) option(DOWNLOAD_GEMMLOWP "Download GEMM low precesion library source" ON) diff --git a/cmake/packages/ProtobufConfig.cmake b/cmake/packages/ProtobufConfig.cmake index 5679614..2bacde6 100644 --- a/cmake/packages/ProtobufConfig.cmake +++ b/cmake/packages/ProtobufConfig.cmake @@ -1,3 +1,27 @@ +# TODO Use CONFIG version after bug fix +function(_Protobuf_module_import) + # Let's use find_package here not to export unnecessary definitions + find_package(Protobuf MODULE QUIET) + + if(NOT PROTOBUF_FOUND) + set(Protobuf_FOUND FALSE PARENT_SCOPE) + return() + endif(NOT PROTOBUF_FOUND) + + if(NOT TARGET protoc) + add_executable(protoc IMPORTED) + set_target_properties(protoc PROPERTIES IMPORTED_LOCATION ${PROTOBUF_PROTOC_EXECUTABLE}) + endif(NOT TARGET protoc) + + if(NOT TARGET libprotobuf) + add_library(libprotobuf INTERFACE) + target_include_directories(libprotobuf INTERFACE ${PROTOBUF_INCLUDE_DIRS}) + target_link_libraries(libprotobuf INTERFACE ${PROTOBUF_LIBRARIES}) + endif(NOT TARGET libprotobuf) + + set(Protobuf_FOUND TRUE PARENT_SCOPE) +endfunction(_Protobuf_module_import) + function(_Protobuf_import) # Let's use find_package here not to export unnecessary definitions # NOTE Here we use "exact" match to avoid possible infinite loop @@ -78,8 +102,10 @@ function(_Protobuf_build) message(STATUS "Succeeded in building Protocol Buffer") endfunction(_Protobuf_build) +# TODO Use Protocol Buffer 3.6.1 _Protobuf_build() -_Protobuf_import() +#_Protobuf_import() +_Protobuf_module_import() if(Protobuf_FOUND) function(Protobuf_Generate PREFIX OUTPUT_DIR PROTO_DIR)