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-27 13:40:04 +08:00
|
|
|
|
|
|
|
function(add_example dep folder name)
|
2022-09-26 16:11:14 +08:00
|
|
|
if (NOT dep OR TARGET mmdeploy_${dep})
|
2022-07-29 14:36:25 +08:00
|
|
|
# Search for c/cpp sources
|
2022-09-27 13:40:04 +08:00
|
|
|
file(GLOB _SRCS ${folder}/${name}.c*)
|
2022-07-29 14:36:25 +08:00
|
|
|
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-09-27 13:40:04 +08:00
|
|
|
add_example(classifier c image_classification)
|
2022-10-19 19:42:22 +08:00
|
|
|
add_example(classifier c batch_image_classification)
|
2022-09-27 13:40:04 +08:00
|
|
|
add_example(detector c object_detection)
|
2022-10-19 19:42:22 +08:00
|
|
|
add_example(detector c batch_object_detection)
|
2022-09-27 13:40:04 +08:00
|
|
|
add_example(segmentor c image_segmentation)
|
|
|
|
add_example(restorer c image_restorer)
|
|
|
|
add_example(text_detector c ocr)
|
|
|
|
add_example(pose_detector c pose_detection)
|
|
|
|
add_example(rotated_detector c rotated_object_detection)
|
2022-11-04 14:15:36 +08:00
|
|
|
add_example(video_recognizer c video_recognition)
|
2022-09-28 11:47:00 +08:00
|
|
|
# TODO: figure out a better way
|
|
|
|
#add_example("" c det_cls)
|
|
|
|
#add_example("" c det_pose)
|
2022-09-26 16:11:14 +08:00
|
|
|
|
2022-07-29 14:36:25 +08:00
|
|
|
if (MMDEPLOY_BUILD_SDK_CXX_API)
|
2022-09-27 13:40:04 +08:00
|
|
|
add_example(classifier cpp classifier)
|
|
|
|
add_example(detector cpp detector)
|
|
|
|
add_example(segmentor cpp segmentor)
|
|
|
|
add_example(restorer cpp restorer)
|
|
|
|
add_example(text_detector cpp text_ocr)
|
2022-10-27 14:52:04 +08:00
|
|
|
add_example(text_detector cpp text_det_recog)
|
2022-09-27 13:40:04 +08:00
|
|
|
add_example(pose_detector cpp pose_detector)
|
|
|
|
add_example(rotated_detector cpp rotated_detector)
|
2022-10-27 14:52:04 +08:00
|
|
|
add_example(pose_detector cpp pose_tracker)
|
2022-11-04 14:15:36 +08:00
|
|
|
add_example(video_recognizer cpp video_cls)
|
2022-07-29 14:36:25 +08:00
|
|
|
endif ()
|