CMakeLists.txt 1.3 KB
Newer Older
S
sangoly 已提交
1 2
set(PYBIND_DEPS pybind python paddle_api_light paddle_api)
if (NOT LITE_ON_TINY_PUBLISH)
3
   set(PYBIND_DEPS ${PYBIND_DEPS} paddle_api_full opt_base)
S
sangoly 已提交
4 5
endif()

6 7 8 9
if(WIN32)
   lite_cc_library(lite_pybind SHARED SRCS pybind.cc DEPS ${PYBIND_DEPS})
   get_property (os_dependency_modules GLOBAL PROPERTY OS_DEPENDENCY_MODULES)
   target_link_libraries(lite_pybind ${os_dependency_modules})
10 11 12 13 14 15 16
elseif(APPLE)
   lite_cc_library(lite_pybind SHARED SRCS pybind.cc DEPS ${PYBIND_DEPS})
   set(LINK_MAP_FILE "${PADDLE_SOURCE_DIR}/lite/core/exported_symbols.lds")
   set(LINK_FLAGS "-Wl,-exported_symbols_list, ${LINK_MAP_FILE}")
   add_custom_command(OUTPUT ${LINK_MAP_FILE} COMMAND ...)
   set_target_properties(lite_pybind PROPERTIES LINK_FLAGS ${LINK_FLAGS})
   add_dependencies(lite_pybind custom_linker_map)
17 18
else()
   lite_cc_library(lite_pybind SHARED SRCS pybind.cc DEPS ${PYBIND_DEPS})
19 20 21 22 23
   set(LINK_MAP_FILE "${PADDLE_SOURCE_DIR}/lite/core/lite.map")
   set(LINK_FLAGS "-Wl,--version-script ${LINK_MAP_FILE}")
   add_custom_command(OUTPUT ${LINK_MAP_FILE} COMMAND ...)
   set_target_properties(lite_pybind PROPERTIES LINK_FLAGS ${LINK_FLAGS})
   add_dependencies(lite_pybind custom_linker_map)
24 25
endif(WIN32)

H
huzhiqiang 已提交
26 27 28
if (LITE_ON_TINY_PUBLISH)
   set_target_properties(lite_pybind PROPERTIES COMPILE_FLAGS "-flto -fdata-sections")
endif()