Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] remove MMDEPLOY_BUILD_SDK_CXX_API option #1688

Merged
merged 3 commits into from
Jan 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/scripts/linux/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cd mmdeploy
MMDEPLOY_DIR=$(pwd)
mkdir -p build && cd build
cmake .. -DMMDEPLOY_BUILD_SDK=ON -DMMDEPLOY_BUILD_TEST=ON -DMMDEPLOY_BUILD_SDK_PYTHON_API=ON \
-DMMDEPLOY_BUILD_EXAMPLES=ON -DMMDEPLOY_BUILD_SDK_CXX_API=ON -DMMDEPLOY_BUILD_SDK_CSHARP_API=ON \
-DMMDEPLOY_BUILD_EXAMPLES=ON -DMMDEPLOY_BUILD_SDK_CSHARP_API=ON \
-DMMDEPLOY_TARGET_DEVICES="$1" -DMMDEPLOY_TARGET_BACKENDS="$2" "${ARGS[@]:2}"

make -j$(nproc) && make install
1 change: 0 additions & 1 deletion .circleci/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ jobs:
-DMMDEPLOY_BUILD_TEST=ON `
-DMMDEPLOY_BUILD_SDK_PYTHON_API=ON `
-DMMDEPLOY_BUILD_EXAMPLES=ON `
-DMMDEPLOY_BUILD_SDK_CXX_API=ON `
-DMMDEPLOY_BUILD_SDK_CSHARP_API=ON `
-DMMDEPLOY_TARGET_BACKENDS="ort" `
-DOpenCV_DIR="$env:OPENCV_PACKAGE_DIR"
Expand Down
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ option(MMDEPLOY_BUILD_SDK "build MMDeploy SDK" OFF)
option(MMDEPLOY_BUILD_SDK_MONOLITHIC "build single lib for SDK API" ON)
option(MMDEPLOY_BUILD_TEST "build unittests" OFF)
option(MMDEPLOY_BUILD_SDK_PYTHON_API "build SDK Python API" OFF)
option(MMDEPLOY_BUILD_SDK_CXX_API "build SDK C++ API" OFF)
option(MMDEPLOY_BUILD_SDK_CSHARP_API "build SDK C# API support" OFF)
option(MMDEPLOY_BUILD_SDK_JAVA_API "build SDK JAVA API" OFF)
option(MMDEPLOY_BUILD_EXAMPLES "build examples" OFF)
Expand Down
1 change: 0 additions & 1 deletion cmake/MMDeployConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ set(MMDEPLOY_TARGET_DEVICES @MMDEPLOY_TARGET_DEVICES@)
set(MMDEPLOY_TARGET_BACKENDS @MMDEPLOY_TARGET_BACKENDS@)
set(MMDEPLOY_BUILD_TYPE @CMAKE_BUILD_TYPE@)
set(MMDEPLOY_BUILD_SHARED @MMDEPLOY_SHARED_LIBS@)
set(MMDEPLOY_BUILD_SDK_CXX_API @MMDEPLOY_BUILD_SDK_CXX_API@)
set(MMDEPLOY_BUILD_SDK_MONOLITHIC @MMDEPLOY_BUILD_SDK_MONOLITHIC@)
set(MMDEPLOY_VERSION_MAJOR @MMDEPLOY_VERSION_MAJOR@)
set(MMDEPLOY_VERSION_MINOR @MMDEPLOY_VERSION_MINOR@)
Expand Down
5 changes: 0 additions & 5 deletions csrc/mmdeploy/apis/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
# Copyright (c) OpenMMLab. All rights reserved.

# Python API depends on C++ API
if (MMDEPLOY_BUILD_SDK_PYTHON_API)
set(MMDEPLOY_BUILD_SDK_CXX_API ON)
endif ()

add_subdirectory(c)
add_subdirectory(cxx)
add_subdirectory(java)
Expand Down
42 changes: 20 additions & 22 deletions csrc/mmdeploy/apis/cxx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,25 @@
cmake_minimum_required(VERSION 3.14)
project(mmdeploy_cxx_api)

if (MMDEPLOY_BUILD_SDK_CXX_API)
add_library(${PROJECT_NAME} INTERFACE)
target_include_directories(${PROJECT_NAME} INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>)
target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_17)
target_link_libraries(${PROJECT_NAME} INTERFACE mmdeploy::core)
set(_tasks ${MMDEPLOY_TASKS} pipeline)
foreach (task ${_tasks})
target_link_libraries(mmdeploy_${task} INTERFACE ${PROJECT_NAME})
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/mmdeploy/${task}.hpp
DESTINATION include/mmdeploy)
endforeach ()
if (TARGET mmdeploy)
target_link_libraries(mmdeploy INTERFACE ${PROJECT_NAME})
endif ()
mmdeploy_export(${PROJECT_NAME})
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/mmdeploy/common.hpp
add_library(${PROJECT_NAME} INTERFACE)
target_include_directories(${PROJECT_NAME} INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>)
target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_17)
target_link_libraries(${PROJECT_NAME} INTERFACE mmdeploy::core)
set(_tasks ${MMDEPLOY_TASKS} pipeline)
foreach (task ${_tasks})
target_link_libraries(mmdeploy_${task} INTERFACE ${PROJECT_NAME})
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/mmdeploy/${task}.hpp
DESTINATION include/mmdeploy)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/demo/csrc/ DESTINATION example/cpp
FILES_MATCHING
PATTERN "*.cxx"
)
endforeach ()
if (TARGET mmdeploy)
target_link_libraries(mmdeploy INTERFACE ${PROJECT_NAME})
endif ()
mmdeploy_export(${PROJECT_NAME})
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/mmdeploy/common.hpp
DESTINATION include/mmdeploy)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/demo/csrc/ DESTINATION example/cpp
FILES_MATCHING
PATTERN "*.cxx"
)
12 changes: 5 additions & 7 deletions csrc/mmdeploy/archive/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ add_library(${PROJECT_NAME} INTERFACE)
target_link_libraries(${PROJECT_NAME} INTERFACE mmdeploy::core)
add_library(mmdeploy::archive ALIAS mmdeploy_archive)

if (MMDEPLOY_BUILD_SDK_CXX_API)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/csrc/mmdeploy/archive
DESTINATION include/mmdeploy
FILES_MATCHING PATTERN "*.h")
install(FILES ${CMAKE_SOURCE_DIR}/third_party/json/json.hpp
DESTINATION include/mmdeploy/third_party/json)
endif ()
install(DIRECTORY ${CMAKE_SOURCE_DIR}/csrc/mmdeploy/archive
DESTINATION include/mmdeploy
FILES_MATCHING PATTERN "*.h")
install(FILES ${CMAKE_SOURCE_DIR}/third_party/json/json.hpp
DESTINATION include/mmdeploy/third_party/json)
41 changes: 18 additions & 23 deletions csrc/mmdeploy/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ else ()
endif ()
set(SPDLOG_LIB spdlog::spdlog)
mmdeploy_export(spdlog)
if (MMDEPLOY_BUILD_SDK_CXX_API)
install(DIRECTORY ${MMDEPLOY_SPDLOG_DIR}/include/spdlog
DESTINATION include/mmdeploy/third_party)
endif ()

install(DIRECTORY ${MMDEPLOY_SPDLOG_DIR}/include/spdlog
DESTINATION include/mmdeploy/third_party)
endif ()

set(SRCS
Expand Down Expand Up @@ -65,15 +64,13 @@ else ()
target_compile_definitions(${PROJECT_NAME} PUBLIC -DMMDEPLOY_STATUS_USE_SOURCE_LOCATION=1)
endif ()

if (MMDEPLOY_BUILD_SDK_CXX_API)
target_include_directories(${PROJECT_NAME} PUBLIC
$<INSTALL_INTERFACE:include>
$<INSTALL_INTERFACE:include/mmdeploy/third_party/outcome>
$<INSTALL_INTERFACE:include/mmdeploy/third_party/json>)
if (NOT MMDEPLOY_SPDLOG_EXTERNAL)
target_include_directories(spdlog INTERFACE
$<INSTALL_INTERFACE:include/mmdeploy/third_party>)
endif ()
target_include_directories(${PROJECT_NAME} PUBLIC
$<INSTALL_INTERFACE:include>
$<INSTALL_INTERFACE:include/mmdeploy/third_party/outcome>
$<INSTALL_INTERFACE:include/mmdeploy/third_party/json>)
if (NOT MMDEPLOY_SPDLOG_EXTERNAL)
target_include_directories(spdlog INTERFACE
$<INSTALL_INTERFACE:include/mmdeploy/third_party>)
endif ()

target_link_libraries(${PROJECT_NAME} PUBLIC ${SPDLOG_LIB})
Expand All @@ -85,14 +82,12 @@ endif ()

add_library(mmdeploy::core ALIAS ${PROJECT_NAME})

if (MMDEPLOY_BUILD_SDK_CXX_API)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/csrc/mmdeploy/core
DESTINATION include/mmdeploy
FILES_MATCHING PATTERN "*.h")
install(FILES ${CMAKE_SOURCE_DIR}/third_party/outcome/outcome-experimental.hpp
DESTINATION include/mmdeploy/third_party/outcome)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/csrc/mmdeploy/core
DESTINATION include/mmdeploy
FILES_MATCHING PATTERN "*.h")
install(FILES ${CMAKE_SOURCE_DIR}/third_party/outcome/outcome-experimental.hpp
DESTINATION include/mmdeploy/third_party/outcome)

install(DIRECTORY ${CMAKE_SOURCE_DIR}/csrc/mmdeploy/experimental
DESTINATION include/mmdeploy
FILES_MATCHING PATTERN "*.h")
endif ()
install(DIRECTORY ${CMAKE_SOURCE_DIR}/csrc/mmdeploy/experimental
DESTINATION include/mmdeploy
FILES_MATCHING PATTERN "*.h")
24 changes: 11 additions & 13 deletions demo/csrc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,14 @@ add_example(video_recognizer c video_recognition)
# TODO: figure out a better way
# add_example("" c det_cls)

if (MMDEPLOY_BUILD_SDK_CXX_API)
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)
add_example(text_detector cpp text_det_recog)
add_example(pose_detector cpp pose_detector)
add_example(rotated_detector cpp rotated_detector)
add_example(pose_tracker cpp pose_tracker)
add_example(pose_detector cpp det_pose)
add_example(video_recognizer cpp video_cls)
endif ()
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)
add_example(text_detector cpp text_det_recog)
add_example(pose_detector cpp pose_detector)
add_example(rotated_detector cpp rotated_detector)
add_example(pose_tracker cpp pose_tracker)
add_example(pose_detector cpp det_pose)
add_example(video_recognizer cpp video_cls)
10 changes: 2 additions & 8 deletions docs/en/01-how-to-build/cmake_option.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@
<td>OFF</td>
<td>Switch to build MMDeploy SDK python package</td>
</tr>
<tr>
<td>MMDEPLOY_BUILD_SDK_CXX_API</td>
<td>{ON, OFF}</td>
<td>OFF</td>
<td>Build C++ SDK API</td>
</tr>

<tr>
<td>MMDEPLOY_BUILD_SDK_CSHARP_API</td>
Expand Down Expand Up @@ -119,9 +113,9 @@
<pre><code>-DInferenceEngine_DIR=${INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/share</code></pre>
6. <b>torchscript</b>: TorchScript. <code>Torch_DIR</code> is needed.
<pre><code>-DTorch_DIR=${Torch_DIR}</code></pre>
Currently, <b>The Model Converter supports torchscript, but SDK doesn't</b>.<br>
7. <b>snpe</b>: qcom snpe. <code>SNPE_ROOT</code> must existed in the environment variable because of C/S mode.<br>
8. <b>coreml</b>: CoreML. <code>Torch_DIR</code> is required. <code>Torch_DIR</code>。 <br>
8. <b>coreml</b>: CoreML. <code>Torch_DIR</code> is required.
<pre><code>-DTorch_DIR=${Torch_DIR}</code></pre>
9. <b>TVM</b>: TVM. <code>TVM_DIR</code> is required. <pre><code>-DTVM_DIR=${TVM_DIR}</code></pre>
</td>
</tr>
Expand Down
9 changes: 1 addition & 8 deletions docs/zh_cn/01-how-to-build/cmake_option.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,6 @@
<td>SDK python package的编译开关</td>
</tr>

<tr>
<td>MMDEPLOY_BUILD_SDK_CXX_API</td>
<td>{ON, OFF}</td>
<td>OFF</td>
<td>SDK C++ package的编译开关</td>
</tr>

<tr>
<td>MMDEPLOY_BUILD_SDK_CSHARP_API</td>
<td>{ON, OFF}</td>
Expand Down Expand Up @@ -118,7 +111,7 @@
3. <b>pplnn</b>: 表示 PPL.NN。需要设置 <code>pplnn_DIR</code>。<br>
4. <b>ncnn</b>:表示 ncnn。需要设置 <code>ncnn_DIR</code>。 <br>
5. <b>openvino</b>: 表示 OpenVINO。需要设置 <code>InferenceEngine_DIR</code>。<br>
6. <b>torchscript</b>: 表示 TorchScript。目前仅模型转换支持 torchscript 格式,SDK 尚未支持。<br>
6. <b>torchscript</b>: 表示 TorchScript。需要设置<code>Torch_DIR</code>。<br>
7. <b>snpe</b>: 表示 qcom snpe。需要环境变量设置 SNPE_ROOT。<br>
8. <b>coreml</b>: 表示 Core ML。目前在进行模型转换时需要设置 <code>Torch_DIR</code>。 <br>
9. <b>tvm</b>: 表示 TVM。需要设置 <code>TVM_DIR</code>。<br>
Expand Down
2 changes: 0 additions & 2 deletions docs/zh_cn/01-how-to-build/rockchip.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ mkdir -p build && cd build
cmake .. \
-DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/arm-linux-gnueabihf.cmake \
-DMMDEPLOY_BUILD_SDK=ON \
-DMMDEPLOY_BUILD_SDK_CXX_API=ON \
-DMMDEPLOY_BUILD_EXAMPLES=ON \
-DMMDEPLOY_TARGET_BACKENDS="rknn" \
-DRKNPU_DEVICE_DIR=${RKNPU_DIR}/rknn/rknn_api/librknn_api \
Expand Down Expand Up @@ -281,7 +280,6 @@ export LD_LIBRARY_PATH=$RKNN_TOOL_CHAIN/lib64:$LD_LIBRARY_PATH
cmake \
-DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/rknpu2-linux-gnu.cmake \
-DMMDEPLOY_BUILD_SDK=ON \
-DMMDEPLOY_BUILD_SDK_CXX_API=ON \
-DMMDEPLOY_TARGET_BACKENDS="rknn" \
-DMMDEPLOY_BUILD_EXAMPLES=ON \
-DOpenCV_DIR=${OpenCV_AARCH64_INSTALL_DIR}/lib/cmake/opencv4
Expand Down
1 change: 0 additions & 1 deletion tools/package_tools/configs/linux_x64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ global_config:
CMAKE_CXX_COMPILER: "g++-7"
MMDEPLOY_BUILD_SDK: "ON"
MMDEPLOY_BUILD_SDK_MONOLITHIC: "ON"
MMDEPLOY_BUILD_SDK_CXX_API: "ON"
MMDEPLOY_BUILD_EXAMPLES: "ON"
MMDEPLOY_SHARED_LIBS: "OFF"
OpenCV_DIR: "${OpenCV_DIR}"
Expand Down
1 change: 0 additions & 1 deletion tools/package_tools/configs/windows_x64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ global_config:
cmake_envs:
MMDEPLOY_BUILD_SDK: "ON"
MMDEPLOY_BUILD_SDK_MONOLITHIC: "ON"
MMDEPLOY_BUILD_SDK_CXX_API: "ON"
MMDEPLOY_BUILD_EXAMPLES: "ON"
MMDEPLOY_SHARED_LIBS: "OFF"
MMDEPLOY_CODEBASES: "all"
Expand Down
2 changes: 0 additions & 2 deletions tools/scripts/ubuntu_cross_build_rknn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ build_mmdeploy_with_rknpu() {
cmake .. \
-DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/arm-linux-gnueabihf.cmake \
-DMMDEPLOY_BUILD_SDK=ON \
-DMMDEPLOY_BUILD_SDK_CXX_API=ON \
-DMMDEPLOY_BUILD_EXAMPLES=ON \
-DMMDEPLOY_TARGET_BACKENDS="rknn" \
-DRKNPU_DEVICE_DIR="${RKNPU_DIR}"/rknn/rknn_api/librknn_api \
Expand All @@ -125,7 +124,6 @@ build_mmdeploy_with_rknpu2() {
cmake .. \
-DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/rknpu2-linux-gnu.cmake \
-DMMDEPLOY_BUILD_SDK=ON \
-DMMDEPLOY_BUILD_SDK_CXX_API=ON \
-DMMDEPLOY_BUILD_EXAMPLES=ON \
-DMMDEPLOY_TARGET_BACKENDS="rknn" \
-DRKNPU2_DEVICE_DIR="${RKNPU2_DIR}/runtime/${device_model}" \
Expand Down