Updated install system

This commit is contained in:
Anne de Jong 2018-12-30 16:45:39 +01:00
parent 505add6ae1
commit acd28780f2
3 changed files with 17 additions and 48 deletions

View File

@ -99,31 +99,29 @@ else()
set(win32 false) set(win32 false)
endif(CMAKE_SYSTEM_NAME STREQUAL "Windows") endif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
find_package(PythonLibs REQUIRED )
find_package(PythonInterp REQUIRED)
add_subdirectory(fftpack) add_subdirectory(fftpack)
include_directories( include_directories(
fftpack fftpack
lasp/c lasp/c
) )
add_subdirectory(lasp) add_subdirectory(lasp)
add_subdirectory(test) add_subdirectory(test)
if (PYTHON)
# set(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in") # set(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in")
set(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/setup.py") set(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/setup.py")
set(DEPS "${CMAKE_CURRENT_SOURCE_DIR}/lasp/*.py") set(DEPS "${CMAKE_CURRENT_SOURCE_DIR}/lasp/*.py")
set(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/build/timestamp") set(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/build/timestamp")
# configure_file(${SETUP_PY_IN} ${SETUP_PY}) # configure_file(${SETUP_PY_IN} ${SETUP_PY})
add_custom_command(OUTPUT ${OUTPUT} add_custom_command(OUTPUT ${OUTPUT}
COMMAND ${PYTHON} ${SETUP_PY} build COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} build
COMMAND ${CMAKE_COMMAND} -E touch ${OUTPUT} COMMAND ${CMAKE_COMMAND} -E touch ${OUTPUT}
DEPENDS ${DEPS}) DEPENDS ${DEPS})
add_custom_target(target ALL DEPENDS ${OUTPUT}) add_custom_target(target ALL DEPENDS ${OUTPUT})
install(CODE "execute_process(COMMAND ${PYTHON} ${SETUP_PY} install)") install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} install)")
endif()
############################## End compiler settings

View File

@ -1,7 +1,6 @@
configure_file(config.pxi.in config.pxi) configure_file(config.pxi.in config.pxi)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
find_package(PythonLibs REQUIRED )
include(UseCython) include(UseCython)
find_package(Numpy REQUIRED ) find_package(Numpy REQUIRED )
@ -13,35 +12,6 @@ include_directories(
add_subdirectory(c) add_subdirectory(c)
add_subdirectory(device) add_subdirectory(device)
# add the command to generate the source code
# add_custom_command (
# OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Table.h
# COMMAND MakeTable ${CMAKE_CURRENT_BINARY_DIR}/Table.h
# DEPENDS MakeTable
# )
set(ui_files ui_apsrtsettings ui_mainwindow ui_figure ui_about
ui_apswidget ui_revtimewidget ui_slmwidget ui_daqwidget ui_apssettings
ui_figuredialog)
foreach(fn ${ui_files})
add_custom_command(
OUTPUT "${fn}.py"
COMMAND pyside-uic ${CMAKE_CURRENT_SOURCE_DIR}/ui/${fn}.ui -o ${CMAKE_CURRENT_SOURCE_DIR}/${fn}.py
DEPENDS "ui/${fn}.ui"
)
add_custom_target(${fn} ALL DEPENDS "${fn}.py")
endforeach(fn)
add_custom_command(
OUTPUT "${PROJECT_SOURCE_DIR}/resources_rc.py"
COMMAND pyside-rcc -py3 ui/resources.qrc -o ${PROJECT_SOURCE_DIR}/resources_rc.py
DEPENDS "ui/resources.qrc"
)
add_custom_target(resources_rc ALL DEPENDS "${PROJECT_SOURCE_DIR}/resources_rc.py")
set_source_files_properties(wrappers.c PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} ${CYTHON_EXTRA_C_FLAGS}") set_source_files_properties(wrappers.c PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} ${CYTHON_EXTRA_C_FLAGS}")
cython_add_module(wrappers wrappers.pyx) cython_add_module(wrappers wrappers.pyx)
target_link_libraries(wrappers lasp_lib ) target_link_libraries(wrappers lasp_lib )

View File

@ -14,7 +14,8 @@ setup(
packages=['lasp'], packages=['lasp'],
author='J.A. de Jong - ASCEE', author='J.A. de Jong - ASCEE',
author_email="j.a.dejong@ascee.nl", author_email="j.a.dejong@ascee.nl",
install_requires=['matplotlib>=1.0', 'scipy>=1.0', 'numpy>=1.0'], install_requires=['matplotlib>=1.0',
'scipy>=1.0', 'numpy>=1.0', 'h5py'],
license='MIT', license='MIT',
description=descr, description=descr,
keywords="", keywords="",