Skip to content

Commit

Permalink
rollback cmake.in and apis/python/CMakeLists.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
lvhan028 committed Aug 1, 2022
1 parent 32ad0f0 commit a7416ab
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 22 deletions.
2 changes: 1 addition & 1 deletion cmake/MMDeployConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ set(MMDEPLOY_VERSION_MAJOR @MMDEPLOY_VERSION_MAJOR@)
set(MMDEPLOY_VERSION_MINOR @MMDEPLOY_VERSION_MINOR@)
set(MMDEPLOY_VERSION_PATCH @MMDEPLOY_VERSION_PATCH@)

if (NOT MMDEPLOY_BUILD_SHARED AND NOT MMDEPLOY_BUILD_SDK_MONOLITHIC)
if (NOT MMDEPLOY_BUILD_SHARED)
if ("cuda" IN_LIST MMDEPLOY_TARGET_DEVICES)
find_package(CUDA REQUIRED)
if(MSVC)
Expand Down
19 changes: 8 additions & 11 deletions csrc/mmdeploy/apis/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,11 @@ endforeach ()

pybind11_add_module(${PROJECT_NAME} ${MMDEPLOY_PYTHON_SRCS})

if (MMDEPLOY_BUILD_SDK_MONOLITHIC)
target_link_libraries(${PROJECT_NAME} PRIVATE mmdeploy)
else ()
mmdeploy_load_static(${PROJECT_NAME} MMDeployStaticModules)
mmdeploy_load_dynamic(${PROJECT_NAME} MMDeployDynamicModules)
target_link_libraries(${PROJECT_NAME} PRIVATE MMDeployLibs)

target_include_directories(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/..
${CMAKE_CURRENT_SOURCE_DIR})
endif ()

mmdeploy_load_static(${PROJECT_NAME} MMDeployStaticModules)
mmdeploy_load_dynamic(${PROJECT_NAME} MMDeployDynamicModules)
target_link_libraries(${PROJECT_NAME} PRIVATE MMDeployLibs)

target_include_directories(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/..
${CMAKE_CURRENT_SOURCE_DIR})
15 changes: 5 additions & 10 deletions tools/package_tools/mmdeploy_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ def _create_tar(path, tar_name):
tar.add(path, arcname=os.path.basename(path))


def _create_bdist_cmd(cfg, python_path, c_ext=False, dist_dir=None):
def _create_bdist_cmd(cfg, c_ext=False, dist_dir=None):

bdist_tags = cfg.get('bdist_tags', {})

# base
bdist_cmd = f'{python_path} setup.py bdist_wheel '
bdist_cmd = 'python3 setup.py bdist_wheel '

# platform
bdist_cmd += f' --plat-name {PLATFORM_TAG} '
Expand Down Expand Up @@ -169,14 +169,9 @@ def build_mmdeploy(cfg, mmdeploy_dir, dist_dir=None):
build_cmd = 'cmake --build . -- -j$(nproc) && cmake --install .'
_call_command(build_cmd, build_dir)

# !!! Comment build_mmdeploy in v0.7.0 for the following reasons:
# 1. onnx optimizer in mmdeploy highly depends on torch, which means
# we have to build mmdeploy for each torch version, just like mmcv
# does. It's not convenient
# 2. It depends on python version
# # build wheel
# bdist_cmd = _create_bdist_cmd(cfg, c_ext=False, dist_dir=dist_dir)
# _call_command(bdist_cmd, mmdeploy_dir)
# build wheel
bdist_cmd = _create_bdist_cmd(cfg, c_ext=False, dist_dir=dist_dir)
_call_command(bdist_cmd, mmdeploy_dir)


def build_mmdeploy_python(python_executable, cfg, mmdeploy_dir):
Expand Down

0 comments on commit a7416ab

Please sign in to comment.