diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 4a398d03a..64efe0db9 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -1,6 +1,7 @@ add_subdirectory(caffe) add_subdirectory(mxnet) +add_subdirectory(onnx) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../src) include_directories(${CMAKE_CURRENT_BINARY_DIR}/../src) diff --git a/tools/caffe/CMakeLists.txt b/tools/caffe/CMakeLists.txt index a6e035518..4d549ad23 100644 --- a/tools/caffe/CMakeLists.txt +++ b/tools/caffe/CMakeLists.txt @@ -8,6 +8,5 @@ if(PROTOBUF_FOUND) add_executable(caffe2ncnn caffe2ncnn.cpp ${CAFFE_PROTO_SRCS} ${CAFFE_PROTO_HDRS}) target_link_libraries(caffe2ncnn ${PROTOBUF_LIBRARIES}) else() - MESSAGE(WARNING "Protobuf not found, caffe model convert tools won't build") + message(WARNING "Protobuf not found, caffe model convert tool won't be built") endif() - diff --git a/tools/onnx/CMakeLists.txt b/tools/onnx/CMakeLists.txt index 8ca98d8b5..5fdec3ecc 100644 --- a/tools/onnx/CMakeLists.txt +++ b/tools/onnx/CMakeLists.txt @@ -1,11 +1,12 @@ -find_package(Protobuf REQUIRED) - -include_directories(${PROTOBUF_INCLUDE_DIR}) - -include_directories(${CMAKE_CURRENT_BINARY_DIR}) -protobuf_generate_cpp(ONNX_PROTO_SRCS ONNX_PROTO_HDRS onnx.proto) - -add_executable(onnx2ncnn onnx2ncnn.cpp ${ONNX_PROTO_SRCS} ${ONNX_PROTO_HDRS}) - -target_link_libraries(onnx2ncnn ${PROTOBUF_LIBRARIES}) +find_package(Protobuf) + +if(PROTOBUF_FOUND) + include_directories(${PROTOBUF_INCLUDE_DIR}) + include_directories(${CMAKE_CURRENT_BINARY_DIR}) + protobuf_generate_cpp(ONNX_PROTO_SRCS ONNX_PROTO_HDRS onnx.proto) + add_executable(onnx2ncnn onnx2ncnn.cpp ${ONNX_PROTO_SRCS} ${ONNX_PROTO_HDRS}) + target_link_libraries(onnx2ncnn ${PROTOBUF_LIBRARIES}) +else() + message(WARNING "Protobuf not found, onnx model convert tool won't be built") +endif()