2021-12-07 10:57:55 +08:00
|
|
|
# Copyright (c) OpenMMLab. All rights reserved.
|
|
|
|
cmake_minimum_required(VERSION 3.14)
|
|
|
|
project(mmdeploy-example)
|
|
|
|
|
2022-07-27 20:33:31 +08:00
|
|
|
if (NOT (${CMAKE_PROJECT_NAME} STREQUAL "MMDeploy"))
|
2022-07-29 14:36:25 +08:00
|
|
|
find_package(MMDeploy REQUIRED)
|
2022-07-27 20:33:31 +08:00
|
|
|
endif ()
|
2021-12-07 10:57:55 +08:00
|
|
|
|
2022-09-26 16:11:14 +08:00
|
|
|
function(add_example dep name)
|
|
|
|
if (NOT dep OR TARGET mmdeploy_${dep})
|
2022-07-29 14:36:25 +08:00
|
|
|
# Search for c/cpp sources
|
|
|
|
file(GLOB _SRCS ${name}.c*)
|
|
|
|
add_executable(${name} ${_SRCS})
|
|
|
|
if (NOT (MSVC OR APPLE))
|
|
|
|
# Disable new dtags so that executables can run even without LD_LIBRARY_PATH set
|
|
|
|
target_link_libraries(${name} PRIVATE -Wl,--disable-new-dtags)
|
|
|
|
endif ()
|
|
|
|
if (MMDEPLOY_BUILD_SDK_MONOLITHIC)
|
|
|
|
target_link_libraries(${name} PRIVATE mmdeploy ${OpenCV_LIBS})
|
|
|
|
else ()
|
|
|
|
# Load MMDeploy modules
|
|
|
|
mmdeploy_load_static(${name} MMDeployStaticModules)
|
|
|
|
mmdeploy_load_dynamic(${name} MMDeployDynamicModules)
|
|
|
|
# Link to MMDeploy libraries
|
|
|
|
target_link_libraries(${name} PRIVATE MMDeployLibs ${OpenCV_LIBS})
|
|
|
|
endif ()
|
|
|
|
install(TARGETS ${name} RUNTIME DESTINATION bin)
|
2022-06-17 13:56:45 +08:00
|
|
|
endif ()
|
2021-12-07 10:57:55 +08:00
|
|
|
endfunction()
|
|
|
|
|
2022-07-29 14:36:25 +08:00
|
|
|
add_example(classifier image_classification)
|
|
|
|
add_example(detector object_detection)
|
|
|
|
add_example(segmentor image_segmentation)
|
|
|
|
add_example(restorer image_restorer)
|
|
|
|
add_example(text_detector ocr)
|
|
|
|
add_example(pose_detector pose_detection)
|
2022-06-17 13:56:45 +08:00
|
|
|
add_example(rotated_detector rotated_object_detection)
|
2022-07-29 14:36:25 +08:00
|
|
|
|
2022-09-26 16:11:14 +08:00
|
|
|
#add_example("" async_ocr)
|
|
|
|
#add_example("" async_ocr_v2)
|
|
|
|
#add_example("" det_cls)
|
|
|
|
#add_example("" det_pose)
|
|
|
|
|
2022-07-29 14:36:25 +08:00
|
|
|
if (MMDEPLOY_BUILD_SDK_CXX_API)
|
|
|
|
add_example(classifier classifier)
|
|
|
|
add_example(detector detector)
|
|
|
|
add_example(segmentor segmentor)
|
|
|
|
add_example(restorer restorer)
|
|
|
|
add_example(text_detector text_ocr)
|
2022-09-26 16:11:14 +08:00
|
|
|
add_example(text_detector text_det_recog)
|
2022-07-29 14:36:25 +08:00
|
|
|
add_example(pose_detector pose_detector)
|
|
|
|
add_example(rotated_detector rotated_detector)
|
|
|
|
endif ()
|