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] Adjust csrc structure #594

Merged
merged 6 commits into from
Jun 14, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ endif ()
# at function definition
include(cmake/MMDeploy.cmake)

add_subdirectory(csrc)
add_subdirectory(csrc/mmdeploy)

if (MMDEPLOY_BUILD_SDK)
install(TARGETS MMDeployStaticModules
Expand All @@ -87,7 +87,7 @@ if (MMDEPLOY_BUILD_SDK)
endif ()

if (MMDEPLOY_BUILD_SDK_PYTHON_API)
add_subdirectory(csrc/apis/python)
add_subdirectory(csrc/mmdeploy/apis/python)
endif ()

# export MMDeploy package
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,9 @@ foreach (TASK ${COMMON_LIST})
mmdeploy_add_library(${TARGET_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/${TASK}.cpp)
target_link_libraries(${TARGET_NAME} PRIVATE mmdeploy::core)
target_include_directories(${TARGET_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include/c>)
$<INSTALL_INTERFACE:include/mmdeploy/apis/c>)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${TASK}.h
DESTINATION include/c)
DESTINATION include/mmdeploy/apis/c)
endforeach ()

target_link_libraries(mmdeploy_executor PUBLIC
Expand All @@ -68,14 +67,13 @@ foreach (TASK ${TASK_LIST})
target_link_libraries(${TARGET_NAME} PRIVATE
mmdeploy_pipeline mmdeploy::core)
target_include_directories(${TARGET_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include/c>)
$<INSTALL_INTERFACE:include/mmdeploy/apis/c>)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${TASK}.h
DESTINATION include/c)
DESTINATION include/mmdeploy/apis/c)
endforeach ()

install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/common.h
DESTINATION include/c)
#install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/common.h
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May remove the useless code

# DESTINATION include/c)

if (MMDEPLOY_BUILD_SDK_CSHARP_API)
# build MMDeployExtern.dll just for csharp nuget package.
Expand All @@ -86,4 +84,4 @@ if (MMDEPLOY_BUILD_SDK_CSHARP_API)
mmdeploy_load_static(MMDeployExtern MMDeployStaticModules)
mmdeploy_load_dynamic(MMDeployExtern MMDeployDynamicModules)
target_link_libraries(MMDeployExtern PRIVATE MMDeployLibs)
endif()
endif ()
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

#include <numeric>

#include "apis/c/common_internal.h"
#include "apis/c/handle.h"
#include "apis/c/pipeline.h"
#include "archive/value_archive.h"
#include "codebase/mmcls/mmcls.h"
#include "core/device.h"
#include "core/graph.h"
#include "core/utils/formatter.h"
#include "mmdeploy/apis/c/common_internal.h"
#include "mmdeploy/apis/c/handle.h"
#include "mmdeploy/apis/c/pipeline.h"
#include "mmdeploy/archive/value_archive.h"
#include "mmdeploy/codebase/mmcls/mmcls.h"
#include "mmdeploy/core/device.h"
#include "mmdeploy/core/graph.h"
#include "mmdeploy/core/utils/formatter.h"

using namespace mmdeploy;
using namespace std;
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions csrc/apis/c/common.cpp → csrc/mmdeploy/apis/c/common.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "common.h"

#include "apis/c/common_internal.h"
#include "apis/c/handle.h"
#include "core/mat.h"
#include "mmdeploy/apis/c/common_internal.h"
#include "mmdeploy/apis/c/handle.h"
#include "mmdeploy/core/mat.h"

mmdeploy_value_t mmdeploy_value_copy(mmdeploy_value_t input) {
if (!input) {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
#ifndef MMDEPLOY_CSRC_APIS_C_COMMON_INTERNAL_H_
#define MMDEPLOY_CSRC_APIS_C_COMMON_INTERNAL_H_

#include "apis/c/common.h"
#include "apis/c/model.h"
#include "core/value.h"
#include "mmdeploy/apis/c/common.h"
#include "mmdeploy/apis/c/model.h"
#include "mmdeploy/core/value.h"

using namespace mmdeploy;

Expand Down
20 changes: 10 additions & 10 deletions csrc/apis/c/detector.cpp → csrc/mmdeploy/apis/c/detector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@

#include <numeric>

#include "apis/c/common_internal.h"
#include "apis/c/executor_internal.h"
#include "apis/c/model.h"
#include "apis/c/pipeline.h"
#include "archive/value_archive.h"
#include "codebase/mmdet/mmdet.h"
#include "core/device.h"
#include "core/model.h"
#include "core/utils/formatter.h"
#include "core/value.h"
#include "mmdeploy/apis/c/common_internal.h"
#include "mmdeploy/apis/c/executor_internal.h"
#include "mmdeploy/apis/c/model.h"
#include "mmdeploy/apis/c/pipeline.h"
#include "mmdeploy/archive/value_archive.h"
#include "mmdeploy/codebase/mmdet/mmdet.h"
#include "mmdeploy/core/device.h"
#include "mmdeploy/core/model.h"
#include "mmdeploy/core/utils/formatter.h"
#include "mmdeploy/core/value.h"

using namespace std;
using namespace mmdeploy;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright (c) OpenMMLab. All rights reserved.

#include "apis/c/executor.h"
#include "mmdeploy/apis/c/executor.h"

#include "common.h"
#include "common_internal.h"
#include "execution/when_all_value.h"
#include "executor_internal.h"
#include "mmdeploy/execution/when_all_value.h"
Comment on lines 5 to +8
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we include the header file in the same pattern, e.g., the relative path to ${MMDEPLOY_ROOT_DIR}/csrc ?


using namespace mmdeploy;

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#ifndef MMDEPLOY_CSRC_APIS_C_EXECUTOR_INTERNAL_H_
#define MMDEPLOY_CSRC_APIS_C_EXECUTOR_INTERNAL_H_

#include "execution/schedulers/registry.h"
#include "executor.h"
#include "mmdeploy/execution/schedulers/registry.h"

using namespace mmdeploy;

Expand Down
8 changes: 4 additions & 4 deletions csrc/apis/c/handle.h → csrc/mmdeploy/apis/c/handle.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

#include <memory>

#include "core/device.h"
#include "core/graph.h"
#include "core/value.h"
#include "graph/pipeline.h"
#include "mmdeploy/core/device.h"
#include "mmdeploy/core/graph.h"
#include "mmdeploy/core/value.h"
#include "mmdeploy/graph/pipeline.h"

namespace mmdeploy {

Expand Down
4 changes: 2 additions & 2 deletions csrc/apis/c/model.cpp → csrc/mmdeploy/apis/c/model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

#include <memory>

#include "core/logger.h"
#include "core/model.h"
#include "mmdeploy/core/logger.h"
#include "mmdeploy/core/model.h"
// clang-format on

using namespace mmdeploy;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright (c) OpenMMLab. All rights reserved.

#include "apis/c/pipeline.h"
#include "pipeline.h"

#include "apis/c/common_internal.h"
#include "apis/c/executor_internal.h"
#include "apis/c/handle.h"
#include "mmdeploy/apis/c/common_internal.h"
#include "mmdeploy/apis/c/executor_internal.h"
#include "mmdeploy/apis/c/handle.h"

int mmdeploy_pipeline_create(mmdeploy_value_t config, const char* device_name, int device_id,
mmdeploy_exec_info_t exec_info, mm_handle_t* handle) {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

#include <numeric>

#include "apis/c/common_internal.h"
#include "apis/c/handle.h"
#include "apis/c/pipeline.h"
#include "codebase/mmpose/mmpose.h"
#include "core/device.h"
#include "core/graph.h"
#include "core/mat.h"
#include "core/utils/formatter.h"
#include "mmdeploy/apis/c/common_internal.h"
#include "mmdeploy/apis/c/handle.h"
#include "mmdeploy/apis/c/pipeline.h"
#include "mmdeploy/codebase/mmpose/mmpose.h"
#include "mmdeploy/core/device.h"
#include "mmdeploy/core/graph.h"
#include "mmdeploy/core/mat.h"
#include "mmdeploy/core/utils/formatter.h"

using namespace std;
using namespace mmdeploy;
Expand Down
File renamed without changes.
16 changes: 8 additions & 8 deletions csrc/apis/c/restorer.cpp → csrc/mmdeploy/apis/c/restorer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

#include "restorer.h"

#include "apis/c/common_internal.h"
#include "apis/c/executor_internal.h"
#include "apis/c/handle.h"
#include "apis/c/pipeline.h"
#include "codebase/mmedit/mmedit.h"
#include "core/device.h"
#include "core/graph.h"
#include "core/utils/formatter.h"
#include "mmdeploy/apis/c/common_internal.h"
#include "mmdeploy/apis/c/executor_internal.h"
#include "mmdeploy/apis/c/handle.h"
#include "mmdeploy/apis/c/pipeline.h"
#include "mmdeploy/codebase/mmedit/mmedit.h"
#include "mmdeploy/core/device.h"
#include "mmdeploy/core/graph.h"
#include "mmdeploy/core/utils/formatter.h"

using namespace mmdeploy;

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

#include <numeric>

#include "apis/c/common_internal.h"
#include "apis/c/handle.h"
#include "apis/c/pipeline.h"
#include "codebase/mmrotate/mmrotate.h"
#include "core/graph.h"
#include "core/mat.h"
#include "core/utils/formatter.h"
#include "mmdeploy/apis/c/common_internal.h"
#include "mmdeploy/apis/c/handle.h"
#include "mmdeploy/apis/c/pipeline.h"
#include "mmdeploy/codebase/mmrotate/mmrotate.h"
#include "mmdeploy/core/graph.h"
#include "mmdeploy/core/mat.h"
#include "mmdeploy/core/utils/formatter.h"

using namespace std;
using namespace mmdeploy;
Expand Down
File renamed without changes.
22 changes: 11 additions & 11 deletions csrc/apis/c/segmentor.cpp → csrc/mmdeploy/apis/c/segmentor.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// Copyright (c) OpenMMLab. All rights reserved.

#include "apis/c/segmentor.h"

#include "apis/c/common_internal.h"
#include "apis/c/handle.h"
#include "apis/c/pipeline.h"
#include "codebase/mmseg/mmseg.h"
#include "core/device.h"
#include "core/graph.h"
#include "core/mat.h"
#include "core/tensor.h"
#include "core/utils/formatter.h"
#include "mmdeploy/apis/c/segmentor.h"

#include "mmdeploy/apis/c/common_internal.h"
#include "mmdeploy/apis/c/handle.h"
#include "mmdeploy/apis/c/pipeline.h"
#include "mmdeploy/codebase/mmseg/mmseg.h"
#include "mmdeploy/core/device.h"
#include "mmdeploy/core/graph.h"
#include "mmdeploy/core/mat.h"
#include "mmdeploy/core/tensor.h"
#include "mmdeploy/core/utils/formatter.h"

using namespace std;
using namespace mmdeploy;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

#include <numeric>

#include "apis/c/common_internal.h"
#include "apis/c/executor_internal.h"
#include "apis/c/model.h"
#include "apis/c/pipeline.h"
#include "codebase/mmocr/mmocr.h"
#include "core/model.h"
#include "core/status_code.h"
#include "core/utils/formatter.h"
#include "mmdeploy/apis/c/common_internal.h"
#include "mmdeploy/apis/c/executor_internal.h"
#include "mmdeploy/apis/c/model.h"
#include "mmdeploy/apis/c/pipeline.h"
#include "mmdeploy/codebase/mmocr/mmocr.h"
#include "mmdeploy/core/model.h"
#include "mmdeploy/core/status_code.h"
#include "mmdeploy/core/utils/formatter.h"

using namespace std;
using namespace mmdeploy;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@

#include <numeric>

#include "apis/c/common_internal.h"
#include "apis/c/executor_internal.h"
#include "apis/c/model.h"
#include "apis/c/pipeline.h"
#include "archive/value_archive.h"
#include "codebase/mmocr/mmocr.h"
#include "core/device.h"
#include "core/mat.h"
#include "core/model.h"
#include "core/status_code.h"
#include "core/utils/formatter.h"
#include "core/value.h"
#include "mmdeploy/apis/c/common_internal.h"
#include "mmdeploy/apis/c/executor_internal.h"
#include "mmdeploy/apis/c/model.h"
#include "mmdeploy/apis/c/pipeline.h"
#include "mmdeploy/archive/value_archive.h"
#include "mmdeploy/codebase/mmocr/mmocr.h"
#include "mmdeploy/core/device.h"
#include "mmdeploy/core/mat.h"
#include "mmdeploy/core/model.h"
#include "mmdeploy/core/status_code.h"
#include "mmdeploy/core/utils/formatter.h"
#include "mmdeploy/core/value.h"

using namespace mmdeploy;

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set(MMDEPLOY_PYTHON_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/common.cpp)
set(CMAKE_CXX_STANDARD 17)

if (${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME})
add_subdirectory(${CMAKE_SOURCE_DIR}/../../../third_party/pybind11
add_subdirectory(${CMAKE_SOURCE_DIR}/../../../../third_party/pybind11
${CMAKE_CURRENT_BINARY_DIR}/pybind11)
find_package(MMDeploy REQUIRED)
elseif (NOT TARGET pybind11)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) OpenMMLab. All rights reserved.

#include "classifier.h"
#include "mmdeploy/apis/c/classifier.h"

#include "common.h"

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include <stdexcept>

#include "c/common.h"
#include "mmdeploy/apis/c/common.h"
#include "pybind11/numpy.h"
#include "pybind11/pybind11.h"
#include "pybind11/stl.h"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) OpenMMLab. All rights reserved.

#include "detector.h"
#include "mmdeploy/apis/c/detector.h"

#include "common.h"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Copyright (c) OpenMMLab. All rights reserved.

#include "common.h"
#include "core/utils/formatter.h"
#include "execution/execution.h"
#include "execution/schedulers/inlined_scheduler.h"
#include "execution/schedulers/registry.h"
#include "execution/schedulers/single_thread_context.h"
#include "execution/schedulers/static_thread_pool.h"
#include "mmdeploy/core/utils/formatter.h"
#include "mmdeploy/execution/execution.h"
#include "mmdeploy/execution/schedulers/inlined_scheduler.h"
#include "mmdeploy/execution/schedulers/registry.h"
#include "mmdeploy/execution/schedulers/single_thread_context.h"
#include "mmdeploy/execution/schedulers/static_thread_pool.h"

namespace mmdeploy {

Expand Down
Loading