From 6db3bad6af916dd099d4bbfa78e1a463c04ac145 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=A2=85=ED=98=84/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Senior=20Engineer/=EC=82=BC=EC=84=B1?= =?utf8?q?=EC=A0=84=EC=9E=90?= Date: Fri, 4 May 2018 10:14:35 +0900 Subject: [PATCH] Add 'CaffeProto' as an external module (#193) This commit adds 'CaffeProto' external module which provides 'libcaffeproto' library. This library allows us to parse .prototxt and .caffemodel files. Signed-off-by: Jonghyun Park --- cmake/packages/CaffeProtoConfig.cmake | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 cmake/packages/CaffeProtoConfig.cmake diff --git a/cmake/packages/CaffeProtoConfig.cmake b/cmake/packages/CaffeProtoConfig.cmake new file mode 100644 index 0000000..7863a24 --- /dev/null +++ b/cmake/packages/CaffeProtoConfig.cmake @@ -0,0 +1,27 @@ +function(_CaffeProto_import) + nncc_find_package(CaffeSource) + + if(NOT CaffeSource_FOUND) + set(CaffeProto_FOUND FALSE PARENT_SCOPE) + return() + endif(NOT CaffeSource_FOUND) + + nncc_find_package(Protobuf) + + if(NOT Protobuf_FOUND) + set(CaffeProto_FOUND FALSE PARENT_SCOPE) + return() + endif(NOT Protobuf_FOUND) + + Protobuf_Generate(CAFFE_PROTO "${CMAKE_BINARY_DIR}/generated/caffe" "${CaffeSource_DIR}/src" "caffe/proto/caffe.proto") + + if(NOT TARGET caffeproto) + add_library(caffeproto SHARED ${CAFFE_PROTO_SOURCES}) + target_include_directories(caffeproto PUBLIC ${CAFFE_PROTO_INCLUDE_DIRS}) + target_link_libraries(caffeproto libprotobuf) + endif(NOT TARGET caffeproto) + + set(CaffeProto_FOUND TRUE PARENT_SCOPE) +endfunction(_CaffeProto_import) + +_CaffeProto_import() -- 2.7.4