File tree Expand file tree Collapse file tree 5 files changed +17
-19
lines changed
Expand file tree Collapse file tree 5 files changed +17
-19
lines changed Original file line number Diff line number Diff line change @@ -7,9 +7,9 @@ include(${CMAKE_SOURCE_DIR}/cmake/MMDeploy.cmake)
77# add plugin source
88file (GLOB_RECURSE NCNN_OPS_SRCS *.cpp)
99add_library (${PROJECT_NAME} _obj OBJECT "${NCNN_OPS_SRCS} " )
10+ target_compile_definitions (${PROJECT_NAME} _obj PRIVATE -DMMDEPLOY_API_EXPORTS=1)
1011set_target_properties (${PROJECT_NAME} _obj PROPERTIES POSITION_INDEPENDENT_CODE 1)
11- target_include_directories (${PROJECT_NAME} _obj PUBLIC
12- $<TARGET_PROPERTY:ncnn,INTERFACE_INCLUDE_DIRECTORIES >)
12+ target_link_libraries (${PROJECT_NAME} _obj PRIVATE ncnn)
1313set (_COMMON_INCLUDE_DIRS
1414 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} >
1515 $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR} /csrc>)
Original file line number Diff line number Diff line change 88#include " core/macro.h"
99#include " net.h"
1010
11- extern " C" {
1211MMDEPLOY_API std::map<const char *, ncnn::layer_creator_func>& get_mmdeploy_layer_creator ();
1312MMDEPLOY_API std::map<const char *, ncnn::layer_destroyer_func>& get_mmdeploy_layer_destroyer ();
1413
1514MMDEPLOY_API int register_mmdeploy_custom_layers (ncnn::Net& net);
16- }
1715
1816#endif
Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ endif ()
1010pybind11_add_module(ncnn_ext ncnn_ext.cpp)
1111
1212target_link_libraries (ncnn_ext PUBLIC mmdeploy_ncnn_ops ncnn)
13- set_target_properties (
14- ncnn_ext PROPERTIES LIBRARY_OUTPUT_DIRECTORY
15- ${CMAKE_SOURCE_DIR} /mmdeploy/backend/ncnn)
13+ set (_NCNN_EXT_DIR ${CMAKE_SOURCE_DIR} /mmdeploy/backend/ncnn)
14+ set_target_properties (ncnn_ext PROPERTIES
15+ LIBRARY_OUTPUT_DIRECTORY ${_NCNN_EXT_DIR}
16+ LIBRARY_OUTPUT_DIRECTORY_DEBUG ${_NCNN_EXT_DIR}
17+ LIBRARY_OUTPUT_DIRECTORY_RELEASE ${_NCNN_EXT_DIR} )
Original file line number Diff line number Diff line change @@ -41,22 +41,20 @@ Result<void> NCNNNet::Init(const Value& args) {
4141
4242 input_indices_ = net_.input_indexes ();
4343 for (const auto & x : net_.input_names ()) {
44- // input_names_.emplace_back(x);
4544 input_tensors_.emplace_back (TensorDesc{
46- . device = Device (" cpu" ),
47- . data_type = DataType::kFLOAT ,
48- . shape = {},
49- . name = x,
45+ Device (" cpu" ),
46+ DataType::kFLOAT ,
47+ {},
48+ x,
5049 });
5150 }
5251 output_indices_ = net_.output_indexes ();
5352 for (const auto & x : net_.output_names ()) {
54- // output_names_.emplace_back(x);
5553 output_tensors_.emplace_back (TensorDesc{
56- . device = Device (" cpu" ),
57- . data_type = DataType::kFLOAT ,
58- . shape = {},
59- . name = x,
54+ Device (" cpu" ),
55+ DataType::kFLOAT ,
56+ {},
57+ x,
6058 });
6159 }
6260
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ def get_ops_path() -> str:
1212 """
1313 candidates = [
1414 '../../../build/lib/libmmdeploy_ncnn_ops.so' ,
15- '../../../build/bin/*/mmdeploy_ncnn_ops.pyd '
15+ '../../../build/bin/*/mmdeploy_ncnn_ops.dll '
1616 ]
1717 return get_file_path (os .path .dirname (__file__ ), candidates )
1818
@@ -24,6 +24,6 @@ def get_onnx2ncnn_path() -> str:
2424 str: A path of onnx2ncnn tool.
2525 """
2626 candidates = [
27- '../../../build/bin/onnx2ncnn' , '../../../build/bin/*/onnx2ncnn'
27+ '../../../build/bin/onnx2ncnn' , '../../../build/bin/*/onnx2ncnn.exe '
2828 ]
2929 return get_file_path (os .path .dirname (__file__ ), candidates )
You can’t perform that action at this time.
0 commit comments