|
1
2
3
|
# SWIG
#set(CMAKE_SWIG_OUTDIR swig)
|
|
4
|
#~ FIND_PACKAGE (SWIG REQUIRED)
|
|
5
|
FIND_PACKAGE (PythonLibs)
|
|
6
|
#~ INCLUDE (${SWIG_USE_FILE})
|
|
7
8
|
set (PYMORFEUSZ_VERSION "0.1.0")
|
|
9
10
|
# SWIG Java
|
|
11
12
|
INCLUDE_DIRECTORIES (${PYTHON_INCLUDE_PATH})
INCLUDE_DIRECTORIES (..)
|
|
13
|
|
|
14
15
|
set (SWIG_PYTHON_OUTFILE swigPYTHON.cpp)
add_custom_command (
|
|
16
|
OUTPUT ${SWIG_PYTHON_OUTFILE} morfeusz2.py
|
|
17
18
19
|
COMMAND swig -python -c++ -o ${SWIG_PYTHON_OUTFILE} ${CMAKE_SOURCE_DIR}/morfeusz/morfeusz.i
DEPENDS libmorfeusz
)
|
|
20
|
|
|
21
22
|
set (SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in")
set (SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/setup.py")
|
|
23
|
set (DEPS "${CMAKE_CURRENT_BINARY_DIR}/morfeusz2.py" "${SWIG_PYTHON_OUTFILE}")
|
|
24
|
set (OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/build")
|
|
25
|
|
|
26
|
configure_file (${SETUP_PY_IN} ${SETUP_PY})
|
|
27
|
|
|
28
|
add_custom_command (OUTPUT ${SETUP_PY}
|
|
29
30
|
COMMAND python
ARGS setup.py build
|
|
31
|
DEPENDS ${DEPS} ${SETUP_PY_IN})
|
|
32
|
|
|
33
|
add_custom_target (pymorfeusz DEPENDS ${SETUP_PY} libmorfeusz)
|
|
34
35
36
37
38
39
40
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
add_custom_target (install-python
COMMAND python ${SETUP_PY} install --home=${CMAKE_INSTALL_PREFIX}
DEPENDS ${pymorfeusz}
)
add_custom_target (package-python-bin
|
|
41
|
COMMAND python ${SETUP_PY} bdist_egg -d "${TARGET_DIR}" --plat-name "${CMAKE_SYSTEM_NAME}-${ARCHITECTURE}"
|
|
42
43
|
DEPENDS pymorfeusz
)
|
|
44
|
set (PACKAGE_DEPENDS "package-python-bin")
|
|
45
|
|
|
46
47
48
49
50
51
52
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
add_custom_target (package-python-deb-sdist
COMMAND python ${SETUP_PY} --command-packages=stdeb.command sdist_dsc --depends "${CPACK_DEBIAN_PACKAGE_NAME}"
DEPENDS pymorfeusz
)
add_custom_target (package-python-deb-build
COMMAND debuild -us -uc
|
|
53
|
WORKING_DIRECTORY deb_dist/morfeusz2-${PYMORFEUSZ_VERSION}
|
|
54
55
56
|
DEPENDS package-python-deb-sdist
)
add_custom_target(package-python-deb
|
|
57
|
COMMAND mkdir -p "${TARGET_DIR}" && cp ${CMAKE_CURRENT_BINARY_DIR}/deb_dist/python-morfeusz2*.deb "${TARGET_DIR}"
|
|
58
59
60
|
DEPENDS package-python-deb-build
)
list (APPEND PACKAGE_DEPENDS package-python-deb)
|
|
61
62
63
64
65
66
|
#~ elseif (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
#~ add_custom_target (package-python-win-installer
#~ COMMAND python ${SETUP_PY} bdist_wininst -d ${TARGET_DIR} --plat-name "${CMAKE_SYSTEM_NAME}-${ARCHITECTURE}"
#~ DEPENDS pymorfeusz
#~ )
#~ list (APPEND PACKAGE_DEPENDS package-python-win-installer)
|
|
67
68
69
70
|
endif ()
message ("PACKAGE_DEPENDS=${PACKAGE_DEPENDS}")
add_custom_target (package-python
DEPENDS pymorfeusz ${PACKAGE_DEPENDS})
|
|
71
|
endif ()
|