Warning, /graphics/kst-plot/cmake/pyKst/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 cmake_minimum_required(VERSION 2.8)
0002 
0003 project(pyKst)
0004 
0005 
0006 if(kst_binary_name) #stand-alone?
0007     set(kstpydir ${CMAKE_SOURCE_DIR})
0008 else()
0009     find_package(Qt4 REQUIRED)
0010     set(kstpydir ${CMAKE_SOURCE_DIR}/..)
0011 endif()
0012 
0013 find_package(PythonInterp REQUIRED)
0014 find_package(PythonLibs REQUIRED)
0015 
0016 if(kst_python_prefix)
0017     set(pydist_dir ${kst_python_prefix})
0018     message(STATUS "Installing python support into ${pydist_dir}")
0019 else()
0020     # find install path for pykst files
0021     execute_process(COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/finddistdir.py
0022                 OUTPUT_VARIABLE pydist_dir
0023                 OUTPUT_STRIP_TRAILING_WHITESPACE)
0024     message(STATUS "Installing python support into ${pydist_dir}. Overwrite using -Dkst_python_prefix=")
0025 endif()
0026 
0027 if(NOT kst_python_depend)
0028     macro(checkversion _name _required)
0029         string(TOUPPER ${_name} _n)
0030         if(${${_n}_VERSION} VERSION_LESS ${_required})
0031             message(FATAL_ERROR "Python support: '${_name}' is too old (${${_n}_VERSION} < ${_required})")
0032         endif()
0033     endmacro()
0034     include(CMakePackageConfigHelpers)
0035     find_package(NumPy REQUIRED)
0036     checkversion(NumPy 1.6.0)
0037     find_package(SciPy REQUIRED)
0038     checkversion(SciPy 0.10.0)
0039 endif()
0040 
0041 
0042 if(kst_python_depend)
0043     if(WIN32)
0044         # Python 2.6(7?)    : http://www.python.org/getit/windows
0045         # NumPy/Scipy (bin) : http://www.lfd.uci.edu/~gohlke/pythonlibs
0046         # Sip/PyQt    (src) : http://www.riverbankcomputing.co.uk/software/pyqt/intro
0047         # Status -> could not load QtGui (has nothing to do with kst)
0048         set(BUILD_NUM_PY FALSE)
0049         set(BUILD_SCI_PY FALSE)
0050     else()
0051         set(BUILD_NUM_PY TRUE)
0052         set(BUILD_SCI_PY TRUE)
0053     endif()
0054 
0055     include(ExternalProject)
0056     set(pypi http://pypi.python.org/packages/source)
0057 
0058     if(NOT EXISTS ${pydist_dir}/numpy  AND BUILD_NUM_PY)
0059         set(numpy numpy-1.6.1)
0060         ExternalProject_Add(numpy
0061                         PREFIX ${CMAKE_CURRENT_BINARY_DIR}/numpy
0062                         URL    ${pypi}/n/numpy/${numpy}.tar.gz
0063                         CONFIGURE_COMMAND ""
0064                         BUILD_IN_SOURCE   ON
0065                         BUILD_COMMAND     python setup.py build --fcompiler=gnu95
0066                         INSTALL_COMMAND   sudo python setup.py install)
0067     endif()
0068 
0069     if(NOT EXISTS ${pydist_dir}/scipy  AND BUILD_SCI_PY)
0070         set(scipy scipy-0.10.0)
0071         ExternalProject_Add(scipy
0072                         PREFIX ${CMAKE_CURRENT_BINARY_DIR}/scipy
0073                         URL    ${pypi}/s/scipy/${scipy}.tar.gz
0074                         CONFIGURE_COMMAND ""
0075                         BUILD_IN_SOURCE   ON
0076                         BUILD_COMMAND     python setup.py build
0077                         INSTALL_COMMAND   sudo python setup.py install)
0078     endif()
0079 
0080     message(STATUS "Python support: installing Kst's python files into '${pydist_dir}'")
0081     message(STATUS)
0082 endif()
0083 
0084 install(FILES ${kstpydir}/pyKst/pykst.py DESTINATION ${pydist_dir})