提交 d84dc7f7 编写于 作者: M Megvii Engine Team 提交者: Xinran Xu

build(python_module): use consistent flag declaration in SWIG and c++

Include cmake generated megbrain_build_config.h in SWIG in order to remove usage of MGB_DEF.

GitOrigin-RevId: d3e841eaf645e9501fa911d4d0462be36fba9b27
上级 03728d45
......@@ -63,8 +63,10 @@ endif()
include(UseSWIG)
set_property(SOURCE ${SWIG_SRC} PROPERTY CPLUSPLUS ON)
# cmake < 3.12 do not honor INCLUDE_DIRECTORIES property, just add include directory into SWIG_FLAGS
set_property(SOURCE ${SWIG_SRC} PROPERTY SWIG_FLAGS ${MGB_DEF} -I${PROJECT_SOURCE_DIR}/src/serialization/include)
# Add -I${PROJECT_BINARY_DIR}/genfiles in order to include megbrain_build_config.h so that we don't need to pass cmake flags by -D.
set_property(SOURCE ${SWIG_SRC} PROPERTY SWIG_FLAGS -I${PROJECT_SOURCE_DIR}/src/serialization/include -I${PROJECT_BINARY_DIR}/genfiles)
set(SWIG_OUTFILE_DIR ${CMAKE_CURRENT_BINARY_DIR})
set(CMAKE_SWIG_OUTDIR ${CMAKE_CURRENT_BINARY_DIR}/megengine/_internal)
......
......@@ -49,6 +49,7 @@ intb4 = _mgb.intb4
#include "plugin.h"
%}
%include "megbrain_build_config.h"
%include "comp_node.i"
%include "comp_graph.i"
%include "symbol_var.i"
......
......@@ -31,10 +31,8 @@ if(MGE_WITH_CUDA AND MGE_WITH_TRT)
list(APPEND SOURCES ${SOURCES_})
endif()
set(MGB_DEF ${MGB_DEF} PARENT_SCOPE)
add_library(megbrain STATIC EXCLUDE_FROM_ALL ${SOURCES})
target_link_libraries(megbrain mgb_opr_param_defs)
target_compile_definitions(megbrain PUBLIC ${MGB_DEF})
target_include_directories(megbrain PUBLIC ${MGB_INC})
if(MGE_WITH_CUDA)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册