-
Notifications
You must be signed in to change notification settings - Fork 167
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
33 lines (27 loc) · 1.36 KB
/
CMakeLists.txt
File metadata and controls
33 lines (27 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#
# used for building both python2 and python3 bindings
# do not use if you want to build just one flavor, use the
# standard python bindings file in that case.
#
# we cannot use FIND_PACKAGE PythonLibs here, as this would
# clash with the python variables.
#
find_package (Python3 COMPONENTS Interpreter Development)
SET (SWIG_PY3_FLAGS -DPYTHON3=1)
SET (SWIG_PY3_FLAGS ${SWIG_PY3_FLAGS} -DSWIG_PYTHON_LEGACY_BOOL=1)
MESSAGE (STATUS "Python3 executable: ${PYTHON_EXECUTABLE}")
MESSAGE (STATUS "Python3 installation dir: ${Python3_STDARCH}")
MESSAGE (STATUS "Python3 include path: ${Python3_INCLUDE_DIRS}")
ADD_CUSTOM_COMMAND (
OUTPUT solv_python.c
COMMAND ${SWIG_EXECUTABLE} ${SWIG_FLAGS} -python ${SWIG_PY3_FLAGS} -I${CMAKE_SOURCE_DIR}/src -o solv_python.c ${CMAKE_SOURCE_DIR}/bindings/solv.i
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${CMAKE_SOURCE_DIR}/bindings/solv.i
)
ADD_DEFINITIONS(-Wno-unused)
INCLUDE_DIRECTORIES (${Python3_INCLUDE_DIRS})
ADD_LIBRARY (bindings_python3 SHARED solv_python.c)
SET_TARGET_PROPERTIES (bindings_python3 PROPERTIES PREFIX "" OUTPUT_NAME "_solv")
TARGET_LINK_LIBRARIES (bindings_python3 libsolvext libsolv ${SYSTEM_LIBRARIES})
INSTALL (TARGETS bindings_python3 LIBRARY DESTINATION ${Python3_STDARCH} COMPONENT "python3" )
INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/solv.py DESTINATION ${Python3_STDARCH} COMPONENT "python3" )