Debian Codegraph @

test/CMakeLists.txt

raw ◀ ▶
Source reconstructed at patch state 0 of 2 — not the installed (fully patched) source.
2 Debian patches touch this file
1 ## Process this file with cmake
2 #==============================================================================
3 # NeXus - Neutron & X-ray Common Data Format
4 #
5 # CMakeLists for building the NeXus library and applications.
6 #
7 # Copyright (C) 2011 Stephen Rankin
8 #
9 # This library is free software; you can redistribute it and/or modify it
10 # under the terms of the GNU Lesser General Public License as published by the
11 # Free Software Foundation; either version 2 of the License, or (at your
12 # option) any later version.
13 #
14 # This library is distributed in the hope that it will be useful, but WITHOUT
15 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
17 # for more details.
18 #
19 # You should have received a copy of the GNU Lesser General Public License
20 # along with this library; if not, write to the Free Software Foundation,
21 # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #
23 # For further information, see <http://www.nexusformat.org>
24 #
25 #
26 #==============================================================================
27
28 set(NAPITESTSRC napi_test.c)
29
30 #------------------------------------------------------------------------------
31 # Need to copy the test data files
32 #------------------------------------------------------------------------------
33 add_subdirectory(data)
34
35 include_directories(${PROJECT_SOURCE_DIR}/include )
36 link_directories(${HDF5_LIBRARY_DIRS}
37 ${HDF4_LIBRARY_DIRS}
38 ${MXML_LIBRARY_DIRS})
39
40 if (WIN32)
41 set(TESTSPATH "$ENV{HDF4_ROOT}/bin;$ENV{HDF5_ROOT}/bin;$ENV{MXML_ROOT};${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR};$ENV{PATH}")
42 STRING(REPLACE "/" "\\" TESTSPATH "${TESTSPATH}")
43 STRING(REPLACE "\\;" ";" TESTSPATH "${TESTSPATH}")
44 STRING(REPLACE ";" "\\;" TESTSPATH "${TESTSPATH}")
45 endif(WIN32)
46
47 #------------------------------------------------------------------------------
48 # In all cases we have to build the C-tests
49 #------------------------------------------------------------------------------
50 if(WITH_HDF5)
51 add_executable(napi_test_hdf5 napi_test.c)
52 target_link_libraries(napi_test_hdf5 NeXus_Shared_Library)
53 add_test(NAME "NAPI-C-HDF5-test" COMMAND napi_test_hdf5)
54
55 add_executable(napi_attra_test_hdf5 napi_attra_test.c)
56 target_link_libraries(napi_attra_test_hdf5 NeXus_Shared_Library)
57 add_test(NAME "NAPI-C-HDF5-attra-test" COMMAND napi_attra_test_hdf5)
58
59 if (WIN32)
60 set_property(TEST "NAPI-C-HDF5-test" "NAPI-C-HDF5-attra-test" APPEND PROPERTY ENVIRONMENT "PATH=${TESTSPATH}")
61 endif(WIN32)
62 endif()
63
64 if(WITH_HDF4)
65 add_executable(napi_test_hdf4 napi_test.c)
66 target_link_libraries(napi_test_hdf4 NeXus_Shared_Library)
67 add_test(NAME "NAPI-C-HDF4-test"
68 COMMAND napi_test_hdf4)
69
70 add_executable(napi_attra_test_hdf4 napi_attra_test.c)
71 target_link_libraries(napi_attra_test_hdf4 NeXus_Shared_Library)
72 add_test(NAME "NAPI-C-HDF4-attra-test" COMMAND napi_attra_test_hdf4)
73 set_tests_properties("NAPI-C-HDF4-attra-test" PROPERTIES WILL_FAIL TRUE)
74
75 if (WIN32)
76 set_property(TEST "NAPI-C-HDF4-test" "NAPI-C-HDF4-attra-test" APPEND PROPERTY ENVIRONMENT "PATH=${TESTSPATH}")
77 endif(WIN32)
78 endif()
79
80 if(WITH_MXML)
81 add_executable(napi_test-xml napi_test.c)
82 target_link_libraries(napi_test-xml NeXus_Shared_Library)
83 add_test(NAME "NAPI-C-MXML-test"
84 COMMAND napi_test-xml)
85
86 add_executable(napi_test-xml-table napi_test.c)
87 target_link_libraries(napi_test-xml-table NeXus_Shared_Library)
88 add_test(NAME "NAPI-C-MXML-TABLE-test"
89 COMMAND napi_test-xml-table)
90
91 add_executable(napi_attra_test_xml napi_attra_test.c)
92 target_link_libraries(napi_attra_test_xml NeXus_Shared_Library)
93 add_test(NAME "NAPI-C-MXML-attra-test" COMMAND napi_attra_test_xml)
94 set_tests_properties("NAPI-C-MXML-attra-test" PROPERTIES WILL_FAIL TRUE)
95
96 if (WIN32)
97 set_property(TEST "NAPI-C-MXML-test" "NAPI-C-MXML-TABLE-test" "NAPI-C-MXML-attra-test" APPEND PROPERTY ENVIRONMENT "PATH=${TESTSPATH}")
98 endif(WIN32)
99 endif()
100
101 #------------------------------------------------------------------------------
102 # (most probably a) regression test
103 #------------------------------------------------------------------------------
104 add_executable(leak_test1 leak_test1.c)
105 target_link_libraries(leak_test1 NeXus_Shared_Library)
106 add_test(NAME "NAPI-C-leak-test-1"
107 COMMAND leak_test1)
108 if (WIN32)
109 set_property(TEST "NAPI-C-leak-test-1" APPEND PROPERTY ENVIRONMENT "PATH=${TESTSPATH}")
110 endif(WIN32)
111
112 #------------------------------------------------------------------------------
113 # Add test for unlimited dimensions
114 #------------------------------------------------------------------------------
115 add_executable(test_nxunlimited test_nxunlimited.c)
116 target_link_libraries(test_nxunlimited NeXus_Shared_Library)
117 add_test(NAME "NAPI-C-test-nxunlimited"
118 COMMAND test_nxunlimited)
119 if (WIN32)
120 set_property(TEST "NAPI-C-test-nxunlimited" APPEND PROPERTY ENVIRONMENT "PATH=${TESTSPATH}")
121 endif(WIN32)
122
123
124 #------------------------------------------------------------------------------
125 # Add tests relevant to C++ bindings
126 #------------------------------------------------------------------------------
127 if(ENABLE_CXX)
128 list(APPEND NAPITESTSRC napi_test_cpp.cxx)
129 include_directories(../bindings/cpp)
130
131 if(WITH_HDF5)
132 add_executable(napi_test_cpp-hdf5 napi_test_cpp.cxx)
133 target_link_libraries(napi_test_cpp-hdf5 NeXus_CPP_Shared_Library)
134 add_test(NAME "NAPI-C++-HDF5-test" COMMAND napi_test_cpp-hdf5)
135 if (WIN32)
136 set_property(TEST "NAPI-C++-HDF5-test" APPEND PROPERTY ENVIRONMENT "PATH=${TESTSPATH}")
137 endif(WIN32)
138 endif()
139
140 if(WITH_HDF4)
141 add_executable(napi_test_cpp-hdf4 napi_test_cpp.cxx)
142 target_link_libraries(napi_test_cpp-hdf4 NeXus_CPP_Shared_Library)
143 add_test(NAME "NAPI-C++-HDF4-test" COMMAND napi_test_cpp-hdf4)
144 if (WIN32)
145 set_property(TEST "NAPI-C++-HDF4-test" APPEND PROPERTY ENVIRONMENT "PATH=${TESTSPATH}")
146 endif(WIN32)
147 endif()
148
149 if(WITH_MXML)
150 add_executable(napi_test_cpp-xml napi_test_cpp.cxx)
151 target_link_libraries(napi_test_cpp-xml NeXus_CPP_Shared_Library)
152 add_test(NAME "NAPI-C++-MXML-test" COMMAND napi_test_cpp-xml)
153 if (WIN32)
154 set_property(TEST "NAPI-C++-MXML-test" APPEND PROPERTY ENVIRONMENT "PATH=${TESTSPATH}")
155 endif(WIN32)
156
157 # add_executable(napi_test_cpp-xml-table napi_test_cpp.cxx)
158 # target_link_libraries(napi_test_cpp-xml-table NeXus_CPP_Shared_Library
159 # ${NAPI_LINK_LIBS})
160 # add_test(NAME "NAPI-C++-MXML-TABLE-test"
161 # COMMAND napi_test_cpp-xml-table)
162
163 endif()
164
165 #--------------------------------------------------------------------------
166 # build leak tests
167 #--------------------------------------------------------------------------
168 add_executable(leak_test2 leak_test2.cxx)
169 target_link_libraries(leak_test2 NeXus_CPP_Shared_Library)
170 add_test(NAME "NAPI-C++-leak-test-2"
171 COMMAND leak_test2)
172 if (WIN32)
173 set_property(TEST "NAPI-C++-leak-test-2" APPEND PROPERTY ENVIRONMENT "PATH=${TESTSPATH}")
174 endif(WIN32)
175
176 add_executable(leak_test3 leak_test3.cxx)
177 target_link_libraries(leak_test3 NeXus_CPP_Shared_Library)
178 add_test(NAME "NAPI-C++-leak-test-3"
179 COMMAND leak_test3)
180 if (WIN32)
181 set_property(TEST "NAPI-C++-leak-test-3" APPEND PROPERTY ENVIRONMENT "PATH=${TESTSPATH}")
182 endif(WIN32)
183 endif()
184
185 if(ENABLE_FORTRAN77)
186 include_directories(${PROJECT_BINARY_DIR}/bindings/f77)
187 include_directories(${PROJECT_SOURCE_DIR}/bindings/f77)
188
189 if(WITH_HDF4)
190 add_executable(napif4_test napif4_test.f)
191 target_link_libraries(napif4_test NeXus_F77_Shared_Library)
192 add_test(NAME "NAPI-F77-HDF4-test"
193 COMMAND napif4_test)
194 endif()
195
196 if(WITH_HDF5)
197 add_executable(napif5_test napif5_test.f)
198 target_link_libraries(napif5_test NeXus_F77_Shared_Library)
199 add_test(NAME "NAPI-F77-HDF5-test"
200 COMMAND napif5_test)
201 endif()
202
203 if(WITH_MXML)
204 add_executable(napif_test napif_test.f)
205 target_link_libraries(napif_test NeXus_F77_Shared_Library)
206 add_test(NAME "NAPI-F77-XML-test"
207 COMMAND napif_test)
208 endif()
209
210 endif()
211
212 if(ENABLE_FORTRAN90)
213 #need to add the directory with the .mod files to the include path
214 include_directories(${PROJECT_BINARY_DIR}/bindings/f90)
215 add_executable(NXtestf90 NXtest.f90)
216 target_link_libraries(NXtestf90 NeXus_F90_Shared_Library)
217 add_test(NAME "Fortran-90-test" COMMAND NXtestf90)
218 endif()
219
220