X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=gdcmPython%2FCMakeLists.txt;h=b1e671f5fb1670ffd38d831696ee8346aa0d8de9;hb=0fe2afcdd153ff2ee8f3ba2b4b02478e154a57df;hp=c5488ece24e5a5e9eaa2aea9c49582b1c3766238;hpb=f51f3cf0f4013935c1d93a828779e5ca285a31fc;p=gdcm.git diff --git a/gdcmPython/CMakeLists.txt b/gdcmPython/CMakeLists.txt index c5488ece..b1e671f5 100644 --- a/gdcmPython/CMakeLists.txt +++ b/gdcmPython/CMakeLists.txt @@ -136,6 +136,7 @@ ELSE(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.9) ENDIF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.9) +INSTALL_TARGETS(/lib/gdcm/ _gdcm) #----------------------------------------------------------------------------- # VTK Wrapping @@ -171,6 +172,8 @@ IF(GDCM_VTK) vtkgdcm vtkCommonPython vtkIOPython) + INSTALL_TARGETS(/lib/gdcm/ vtkgdcmPython) + ENDIF (GDCM_WRAP_PYTHON) ENDIF(GDCM_VTK) @@ -184,22 +187,11 @@ ENDIF(GDCM_VTK) #) #----------------------------------------------------------------------------- -# Install stuff: - -# Cmake cannot handle installing since python wants stuff to be installed -# in /usr/lib/pythonx.x/site-package and not a a std /usr/lib -# Thus generate a setup.py file using distutils - -# Create a gdcm.pth file: - +# Python package configuration FILE(WRITE ${GDCM_BINARY_DIR}/gdcmPython/gdcmVersion.py "gdcmVERSION=\"${GDCM_VERSION}\"\n" ) -FILE(WRITE ${GDCM_BINARY_DIR}/gdcmPython/gdcm.pth - "gdcmPython\n" - ) - FILE(WRITE ${GDCM_BINARY_DIR}/gdcmPython/__init__.py "__all__ = [\"core\",\n" " \"vtk\",\n" @@ -207,6 +199,7 @@ FILE(WRITE ${GDCM_BINARY_DIR}/gdcmPython/__init__.py ) FILE(WRITE ${GDCM_BINARY_DIR}/gdcmPython/core.py + "from gdcmVersion import *\n" "import gdcm\n" "GDCM_DATA_ROOT = \"${GDCM_DATA_ROOT}\"\n" ) @@ -214,6 +207,7 @@ FILE(WRITE ${GDCM_BINARY_DIR}/gdcmPython/core.py IF(GDCM_VTK) FILE(WRITE ${GDCM_BINARY_DIR}/gdcmPython/vtk.py "import os\n" + "from gdcmVersion import *\n" "if os.name == 'posix':\n" " from libvtkgdcmPython import *\n" "else:\n" @@ -222,6 +216,40 @@ IF(GDCM_VTK) ) ENDIF(GDCM_VTK) +#----------------------------------------------------------------------------- +# Python installation +IF(WIN32) + FILE(WRITE ${GDCM_BINARY_DIR}/gdcmPython/gdcmPython.pth + "${GDCM_BINARY_DIR}\n" + "${GDCM_BINARY_DIR}/bin/release\n" + ) +ELSE(WIN32) + FILE(WRITE ${GDCM_BINARY_DIR}/gdcmPython/gdcmPython.pth + "${CMAKE_INSTALL_PREFIX}/lib/gdcm\n" + ) +ENDIF(WIN32) +FIND_PATH(PYTHON_INSTALL "site-packages" + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.2\\InstallPath] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.1\\InstallPath] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.0\\InstallPath] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.6\\InstallPath] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.5\\InstallPath] + /usr/lib/python2.4 + /usr/lib/python2.3 + /usr/lib/python2.2 + /usr/lib/python2.1 + /usr/lib/python2.0 + /usr/lib/python1.6 + /usr/lib/python1.5 +) +STRING(REGEX REPLACE "/usr(.*)/config.*" "\\1" PYTHON_INSTALL ${PYTHON_LIBRARY}) + +INSTALL_FILES(${PYTHON_INSTALL}/site-packages "\\.pth$") +INSTALL_FILES(/lib/gdcm/gdcmPython "\\.py$") +INSTALL_FILES(/lib/gdcm/gdcmPython FILES "gdcm.py") + #----------------------------------------------------------------------------- # Add test from demo subdir: