Skip to content

Commit

Permalink
Respond to PR comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
aliddell committed Sep 18, 2024
1 parent c7832d7 commit e546f7d
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 139 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

option(NOTEST "Disable all tests" OFF)
option(BUILD_ACQUIRE_DRIVER_ZARR "Build the Acquire Zarr driver" ON)

add_subdirectory(src)
add_subdirectory(tests)
add_subdirectory(examples)
Expand Down
6 changes: 3 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

add_subdirectory(driver)
if (BUILD_ACQUIRE_DRIVER_ZARR)
add_subdirectory(driver)
endif ()
110 changes: 53 additions & 57 deletions src/driver/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,61 +1,57 @@
option(BUILD_ACQUIRE_DRIVER_ZARR "Build the Acquire Zarr driver" ON)
if (NOT TARGET acquire-core-logger)
add_subdirectory(${CMAKE_SOURCE_DIR}/acquire-common/acquire-core-libs ${CMAKE_CURRENT_BINARY_DIR}/acquire-core-libs)
endif ()

if (BUILD_ACQUIRE_DRIVER_ZARR)
if (NOT TARGET acquire-core-logger)
add_subdirectory(${CMAKE_SOURCE_DIR}/acquire-common/acquire-core-libs ${CMAKE_CURRENT_BINARY_DIR}/acquire-core-libs)
endif ()
set(tgt acquire-driver-zarr)
add_library(${tgt} MODULE
common/dimension.hh
common/dimension.cpp
common/thread.pool.hh
common/thread.pool.cpp
common/s3.connection.hh
common/s3.connection.cpp
common/utilities.hh
common/utilities.cpp
writers/sink.hh
writers/sink.creator.hh
writers/sink.creator.cpp
writers/file.sink.hh
writers/file.sink.cpp
writers/s3.sink.hh
writers/s3.sink.cpp
writers/array.writer.hh
writers/array.writer.cpp
writers/zarrv2.array.writer.hh
writers/zarrv2.array.writer.cpp
writers/zarrv3.array.writer.hh
writers/zarrv3.array.writer.cpp
writers/blosc.compressor.hh
writers/blosc.compressor.cpp
zarr.hh
zarr.cpp
zarr.v2.hh
zarr.v2.cpp
zarr.v3.hh
zarr.v3.cpp
zarr.driver.c
)

set(tgt acquire-driver-zarr)
add_library(${tgt} MODULE
common/dimension.hh
common/dimension.cpp
common/thread.pool.hh
common/thread.pool.cpp
common/s3.connection.hh
common/s3.connection.cpp
common/utilities.hh
common/utilities.cpp
writers/sink.hh
writers/sink.creator.hh
writers/sink.creator.cpp
writers/file.sink.hh
writers/file.sink.cpp
writers/s3.sink.hh
writers/s3.sink.cpp
writers/array.writer.hh
writers/array.writer.cpp
writers/zarrv2.array.writer.hh
writers/zarrv2.array.writer.cpp
writers/zarrv3.array.writer.hh
writers/zarrv3.array.writer.cpp
writers/blosc.compressor.hh
writers/blosc.compressor.cpp
zarr.hh
zarr.cpp
zarr.v2.hh
zarr.v2.cpp
zarr.v3.hh
zarr.v3.cpp
zarr.driver.c
)
target_include_directories(${tgt} PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)

target_include_directories(${tgt} PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)
target_enable_simd(${tgt})
target_link_libraries(${tgt} PRIVATE
acquire-core-logger
acquire-core-platform
acquire-device-kit
acquire-device-properties
blosc_static
nlohmann_json::nlohmann_json
miniocpp::miniocpp
)
set_target_properties(${tgt} PROPERTIES
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>"
)

target_enable_simd(${tgt})
target_link_libraries(${tgt} PRIVATE
acquire-core-logger
acquire-core-platform
acquire-device-kit
acquire-device-properties
blosc_static
nlohmann_json::nlohmann_json
miniocpp::miniocpp
)
set_target_properties(${tgt} PROPERTIES
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>"
)

install(TARGETS ${tgt} LIBRARY DESTINATION lib)
endif ()
install(TARGETS ${tgt} LIBRARY DESTINATION lib)
4 changes: 3 additions & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
if (${NOTEST})
message(STATUS "Skipping test targets")
else ()
add_subdirectory(driver)
if (BUILD_ACQUIRE_DRIVER_ZARR)
add_subdirectory(driver)
endif ()
endif ()
154 changes: 76 additions & 78 deletions tests/driver/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,87 +1,85 @@
if (BUILD_ACQUIRE_DRIVER_ZARR)
set(NOTEST "TRUE")
add_subdirectory(${CMAKE_SOURCE_DIR}/acquire-common ${CMAKE_CURRENT_BINARY_DIR}/acquire-common)
set(NOTEST "FALSE")
set(NOTEST "TRUE")
add_subdirectory(${CMAKE_SOURCE_DIR}/acquire-common ${CMAKE_CURRENT_BINARY_DIR}/acquire-common)
set(NOTEST "FALSE")

#
# PARAMETERS
#
set(project acquire-driver-zarr) # CMAKE_PROJECT_NAME gets overridden if this is a subtree of another project
#
# PARAMETERS
#
set(project acquire-driver-zarr) # CMAKE_PROJECT_NAME gets overridden if this is a subtree of another project

#
# Tests
#
set(tests
list-devices
unit-tests
get
get-meta
get-set-get
external-metadata-with-whitespace-ok
restart-stopped-zarr-resets-threadpool
repeat-start
metadata-dimension-sizes
write-zarr-v2-raw
write-zarr-v2-raw-chunk-size-larger-than-frame-size
write-zarr-v2-raw-with-even-chunking
write-zarr-v2-raw-with-even-chunking-and-rollover
write-zarr-v2-raw-with-ragged-chunking
write-zarr-v2-with-lz4-compression
write-zarr-v2-with-zstd-compression
write-zarr-v2-compressed-with-chunking
write-zarr-v2-compressed-with-chunking-and-rollover
write-zarr-v2-raw-multiscale
write-zarr-v2-raw-multiscale-with-trivial-tile-size
write-zarr-v2-compressed-multiscale
write-zarr-v2-to-s3
multiscales-metadata
write-zarr-v3-raw
write-zarr-v3-raw-with-ragged-sharding
write-zarr-v3-raw-chunk-exceeds-array
write-zarr-v3-compressed
write-zarr-v3-raw-multiscale
write-zarr-v3-to-s3
)
#
# Tests
#
set(tests
list-devices
unit-tests
get
get-meta
get-set-get
external-metadata-with-whitespace-ok
restart-stopped-zarr-resets-threadpool
repeat-start
metadata-dimension-sizes
write-zarr-v2-raw
write-zarr-v2-raw-chunk-size-larger-than-frame-size
write-zarr-v2-raw-with-even-chunking
write-zarr-v2-raw-with-even-chunking-and-rollover
write-zarr-v2-raw-with-ragged-chunking
write-zarr-v2-with-lz4-compression
write-zarr-v2-with-zstd-compression
write-zarr-v2-compressed-with-chunking
write-zarr-v2-compressed-with-chunking-and-rollover
write-zarr-v2-raw-multiscale
write-zarr-v2-raw-multiscale-with-trivial-tile-size
write-zarr-v2-compressed-multiscale
write-zarr-v2-to-s3
multiscales-metadata
write-zarr-v3-raw
write-zarr-v3-raw-with-ragged-sharding
write-zarr-v3-raw-chunk-exceeds-array
write-zarr-v3-compressed
write-zarr-v3-raw-multiscale
write-zarr-v3-to-s3
)

foreach (name ${tests})
set(tgt "${project}-${name}")
add_executable(${tgt} ${name}.cpp)
target_compile_definitions(${tgt} PUBLIC "TEST=\"${tgt}\"")
set_target_properties(${tgt} PROPERTIES
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>"
)
target_include_directories(${tgt} PRIVATE "${CMAKE_CURRENT_LIST_DIR}/../")
target_link_libraries(${tgt}
acquire-core-logger
acquire-core-platform
acquire-video-runtime
nlohmann_json::nlohmann_json
miniocpp::miniocpp
)
foreach (name ${tests})
set(tgt "${project}-${name}")
add_executable(${tgt} ${name}.cpp)
target_compile_definitions(${tgt} PUBLIC "TEST=\"${tgt}\"")
set_target_properties(${tgt} PROPERTIES
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>"
)
target_include_directories(${tgt} PRIVATE "${CMAKE_CURRENT_LIST_DIR}/../")
target_link_libraries(${tgt}
acquire-core-logger
acquire-core-platform
acquire-video-runtime
nlohmann_json::nlohmann_json
miniocpp::miniocpp
)

add_test(NAME test-${tgt} COMMAND ${tgt})
set_tests_properties(test-${tgt} PROPERTIES LABELS "anyplatform;acquire-driver-zarr")
endforeach ()
add_test(NAME test-${tgt} COMMAND ${tgt})
set_tests_properties(test-${tgt} PROPERTIES LABELS "anyplatform;acquire-driver-zarr")
endforeach ()

#
# Copy driver to tests
#
list(POP_FRONT tests onename)
#
# Copy driver to tests
#
list(POP_FRONT tests onename)

foreach (driver
acquire-driver-common
acquire-driver-zarr
foreach (driver
acquire-driver-common
acquire-driver-zarr
)
add_custom_target(${project}-copy-${driver}-for-tests
COMMAND ${CMAKE_COMMAND} -E copy
$<TARGET_FILE:${driver}>
$<TARGET_FILE_DIR:${project}-${onename}>
DEPENDS ${driver}
COMMENT "Copying ${driver} to $<TARGET_FILE_DIR:${project}-${onename}>"
)
add_custom_target(${project}-copy-${driver}-for-tests
COMMAND ${CMAKE_COMMAND} -E copy
$<TARGET_FILE:${driver}>
$<TARGET_FILE_DIR:${project}-${onename}>
DEPENDS ${driver}
COMMENT "Copying ${driver} to $<TARGET_FILE_DIR:${project}-${onename}>"
)

foreach (name ${tests})
add_dependencies(${tgt} ${project}-copy-${driver}-for-tests)
endforeach ()
foreach (name ${tests})
add_dependencies(${tgt} ${project}-copy-${driver}-for-tests)
endforeach ()
endif ()
endforeach ()

0 comments on commit e546f7d

Please sign in to comment.