]> Creatis software - gdcm.git/blob - gdcmPython/demo/CMakeLists.txt
BUG: backport from gdcm 1.2. Should not crash when jpeg was not instanciated
[gdcm.git] / gdcmPython / demo / CMakeLists.txt
1 # Python testing directory, 'demo' is not very explicit ...
2
3 #-----------------------------------------------------------------------------
4 # DOH! python is not found by default
5 FIND_PROGRAM(PYTHON_EXECUTABLE
6     NAMES python python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5
7     PATHS
8     [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath]    
9     [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]
10     [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]
11     [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.2\\InstallPath]
12     [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.1\\InstallPath]
13     [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.0\\InstallPath]
14     [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.6\\InstallPath]
15     [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.5\\InstallPath]
16 )
17 MARK_AS_ADVANCED(PYTHON_EXECUTABLE)
18
19 IF(PYTHON_EXECUTABLE)
20   ADD_TEST(Python-PrintDict ${PYTHON_EXECUTABLE}
21     ${GDCM_BINARY_DIR}/gdcmPython/demo/PrintDict.py
22     )
23   ADD_TEST(Python-PrintFile ${PYTHON_EXECUTABLE}
24     ${GDCM_BINARY_DIR}/gdcmPython/demo/PrintFile.py
25     )
26   ADD_TEST(Python-PrintDicomDir ${PYTHON_EXECUTABLE}
27     ${GDCM_BINARY_DIR}/gdcmPython/demo/PrintDicomDir.py
28     )
29   ADD_TEST(Python-MakeDicomDir ${PYTHON_EXECUTABLE}
30     ${GDCM_BINARY_DIR}/gdcmPython/demo/PrintDicomDir.py
31     )
32 ELSE(PYTHON_EXECUTABLE)
33   MESSAGE(FATAL_ERROR "You requested testing for python, but python was not
34     found")
35 ENDIF(PYTHON_EXECUTABLE)
36
37 #-----------------------------------------------------------------------------
38 # Copy all the demo directory content to the cmake bin 
39 # Without it, tests can't be launched
40 CONFIGURE_FILE(
41     ${GDCM_SOURCE_DIR}/gdcmPython/demo/gdcmConfigDemo.py.in
42     ${GDCM_BINARY_DIR}/gdcmPython/demo/gdcmConfigDemo.py
43 )
44
45 CONFIGURE_FILE(
46     ${GDCM_SOURCE_DIR}/gdcmPython/demo/PrintFile.py.in
47     ${GDCM_BINARY_DIR}/gdcmPython/demo/PrintFile.py
48 )
49
50 CONFIGURE_FILE(
51     ${GDCM_SOURCE_DIR}/gdcmPython/demo/PrintDicomDir.py.in
52     ${GDCM_BINARY_DIR}/gdcmPython/demo/PrintDicomDir.py
53 )
54
55 CONFIGURE_FILE(
56     ${GDCM_SOURCE_DIR}/gdcmPython/demo/MakeDicomDir.py.in
57     ${GDCM_BINARY_DIR}/gdcmPython/demo/MakeDicomDir.py
58 )
59
60 CONFIGURE_FILE(
61     ${GDCM_SOURCE_DIR}/gdcmPython/demo/PrintDict.py.in
62     ${GDCM_BINARY_DIR}/gdcmPython/demo/PrintDict.py
63 )
64
65 INSTALL_FILES(/lib/gdcm/gdcmPython/demo FILES 
66    "${GDCM_BINARY_DIR}/gdcmPython/demo/PrintFile.py"
67    "${GDCM_BINARY_DIR}/gdcmPython/demo/PrintDicomDir.py"
68    "${GDCM_BINARY_DIR}/gdcmPython/demo/PrintDict.py"
69 )
70
71 #-----------------------------------------------------------------------------
72 # Same but for VTK
73 IF(GDCM_VTK)
74   IF(PYTHON_EXECUTABLE)
75     ADD_TEST(Python-VTK-Reader ${PYTHON_EXECUTABLE}
76         ${GDCM_BINARY_DIR}/gdcmPython/demo/vtkGdcmReader.py
77     )
78     ADD_TEST(Python-VTK-Writer ${PYTHON_EXECUTABLE}
79         ${GDCM_BINARY_DIR}/gdcmPython/demo/vtkGdcmWriter.py
80     )
81   ENDIF(PYTHON_EXECUTABLE)
82
83   CONFIGURE_FILE(
84       ${GDCM_SOURCE_DIR}/gdcmPython/demo/vtkGdcmReader.py.in
85       ${GDCM_BINARY_DIR}/gdcmPython/demo/vtkGdcmReader.py
86   )
87
88   CONFIGURE_FILE(
89       ${GDCM_SOURCE_DIR}/gdcmPython/demo/vtkGdcmWriter.py.in
90       ${GDCM_BINARY_DIR}/gdcmPython/demo/vtkGdcmWriter.py
91   )
92
93   INSTALL_FILES(/lib/gdcm/gdcmPython/demo FILES 
94      "${GDCM_BINARY_DIR}/gdcmPython/demo/vtkGdcmReader.py"
95      "${GDCM_BINARY_DIR}/gdcmPython/demo/vtkGdcmWriter.py"
96   )
97
98 ENDIF(GDCM_VTK)
99
100 #-----------------------------------------------------------------------------
101