Radek Krejci | c61f0b4 | 2017-06-07 13:21:41 +0200 | [diff] [blame] | 1 | find_program(PYTHON "python3") |
| 2 | |
| 3 | if (PYTHON) |
| 4 | set(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in") |
| 5 | set(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/setup.py") |
| 6 | set(PYAPI_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/build") |
| 7 | set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${PYAPI_BUILD_DIR}) |
| 8 | |
| 9 | if(CMAKE_BUILD_TYPE STREQUAL debug) |
| 10 | set(DEBUG "--debug") |
| 11 | endif() |
| 12 | |
| 13 | configure_file(${SETUP_PY_IN} ${SETUP_PY}) |
Radek Krejci | b03ebe4 | 2017-07-04 14:00:33 +0200 | [diff] [blame^] | 14 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/docs/Makefile.in ${CMAKE_CURRENT_SOURCE_DIR}/docs/Makefile) |
Radek Krejci | c61f0b4 | 2017-06-07 13:21:41 +0200 | [diff] [blame] | 15 | add_custom_target(pyapi ALL COMMAND ${PYTHON} ${SETUP_PY} build -b ${PYAPI_BUILD_DIR} ${DEBUG}) |
Radek Krejci | b03ebe4 | 2017-07-04 14:00:33 +0200 | [diff] [blame^] | 16 | add_custom_target(pyapidoc COMMAND make -f ${CMAKE_CURRENT_SOURCE_DIR}/docs/Makefile html) |
Radek Krejci | c61f0b4 | 2017-06-07 13:21:41 +0200 | [diff] [blame] | 17 | install(CODE "execute_process(COMMAND ${PYTHON} ${SETUP_PY} build -b ${PYAPI_BUILD_DIR} install --prefix=${CMAKE_INSTALL_PREFIX})") |
| 18 | endif() |