python: do all work in build directory

This commit is contained in:
nick black 2020-01-30 09:22:34 -05:00
parent 7bb864b999
commit ca628e55bb
2 changed files with 7 additions and 4 deletions

View File

@ -436,6 +436,7 @@ write_basic_package_version_file(
if(${BUILD_PYTHON}) if(${BUILD_PYTHON})
find_package(Python3 COMPONENTS Development Interpreter REQUIRED) find_package(Python3 COMPONENTS Development Interpreter REQUIRED)
file(GLOB PYSRC CONFIGURE_DEPENDS python/src/notcurses/*.py) file(GLOB PYSRC CONFIGURE_DEPENDS python/src/notcurses/*.py)
file(COPY python/src/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/python/)
set(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/python/setup.py.in") set(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/python/setup.py.in")
set(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/python/setup.py") set(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/python/setup.py")
set(SETUP_CFG_IN "${CMAKE_CURRENT_SOURCE_DIR}/python/setup.cfg.in") set(SETUP_CFG_IN "${CMAKE_CURRENT_SOURCE_DIR}/python/setup.cfg.in")
@ -446,7 +447,9 @@ if(${BUILD_PYTHON})
OUTPUT OUTPUT
"${CMAKE_CURRENT_BINARY_DIR}/build/pytimestamp" "${CMAKE_CURRENT_BINARY_DIR}/build/pytimestamp"
COMMAND COMMAND
"${Python3_EXECUTABLE}" ${SETUP_PY} build_ext -L ${CMAKE_CURRENT_BINARY_DIR} -b ${CMAKE_CURRENT_BINARY_DIR}/python "${Python3_EXECUTABLE}" ${SETUP_PY} build_ext -R${CMAKE_INSTALL_LIBDIR} -L ${CMAKE_CURRENT_BINARY_DIR} -b ${CMAKE_CURRENT_BINARY_DIR}/python &&
"${Python3_EXECUTABLE}" ${SETUP_PY} build_py &&
"${Python3_EXECUTABLE}" ${SETUP_PY} egg_info -b ${CMAKE_CURRENT_BINARY_DIR}/python
DEPENDS DEPENDS
${PYSRC} ${SETUP_PY} ${SETUP_CFG} notcurses ${PYSRC} ${SETUP_PY} ${SETUP_CFG} notcurses
COMMENT "Building Python wrappers" COMMENT "Building Python wrappers"

View File

@ -7,9 +7,9 @@ def read(fname):
if __name__ == '__main__': if __name__ == '__main__':
setup(name='notcurses', setup(name='notcurses',
version='${PROJECT_VERSION}', version='${PROJECT_VERSION}',
package_dir={ '': '${CMAKE_CURRENT_SOURCE_DIR}/python/src/notcurses' }, package_dir={ '': '${CMAKE_CURRENT_BINARY_DIR}/python/notcurses' },
packages=find_packages('${CMAKE_CURRENT_SOURCE_DIR}/python/src/notcurses'), packages=find_packages('${CMAKE_CURRENT_BINARY_DIR}/python/notcurses'),
cffi_modules=['${CMAKE_CURRENT_SOURCE_DIR}/python/src/notcurses/build_notcurses.py:ffibuild'], cffi_modules=['${CMAKE_CURRENT_BINARY_DIR}/python/notcurses/build_notcurses.py:ffibuild'],
py_modules=["notcurses"], py_modules=["notcurses"],
include_dirs=['${CMAKE_CURRENT_SOURCE_DIR}/include'] include_dirs=['${CMAKE_CURRENT_SOURCE_DIR}/include']
) )