[Kst] branches/work/kst/portto4/kst/cmake

Peter Kümmel syntheticpp at gmx.net
Sat Jan 21 15:45:48 UTC 2012


SVN commit 1275095 by kuemmel:

use correct dist/site-package dir 
prepare python support on Windows

 M  +1 -1      CMakeLists.txt  
 MM +26 -13    pyKst/CMakeLists.txt  
 AM            pyKst/finddistdir.py  


--- branches/work/kst/portto4/kst/cmake/CMakeLists.txt #1275094:1275095
@@ -28,7 +28,7 @@
 kst_option(3rdparty_download "Download precompiled 3rd party libraries" OFF win)
 kst_option(console "Open console on Windows" OFF win)
 kst_option(edit_cont "Enable \"Edit and Continue\" for Visual Studio" OFF win)
-kst_option(python "Build Python support" OFF gcc)
+kst_option(python "Build Python support" OFF all)
 
 message(STATUS)
 
--- branches/work/kst/portto4/kst/cmake/pyKst/CMakeLists.txt #1275094:1275095
@@ -12,20 +12,24 @@
 find_package(PythonInterp REQUIRED)
 find_package(PythonLibs REQUIRED)
 
+
+if(WIN32)
+    # Python 2.6(7?)    : http://www.python.org/getit/windows
+    # NumPy/Scipy (bin) : http://www.lfd.uci.edu/~gohlke/pythonlibs
+    # Sip/PyQt    (src) : http://www.riverbankcomputing.co.uk/software/pyqt/intro
+    # Status -> could not load QtGui (has nothing to do with kst)
+    set(BUILD_NUM_PY FALSE)
+    set(BUILD_SCI_PY FALSE)
+else()
+    set(BUILD_NUM_PY TRUE)
+    set(BUILD_SCI_PY TRUE)
+endif()
+
 include(ExternalProject)
+set(pypi http://pypi.python.org/packages/source)
 
-set(pypi http://pypi.python.org/packages/source)
+if(NOT EXISTS ${pydist_dir}/numpy  AND BUILD_NUM_PY)
 set(numpy numpy-1.6.1)
-set(scipy scipy-0.10.0)
-
-
-#Path mystic: this works on Ubuntu
-get_filename_component(pylib_path ${PYTHON_LIBRARY} PATH)
-get_filename_component(pybin_name ${PYTHON_EXECUTABLE} NAME)
-set(pylib_dir ${pylib_path}/${pybin_name})
-set(pydist_dir /usr/local/lib/${pybin_name}/dist-packages)
-
-if(NOT EXISTS ${pydist_dir}/numpy)
     ExternalProject_Add(numpy
                         PREFIX ${CMAKE_CURRENT_BINARY_DIR}/numpy
                         URL             ${pypi}/n/numpy/${numpy}.tar.gz
@@ -35,7 +39,8 @@
                         INSTALL_COMMAND sudo python setup.py install)
 endif()
 
-if(NOT EXISTS ${pydist_dir}/scipy)
+if(NOT EXISTS ${pydist_dir}/scipy  AND BUILD_SCI_PY)
+    set(scipy scipy-0.10.0)
     ExternalProject_Add(scipy
                         PREFIX ${CMAKE_CURRENT_BINARY_DIR}/scipy
                         URL             ${pypi}/s/scipy/${scipy}.tar.gz
@@ -45,10 +50,18 @@
                         INSTALL_COMMAND sudo python setup.py install)
 endif()
                    
+
+# find install path for pykst files
+execute_process(COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/finddistdir.py
+                OUTPUT_VARIABLE pydist_dir
+                OUTPUT_STRIP_TRAILING_WHITESPACE)
+message(STATUS "Python support: installing Kst's python files into '${pydist_dir}'")
+message(STATUS)
+
 set(pykstpp_header ${CMAKE_CURRENT_BINARY_DIR}/pykstpp_h.py)
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/pykstpp_h.py.cmake ${pykstpp_header})
 
 install(FILES ${kstpydir}/pyKst/pykst.py ${kstpydir}/pyKst/pykstpp.py ${pykstpp_header} 
-        DESTINATION ${pylib_dir})
+        DESTINATION ${pydist_dir})
 
 


More information about the Kst mailing list