CMakeLists.txt
2.69 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
set (MORFEUSZBUILDER "morfeuszbuilder")
set (MORFEUSZBUILDER_VERSION "0.1.0")
set (DIST_PATH "${CMAKE_CURRENT_BINARY_DIR}")
set (SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in")
set (SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/setup.py")
set (DEPS "")
configure_file (${SETUP_PY_IN} ${SETUP_PY})
add_custom_command (OUTPUT ${SETUP_PY}
COMMAND python
ARGS setup.py build
DEPENDS ${DEPS})
add_custom_target (builder-setup DEPENDS ${SETUP_PY})
#~ add_custom_target (buildfsa-exec ALL
#~ COMMAND pyinstaller --noconfirm --onefile --console --strip --distpath="${DIST_PATH}" --noupx --clean fsa/buildfsa.py
#~ )
#~
#~ add_executable (buildfsa IMPORTED)
#~ add_dependencies (buildfsa buildfsa-exec)
#~ set_property (TARGET buildfsa PROPERTY IMPORTED_LOCATION "${DIST_PATH}")
#~ install (PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/buildfsa" DESTINATION bin)
if (${UNIX})
add_custom_target (install-builder
COMMAND python ${SETUP_PY} install --home=${CMAKE_INSTALL_PREFIX}
DEPENDS builder-setup
)
add_custom_target (package-builder-tgz
COMMAND python ${SETUP_PY} bdist -d "${TARGET_DIR}"
DEPENDS builder-setup
)
add_custom_target (package-builder-egg
COMMAND python ${SETUP_PY} bdist_egg -d "${TARGET_DIR}"
DEPENDS builder-setup
)
set (PACKAGE_DEPENDS "package-builder-egg" "package-builder-tgz")
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
add_custom_target (package-builder-deb-sdist
COMMAND python ${SETUP_PY} --command-packages=stdeb.command sdist_dsc --depends "${CPACK_DEBIAN_PACKAGE_NAME}"
DEPENDS builder-setup
)
add_custom_target (package-builder-deb-build
COMMAND debuild -us -uc
WORKING_DIRECTORY deb_dist/${MORFEUSZBUILDER}-${MORFEUSZBUILDER_VERSION}
DEPENDS package-builder-deb-sdist
)
add_custom_target(package-builder-deb
COMMAND mkdir -p "${TARGET_DIR}" && cp ${CMAKE_CURRENT_BINARY_DIR}/deb_dist/python-${MORFEUSZBUILDER}*.deb "${TARGET_DIR}"
DEPENDS package-builder-deb-build
)
list (APPEND PACKAGE_DEPENDS package-builder-deb)
#~ 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)
endif ()
#~ message ("PACKAGE_DEPENDS=${PACKAGE_DEPENDS}")
add_custom_target (package-builder
DEPENDS ${PACKAGE_DEPENDS})
endif ()