提交 26e473e7 编写于 作者: M Megvii Engine Team

fix(whl/linux): reduce external megengine whl package size

GitOrigin-RevId: 3528af8baeab4ed47eee04107665610e9ababdc9
上级 c076202f
......@@ -53,9 +53,11 @@ option(MGE_WITH_DISTRIBUTED "Build with distributed support" ON)
option(MGE_BUILD_IMPERATIVE_RT "Build _imperative_rt Python Module " ON)
option(MGE_BUILD_SDK "Build load_and_run" ON)
option(MGE_INFERENCE_ONLY "Build inference only library." OFF)
option(MGE_WITH_PYTHON_MODULE "Build MegEngine legacy Python Module." OFF)
option(MGE_WITH_MKLDNN "Enable Intel MKL_DNN support," ON)
option(MGE_WITH_ROCM "Enable ROCM support" OFF)
if(NOT ${MGE_BIN_REDUCE} STREQUAL "")
message("build with BIN REDUCE")
if(MGE_WITH_MINIMUM_SIZE)
......
......@@ -60,7 +60,18 @@ elseif (MSVC OR WIN32)
message("-- CMAKE_MSVC_RUNTIME_LIBRARY: ${CMAKE_MSVC_RUNTIME_LIBRARY}")
set_target_properties(${MODULE_NAME} PROPERTIES MSVC_RUNTIME_LIBRARY "${CMAKE_MSVC_RUNTIME_LIBRARY}")
else()
target_link_libraries(${MODULE_NAME} PRIVATE megengine_export -Wl,--version-script=${VERSION_SCRIPT})
if (MGE_WITH_PYTHON_MODULE)
# use to fix runtime crash when build both mgb(MGE_WITH_PYTHON_MODULE) and imperative(MGE_BUILD_IMPERATIVE_RT)
target_link_libraries(${MODULE_NAME} PRIVATE megengine_export -Wl,--version-script=${VERSION_SCRIPT})
else()
# use to reduce whl size by depend on megbrain/dnn directly, caused by cmake create two cuda fatbin
# elf section on both megengine_export and target which depend on megengine_export
target_link_libraries(${MODULE_NAME} PRIVATE megbrain megdnn -Wl,--version-script=${VERSION_SCRIPT})
if (MGE_WITH_DISTRIBUTED)
message("-- Imperative configured to link megray")
target_link_libraries(${MODULE_NAME} PRIVATE megray)
endif()
endif()
endif()
target_include_directories(${MODULE_NAME} PUBLIC src/include PRIVATE ${PYTHON_INCLUDE_DIRS} ${NUMPY_INCLUDE_DIR})
......
......@@ -189,7 +189,7 @@ if(MGE_BUILD_IMPERATIVE_RT
add_library(megengine_export SHARED)
target_link_libraries(megengine_export PUBLIC megbrain megdnn)
if (MGE_WITH_DISTRIBUTED)
message("megengine_export configured to link megray")
message("-- megengine_export configured to link megray")
target_link_libraries(megengine_export PUBLIC megray)
endif()
endif()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册