You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
2.4 KiB
CMake

FIND_PACKAGE(PythonLibs REQUIRED)
FIND_PACKAGE(PythonInterp REQUIRED)
SET(PYTHON_LIBRARY_SUFFIX /python)
SET(PYTHON_LIBRARY_PATH lib${PYTHON_LIBRARY_SUFFIX})
FIND_PACKAGE(Numpy)
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${PYTHON_NUMPY_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
INCLUDE_DIRECTORIES(../../../system/libs/swig)
FIND_PACKAGE(Boost REQUIRED COMPONENTS filesystem)
IF (CMAKE_COMPILER_IS_GNUCC)
# Important for O2 compilation
ADD_DEFINITIONS("-fno-strict-aliasing")
ENDIF (CMAKE_COMPILER_IS_GNUCC)
SET(
WRAPPER_MODULES
CAPS
)
FIND_PACKAGE(OpenSSL REQUIRED)
SET(WRAPPER_MODULE_CAPS_EXTRA_LIBS capsclient ${Boost_filesystem_LIBRARY} ${OPENSSL_LIBRARIES})
FOREACH (wrapper_module ${WRAPPER_MODULES})
SET(
${wrapper_module}_SOURCES
${wrapper_module}PYTHON_wrap.cxx
${WRAPPER_MODULE_${wrapper_module}_EXTRA_FILES}
)
ADD_LIBRARY(_${wrapper_module} MODULE ${${wrapper_module}_SOURCES})
SET_TARGET_PROPERTIES(_${wrapper_module} PROPERTIES PREFIX "")
TARGET_LINK_LIBRARIES(_${wrapper_module} ${PYTHON_LIBRARIES})
TARGET_LINK_LIBRARIES(_${wrapper_module} ${WRAPPER_MODULE_${wrapper_module}_EXTRA_LIBS})
ENDFOREACH (wrapper_module)
#SC_SWIG_GET_MODULE_PATH(_module_path)
SET(_module_path ${CMAKE_INSTALL_PREFIX}/lib/python/gempa)
FOREACH (wrapper_module ${WRAPPER_MODULES})
INSTALL(
TARGETS _${wrapper_module}
LIBRARY DESTINATION ${_module_path}
)
INSTALL(
FILES ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py
DESTINATION ${_module_path}
)
INSTALL(
FILES ${CMAKE_CURRENT_SOURCE_DIR}/${wrapper_module}.py
DESTINATION ${_module_path}
)
INSTALL(
FILES ${CMAKE_CURRENT_BINARY_DIR}/${wrapper_module}.pyc
DESTINATION ${_module_path}
OPTIONAL
)
INSTALL(
FILES ${CMAKE_CURRENT_BINARY_DIR}/${wrapper_module}.pyo
DESTINATION ${_module_path}
OPTIONAL
)
ADD_CUSTOM_COMMAND(
TARGET _${wrapper_module}
POST_BUILD
COMMAND ${CMAKE_SOURCE_DIR}/py-compile ARGS --python \"${PYTHON_EXECUTABLE}\" --destdir ${CMAKE_CURRENT_BINARY_DIR} ${wrapper_module}.py
)
ENDFOREACH (wrapper_module)