28
28
29
29
find_package (Catch2 REQUIRED )
30
30
31
- # Arrow integration test config and dependencies
32
- # Override from environment if not set in cache
33
- if (NOT DEFINED $CACHE{TILEDB_ARROW_TESTS} )
34
- if ($ENV{TILEDB_ARROW_TESTS} )
35
- message (STATUS "Enabling Apache Arrow integration test" )
36
- # Technically this would be an "option", but we want conditional override from ENV
37
- set (TILEDB_ARROW_TESTS ON CACHE BOOL "Enable Arrow tests (requires Python with pyarrow and numpy)" FORCE )
38
- mark_as_advanced (TILEDB_ARROW_TESTS )
39
- endif ()
40
- endif ()
41
-
42
- if (${TILEDB_ARROW_TESTS} )
43
- # Reworked FindPython was introducted in 3.12 with features used below
44
- if (CMAKE_VERSION VERSION_LESS "3.12" )
45
- message (FATAL_ERROR "CMake >= 3.12 is required for TileDB Arrow Tests. (found ${CMAKE_VERSION} )" )
46
- endif ()
47
- # Tell CMake to check the Python registry entry last on Windows
48
- set (Python_FIND_REGISTRY "LAST" )
49
- # Tell CMake to prefer Python from the PATH
50
- set (Python_FIND_STRATEGY "LOCATION" )
51
- find_package (Python COMPONENTS Interpreter Development REQUIRED )
52
- find_package (pybind11 )
53
-
54
- message (STATUS "Configuring Apache Arrow integration test with Python ${Python_VERSION} (${Python_EXECUTABLE} )" )
55
-
56
- # If we can't find the pybind11 cmake config (not available in pypi yet)
57
- # try to find with the current executable.
58
- if (NOT ${pybind11_FOUND} )
59
- # Get the include arguments from the python executable (has "-I" compiler option)
60
- execute_process (COMMAND ${Python_EXECUTABLE} -m pybind11 --includes
61
- OUTPUT_VARIABLE CMD_PYBIND11_INCLUDE
62
- RESULT_VARIABLE CMD_PYBIND11_RESULT
63
- OUTPUT_STRIP_TRAILING_WHITESPACE )
64
- if (${CMD_PYBIND11_RESULT} )
65
- message (FATAL_ERROR "Unable to find pybind11 via cmake or 'python3 -m pybind11 --includes'" )
66
- endif ()
67
-
68
- # Convert args to list
69
- separate_arguments (CMD_PARSED_INCLUDES NATIVE_COMMAND ${CMD_PYBIND11_INCLUDE} )
70
- # Remove the "-I" from each include
71
- foreach (INCL_PATH IN LISTS CMD_PARSED_INCLUDES )
72
- string (REPLACE "-I" "" INCL_PATH ${INCL_PATH} )
73
- list (APPEND PYBIND11_INCLUDE_DIRECTORIES ${INCL_PATH} )
74
- endforeach ()
75
-
76
- file (TO_CMAKE_PATH "${Python_SITELIB} " SAFE_Python_SITELIB )
77
- set (pybind11_FOUND TRUE CACHE BOOL "pybind11 include path found" )
78
- add_library (pybind11::embed INTERFACE IMPORTED )
79
- target_include_directories (pybind11::embed INTERFACE ${PYBIND11_INCLUDE_DIRECTORIES} )
80
- target_link_libraries (pybind11::embed INTERFACE Python::Python )
81
- target_compile_definitions (pybind11::embed INTERFACE -DTILEDB_PYTHON_SITELIB_PATH= "${SAFE_Python_SITELIB} " )
82
- endif ()
83
- file (TO_CMAKE_PATH ${CMAKE_CURRENT_BINARY_DIR} SAFE_CURRENT_BINARY_DIR )
84
- target_compile_definitions (pybind11::embed INTERFACE -DTILEDB_PYTHON_UNIT_PATH= "${SAFE_CURRENT_BINARY_DIR} " )
85
- endif ()
86
-
87
31
# Include TileDB core header directories
88
32
set (TILEDB_CORE_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR} /.." )
89
33
# Include the C API directory so that the C++ 'tiledb' file can directly
@@ -259,17 +203,15 @@ if (TILEDB_SERIALIZATION)
259
203
)
260
204
endif ()
261
205
262
- if (TILEDB_ARROW_TESTS )
263
- list (APPEND TILEDB_UNIT_TEST_SOURCES
264
- src/unit-arrow.cc
265
- ${CMAKE_SOURCE_DIR} /tiledb/sm/cpp_api/arrow_io_impl.h
266
- )
267
- endif ()
268
-
269
206
if (TILEDB_VERBOSE )
270
207
add_definitions (-DTILEDB_VERBOSE )
271
208
endif ()
272
209
210
+ # We want tests to continue as normal even as the API is changing,
211
+ # so don't warn for deprecations, since they'll be escalated to errors.
212
+ if (NOT MSVC )
213
+ add_compile_options (-Wno-deprecated-declarations )
214
+ endif ()
273
215
274
216
# unit test executable
275
217
add_executable (
@@ -279,16 +221,8 @@ add_executable(
279
221
"src/unit.cc"
280
222
)
281
223
282
- add_dependencies (tiledb_unit tiledb_test_support_lib )
283
-
284
224
target_compile_options (tiledb_unit PRIVATE "$<$<CXX_COMPILER_ID:MSVC>:/utf-8>" )
285
225
286
- # We want tests to continue as normal even as the API is changing,
287
- # so don't warn for deprecations, since they'll be escalated to errors.
288
- if (NOT MSVC )
289
- target_compile_options (tiledb_unit PRIVATE -Wno-deprecated-declarations )
290
- endif ()
291
-
292
226
target_include_directories (
293
227
tiledb_unit BEFORE PRIVATE
294
228
${TILEDB_CORE_INCLUDE_DIR}
@@ -329,13 +263,6 @@ if (TILEDB_SERIALIZATION)
329
263
target_compile_definitions (tiledb_unit PRIVATE -DTILEDB_SERIALIZATION )
330
264
endif ()
331
265
332
- if (TILEDB_ARROW_TESTS )
333
- target_link_libraries (tiledb_unit PRIVATE pybind11::embed )
334
-
335
- # install the python helper next to the executable for import
336
- configure_file ("${CMAKE_CURRENT_SOURCE_DIR} /src/unit_arrow.py" "${CMAKE_CURRENT_BINARY_DIR} " COPYONLY )
337
- endif ()
338
-
339
266
if (TILEDB_WEBP )
340
267
target_compile_definitions (tiledb_unit PRIVATE -DTILEDB_WEBP )
341
268
find_package (ZLIB ) # We need PNG to use our Zlib so that static link works correctly if applicable
@@ -363,6 +290,50 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux" AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU
363
290
)
364
291
endif ()
365
292
293
+ if (TILEDB_ARROW_TESTS )
294
+ # Tell CMake to check the Python registry entry last on Windows
295
+ set (Python_FIND_REGISTRY "LAST" )
296
+ # Tell CMake to prefer Python from the PATH
297
+ set (Python_FIND_STRATEGY "LOCATION" )
298
+ find_package (Python COMPONENTS Interpreter Development REQUIRED )
299
+ find_package (pybind11 REQUIRED )
300
+ message (STATUS "Configuring Apache Arrow integration test with Python ${Python_VERSION} (${Python_EXECUTABLE} )" )
301
+
302
+ add_executable (
303
+ unit_arrow EXCLUDE_FROM_ALL
304
+ $< TARGET_OBJECTS:TILEDB_CORE_OBJECTS>
305
+ src/unit-arrow.cc
306
+ ${CMAKE_SOURCE_DIR} /tiledb/sm/cpp_api/arrow_io_impl.h
307
+ )
308
+
309
+ target_link_libraries (unit_arrow
310
+ PUBLIC
311
+ TILEDB_CORE_OBJECTS_ILIB
312
+ TILEDB_CORE_OBJECTS
313
+ Catch2::Catch2WithMain
314
+ pybind11::embed
315
+ tiledb_test_support_lib
316
+ configuration_definitions
317
+ )
318
+
319
+ file (TO_CMAKE_PATH ${CMAKE_CURRENT_BINARY_DIR} SAFE_CURRENT_BINARY_DIR )
320
+ target_compile_definitions (unit_arrow PRIVATE -DTILEDB_PYTHON_UNIT_PATH= "${SAFE_CURRENT_BINARY_DIR} " )
321
+ # install the python helper next to the executable for import
322
+ configure_file ("${CMAKE_CURRENT_SOURCE_DIR} /src/unit_arrow.py" "${CMAKE_CURRENT_BINARY_DIR} " COPYONLY )
323
+
324
+ target_include_directories (
325
+ unit_arrow BEFORE PRIVATE
326
+ ${TILEDB_CORE_INCLUDE_DIR}
327
+ ${TILEDB_EXPORT_HEADER_DIR}
328
+ )
329
+
330
+ add_test (
331
+ NAME "unit_arrow"
332
+ COMMAND unit_arrow --durations=yes
333
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
334
+ )
335
+ endif ()
336
+
366
337
# Only produce timing tests for UNIX based systems (faketime constraint)
367
338
find_library (
368
339
LIBFAKETIME
0 commit comments