mirror of
https://github.com/open-mmlab/mmdeploy.git
synced 2025-01-14 08:09:43 +08:00
[Fix] Export mmdeploy
only in monolithic build (#1798)
* export only `mmdeploy` in monolithic build * export dynamic backends
This commit is contained in:
parent
c96967ffc1
commit
739e6b7ecf
@ -99,10 +99,12 @@ include(cmake/MMDeploy.cmake)
|
|||||||
add_subdirectory(csrc/mmdeploy)
|
add_subdirectory(csrc/mmdeploy)
|
||||||
|
|
||||||
if (MMDEPLOY_BUILD_SDK)
|
if (MMDEPLOY_BUILD_SDK)
|
||||||
install(TARGETS MMDeployStaticModules
|
if (NOT MMDEPLOY_BUILD_SDK_MONOLITHIC)
|
||||||
MMDeployDynamicModules
|
install(TARGETS MMDeployStaticModules
|
||||||
MMDeployLibs
|
MMDeployDynamicModules
|
||||||
EXPORT MMDeployTargets)
|
MMDeployLibs
|
||||||
|
EXPORT MMDeployTargets)
|
||||||
|
endif ()
|
||||||
|
|
||||||
if (MMDEPLOY_BUILD_TEST)
|
if (MMDEPLOY_BUILD_TEST)
|
||||||
add_subdirectory(tests/test_csrc)
|
add_subdirectory(tests/test_csrc)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
|
|
||||||
function (mmdeploy_export NAME)
|
function (mmdeploy_export_impl NAME)
|
||||||
set(_LIB_DIR lib)
|
set(_LIB_DIR lib)
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
set(_LIB_DIR bin)
|
set(_LIB_DIR bin)
|
||||||
@ -15,6 +15,8 @@ endfunction ()
|
|||||||
macro(mmdeploy_add_net NAME)
|
macro(mmdeploy_add_net NAME)
|
||||||
if (MMDEPLOY_DYNAMIC_BACKEND)
|
if (MMDEPLOY_DYNAMIC_BACKEND)
|
||||||
mmdeploy_add_library(${NAME} SHARED ${ARGN})
|
mmdeploy_add_library(${NAME} SHARED ${ARGN})
|
||||||
|
# DYNAMIC_BACKEND implies BUILD_SDK_MONOLITHIC
|
||||||
|
mmdeploy_export_impl(${NAME})
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE mmdeploy)
|
target_link_libraries(${PROJECT_NAME} PRIVATE mmdeploy)
|
||||||
set(BACKEND_LIB_NAMES ${BACKEND_LIB_NAMES} ${PROJECT_NAME} PARENT_SCOPE)
|
set(BACKEND_LIB_NAMES ${BACKEND_LIB_NAMES} ${PROJECT_NAME} PARENT_SCOPE)
|
||||||
else ()
|
else ()
|
||||||
@ -22,6 +24,13 @@ macro(mmdeploy_add_net NAME)
|
|||||||
endif ()
|
endif ()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
function (mmdeploy_export NAME)
|
||||||
|
if (NOT MMDEPLOY_BUILD_SDK_MONOLITHIC)
|
||||||
|
mmdeploy_export_impl(${NAME})
|
||||||
|
endif ()
|
||||||
|
endfunction ()
|
||||||
|
|
||||||
|
|
||||||
function (mmdeploy_add_library NAME)
|
function (mmdeploy_add_library NAME)
|
||||||
# EXCLUDE: exclude from registering & exporting
|
# EXCLUDE: exclude from registering & exporting
|
||||||
cmake_parse_arguments(_MMDEPLOY "EXCLUDE" "" "" ${ARGN})
|
cmake_parse_arguments(_MMDEPLOY "EXCLUDE" "" "" ${ARGN})
|
||||||
|
@ -89,5 +89,5 @@ if (MMDEPLOY_BUILD_SDK_CSHARP_API OR MMDEPLOY_BUILD_SDK_MONOLITHIC)
|
|||||||
INSTALL_RPATH "\$ORIGIN"
|
INSTALL_RPATH "\$ORIGIN"
|
||||||
BUILD_RPATH "\$ORIGIN")
|
BUILD_RPATH "\$ORIGIN")
|
||||||
endif ()
|
endif ()
|
||||||
mmdeploy_export(mmdeploy)
|
mmdeploy_export_impl(mmdeploy)
|
||||||
endif ()
|
endif ()
|
||||||
|
@ -34,7 +34,7 @@ if (TARGET mmdeploy)
|
|||||||
else ()
|
else ()
|
||||||
target_link_libraries(${PROJECT_NAME} INTERFACE mmdeploy::core)
|
target_link_libraries(${PROJECT_NAME} INTERFACE mmdeploy::core)
|
||||||
endif ()
|
endif ()
|
||||||
mmdeploy_export(${PROJECT_NAME})
|
mmdeploy_export_impl(${PROJECT_NAME})
|
||||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/mmdeploy/common.hpp
|
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/mmdeploy/common.hpp
|
||||||
DESTINATION include/mmdeploy)
|
DESTINATION include/mmdeploy)
|
||||||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/demo/csrc/ DESTINATION example/cpp
|
install(DIRECTORY ${CMAKE_SOURCE_DIR}/demo/csrc/ DESTINATION example/cpp
|
||||||
|
@ -7,8 +7,8 @@ if (NOT (${CMAKE_PROJECT_NAME} STREQUAL "MMDeploy"))
|
|||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
|
||||||
function(add_example dep folder name)
|
function(add_example task folder name)
|
||||||
if (NOT dep OR TARGET mmdeploy_${dep})
|
if ((NOT task) OR (task IN_LIST MMDEPLOY_TASKS))
|
||||||
# Search for c/cpp sources
|
# Search for c/cpp sources
|
||||||
file(GLOB _SRCS ${folder}/${name}.c*)
|
file(GLOB _SRCS ${folder}/${name}.c*)
|
||||||
add_executable(${name} ${_SRCS})
|
add_executable(${name} ${_SRCS})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user