IF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.9)
# We need to pass that to swig to be sure all modules are generated in the proper dir
- SET(CMAKE_SWIG_FLAGS "-outdir ${GDCM_BINARY_DIR}/bin")
+ SET(CMAKE_SWIG_FLAGS "-outdir ${GDCM_BINARY_DIR}/gdcmPython")
# Looks like a bug to me in cmake 2.0.x:
SEPARATE_ARGUMENTS(CMAKE_SWIG_FLAGS)
ENDIF (GDCM_WRAP_PYTHON)
ENDIF(GDCM_VTK)
- # generate a setup.py according to VTK installation
- # put it in subdir in order to not override old one
-
- GET_FILENAME_COMPONENT(VTKPATH ${VTK_DIR}/../../ ABSOLUTE)
- CONFIGURE_FILE(
- ${GDCM_SOURCE_DIR}/gdcmPython/setup.py.in
- ${GDCM_BINARY_DIR}/setup.py
- )
+# generate a setup.py according to VTK installation
+# put it in subdir in order to not override old one
+
+GET_FILENAME_COMPONENT(VTKPATH ${VTK_DIR}/../../ ABSOLUTE)
+CONFIGURE_FILE(
+ ${GDCM_SOURCE_DIR}/gdcmPython/setup.py.in
+ ${GDCM_BINARY_DIR}/setup.py
+)
#-----------------------------------------------------------------------------
# Install stuff:
# Create a gdcm.pth file:
+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"
+ " ]\n"
+ )
+
+FILE(WRITE ${GDCM_BINARY_DIR}/gdcmPython/core.py
"import gdcm\n"
+ "GDCM_DATA_PATH =\"${GDCM_DATA_ROOT}\"\n"
+ "GDCM_TEST_DATA_PATH=\"${GDCM_DATA_ROOT}\"\n"
)
IF(GDCM_VTK)
- FILE(APPEND ${GDCM_BINARY_DIR}/gdcmPython/__init__.py
+ FILE(WRITE ${GDCM_BINARY_DIR}/gdcmPython/vtk.py
"import os\n"
"if os.name == 'posix':\n"
" from libvtkgdcmPython import *\n"
"else:\n"
" from vtkgdcmPython import *\n"
+ "GDCM_DATA_PATH =\"${GDCM_DATA_ROOT}\"\n"
+ "GDCM_TEST_DATA_PATH=\"${GDCM_DATA_ROOT}\"\n"
)
ENDIF(GDCM_VTK)
+#-----------------------------------------------------------------------------
+# Copy the testSuite.py file
+CONFIGURE_FILE(
+ ${GDCM_SOURCE_DIR}/gdcmPython/testSuite.py
+ ${GDCM_BINARY_DIR}/gdcmPython/testSuite.py
+ COPYONLY
+)
+
#-----------------------------------------------------------------------------
# Add test from demo subdir:
# Python testing directory, 'demo' is not very explicit ...
+#-----------------------------------------------------------------------------
# DOH! python is not found by default
FIND_PROGRAM(PYTHON_EXECUTABLE
- NAMES python2.3 python2.2 python2.1 python2.0 python1.6 python1.5 python
+ NAMES python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5 python
PATHS
+ [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]
MARK_AS_ADVANCED(PYTHON_EXECUTABLE)
IF(PYTHON_EXECUTABLE)
- ADD_TEST(PrintHeader-Python ${PYTHON_EXECUTABLE}
+ ADD_TEST(Python-PrintHeader ${PYTHON_EXECUTABLE}
${GDCM_SOURCE_DIR}/gdcmPython/demo/PrintHeader.py
)
ELSE(PYTHON_EXECUTABLE)
MESSAGE(FATAL_ERROR "You requested testing for python, but python was not
found")
ENDIF(PYTHON_EXECUTABLE)
+
+#-----------------------------------------------------------------------------
+# Copy all the demo directory content to the cmake bin
+# Without it, tests can't be launched
+CONFIGURE_FILE(
+ ${GDCM_SOURCE_DIR}/gdcmPython/demo/PrintHeader.py
+ ${GDCM_BINARY_DIR}/gdcmPython/demo/PrintHeader.py
+ COPYONLY
+)
+
Program: gdcm
Module: $RCSfile: gdcmDict.cxx,v $
Language: C++
- Date: $Date: 2005/01/08 15:03:59 $
- Version: $Revision: 1.61 $
+ Date: $Date: 2005/01/12 15:23:44 $
+ Version: $Revision: 1.62 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
}
Filename = filename;
+ from.close();
}
- from.close();
}
/**