lzhangzz 567ec62296
[Fix] Fix recent build problems (#544)
* simplify deps management

* skip visibility flags for MSVC

* simplify cuda deps

* naming

* workaround for cmake<3.17

* add spdlog dependency

* move the enablement of CUDA to top level CMakeLists.txt

* fix MSVC build

* fix lint

* fix build for backend ops only

* remove comment

* allow to use apis/python as a standalone project

* remove redundant cmake code

* control shared or static lib using `MMDEPLOY_SHARED_LIBS` instead of `BUILD_SHARED_LIBS`

* fix MSVC build

* update docs
2022-06-06 11:19:34 +08:00

21 lines
774 B
CMake
Executable File

# Copyright (c) OpenMMLab. All rights reserved.
project(onnx2ncnn)
find_package(Protobuf)
if (PROTOBUF_FOUND)
protobuf_generate_cpp(ONNX_PROTO_SRCS ONNX_PROTO_HDRS
${CMAKE_CURRENT_SOURCE_DIR}/onnx.proto)
add_executable(onnx2ncnn onnx2ncnn.cpp fuse_pass.cpp shape_inference.cpp ${ONNX_PROTO_SRCS} ${ONNX_PROTO_HDRS})
target_include_directories(onnx2ncnn PRIVATE ${PROTOBUF_INCLUDE_DIR}
${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(onnx2ncnn PRIVATE ${PROTOBUF_LIBRARIES})
set(_NCNN_CONVERTER_DIR ${CMAKE_SOURCE_DIR}/mmdeploy/backend/ncnn)
install(TARGETS onnx2ncnn DESTINATION ${_NCNN_CONVERTER_DIR})
else ()
message(
FATAL_ERROR "Protobuf not found, onnx model convert tool won't be built")
endif ()