From 4c2eb72bc703f904bc9bf4c84f6673c46495146e Mon Sep 17 00:00:00 2001 From: Hadrien Mary Date: Tue, 14 Jan 2025 12:43:07 -0500 Subject: [PATCH] add tiledbsoma --- recipes/tiledbsoma/fix-lib-build.patch | 69 +++++++++ recipes/tiledbsoma/recipe.yaml | 199 +++++++++++++++++++++++++ 2 files changed, 268 insertions(+) create mode 100644 recipes/tiledbsoma/fix-lib-build.patch create mode 100644 recipes/tiledbsoma/recipe.yaml diff --git a/recipes/tiledbsoma/fix-lib-build.patch b/recipes/tiledbsoma/fix-lib-build.patch new file mode 100644 index 0000000000000..019d6c134d27a --- /dev/null +++ b/recipes/tiledbsoma/fix-lib-build.patch @@ -0,0 +1,69 @@ +diff --git a/libtiledbsoma/src/CMakeLists.txt b/libtiledbsoma/src/CMakeLists.txt +index a6d233df..e797559b 100644 +--- a/libtiledbsoma/src/CMakeLists.txt ++++ b/libtiledbsoma/src/CMakeLists.txt +@@ -258,6 +258,13 @@ install(FILES + DESTINATION "include/tiledbsoma/nlohmann" + ) + ++install(FILES ++ ${CMAKE_CURRENT_SOURCE_DIR}/external/include/thread_pool/producer_consumer_queue.h ++ ${CMAKE_CURRENT_SOURCE_DIR}/external/include/thread_pool/status.h ++ ${CMAKE_CURRENT_SOURCE_DIR}/external/include/thread_pool/thread_pool.h ++ DESTINATION "include/tiledbsoma/thread_pool" ++) ++ + + # ########################################################### + # API symbol exports +@@ -300,6 +307,10 @@ endif() + # CLI executable target + # ########################################################### + if(TILEDBSOMA_BUILD_CLI) ++ ++ # Add this before including spdlog headers ++ add_definitions(-DSPDLOG_COMPILED_LIB) ++ + add_executable(tiledbsoma-cli + ${CMAKE_CURRENT_SOURCE_DIR}/cli/cli.cc + $ +@@ -335,6 +346,13 @@ if(TILEDBSOMA_BUILD_CLI) + ${TILEDB_SOMA_EXPORT_HEADER_DIR} + ${pybind11_INCLUDE_DIRS} + ) ++ ++ # Ensure spdlog is properly linked ++ target_link_libraries(tiledbsoma PRIVATE spdlog::spdlog) ++ ++ # Ensure proper visibility settings ++ set(CMAKE_CXX_VISIBILITY_PRESET hidden) ++ + endif() + + # ########################################################### +diff --git a/libtiledbsoma/src/utils/fastercsx.h b/libtiledbsoma/src/utils/fastercsx.h +index 7cb460ae..7584b65c 100644 +--- a/libtiledbsoma/src/utils/fastercsx.h ++++ b/libtiledbsoma/src/utils/fastercsx.h +@@ -35,7 +35,7 @@ + #include + #include + #include +-#include "span/span.hpp" ++#include "tiledbsoma/soma/span/span.hpp" + + #include "parallel_functions.h" + +diff --git a/libtiledbsoma/src/utils/parallel_functions.h b/libtiledbsoma/src/utils/parallel_functions.h +index 77d3ad41..b408b5f7 100644 +--- a/libtiledbsoma/src/utils/parallel_functions.h ++++ b/libtiledbsoma/src/utils/parallel_functions.h +@@ -33,7 +33,7 @@ + #ifndef TILEDB_PARALLEL_FUNCTIONS_H + #define TILEDB_PARALLEL_FUNCTIONS_H + +-#include ++#include "tiledbsoma/thread_pool/thread_pool.h" + + #include + #include diff --git a/recipes/tiledbsoma/recipe.yaml b/recipes/tiledbsoma/recipe.yaml new file mode 100644 index 0000000000000..f8abeff0be092 --- /dev/null +++ b/recipes/tiledbsoma/recipe.yaml @@ -0,0 +1,199 @@ +context: + name: tiledbsoma + version: 1.15.3 + +recipe: + name: ${{ name|lower }} + version: ${{ version }} + +source: + url: https://github.com/single-cell-data/TileDB-SOMA/archive/refs/tags/${{ version }}.zip + sha256: 1c9b60b14c900e252c30586fcadaeddd455d58df624112ecea62eef24212dc61 + patches: + # NOTE: + # - fix failing includes + # - fix failing linking configuration for tiledbsoma-cli and spdlog + - fix-lib-build.patch + +build: + number: 0 + skip: win + +outputs: + # C++ library + - package: + name: libtiledbsoma + + build: + script: | + # Configure + cmake -G Ninja \ + ${CMAKE_ARGS} \ + -DCMAKE_BUILD_TYPE="Release" \ + -DCMAKE_INSTALL_PREFIX=${PREFIX} \ + -DDOWNLOAD_TILEDB_PREBUILT=OFF \ + -DOVERRIDE_INSTALL_PREFIX=OFF \ + -DFORCE_BUILD_TILEDB=OFF \ + -DTILEDBSOMA_BUILD_PYTHON=ON \ + -DTILEDBSOMA_BUILD_CLI=ON \ + -DTILEDBSOMA_ENABLE_TESTING=OFF \ + -DTILEDBSOMA_ENABLE_WERROR=OFF \ + -DTileDB_DIR="${PREFIX}" \ + -B build/ \ + -S $SRC_DIR/libtiledbsoma + + # Compile + cmake --build build/ -j ${CPU_COUNT} + + # Install + cmake --build build/ -j ${CPU_COUNT} --target install-libtiledbsoma + + requirements: + build: + - ${{ compiler('cxx') }} + - ${{ stdlib("c") }} + - cmake >=3.21 + - ninja + - pkg-config + host: + - tiledb + - spdlog >=1.15 + - fmt >=11.0 + run_exports: + - ${{ pin_subpackage('libtiledbsoma', exact=True) }} + + tests: + - script: + - tdbsoma + - package_contents: + files: + - lib/cmake/tiledbsoma/TileDBSomaConfig.cmake + - lib/cmake/tiledbsoma/TileDBSomaTargets-release.cmake + - lib/cmake/tiledbsoma/TileDBSomaTargets.cmake + bin: + - tdbsoma + lib: + - tiledbsoma + include: + - tiledbsoma/nanoarrow/nanoarrow.h + - tiledbsoma/nanoarrow/nanoarrow.hpp + - tiledbsoma/nlohmann/json.hpp + - tiledbsoma/reindexer/reindexer.h + - tiledbsoma/soma/array_buffers.h + - tiledbsoma/soma/column_buffer.h + - tiledbsoma/soma/enums.h + - tiledbsoma/soma/logger_public.h + - tiledbsoma/soma/managed_query.h + - tiledbsoma/soma/soma_array.h + - tiledbsoma/soma/soma_collection.h + - tiledbsoma/soma/soma_context.h + - tiledbsoma/soma/soma_dataframe.h + - tiledbsoma/soma/soma_dense_ndarray.h + - tiledbsoma/soma/soma_experiment.h + - tiledbsoma/soma/soma_geometry_dataframe.h + - tiledbsoma/soma/soma_group.h + - tiledbsoma/soma/soma_measurement.h + - tiledbsoma/soma/soma_multiscale_image.h + - tiledbsoma/soma/soma_object.h + - tiledbsoma/soma/soma_point_cloud_dataframe.h + - tiledbsoma/soma/soma_scene.h + - tiledbsoma/soma/soma_sparse_ndarray.h + - tiledbsoma/soma/span/span.hpp + - tiledbsoma/tiledbsoma + - tiledbsoma/tiledbsoma_export.h + - tiledbsoma/utils/arrow_adapter.h + - tiledbsoma/utils/common.h + - tiledbsoma/utils/fastercsx.h + - tiledbsoma/utils/parallel_functions.h + - tiledbsoma/utils/stats.h + - tiledbsoma/utils/util.h + - tiledbsoma/utils/version.h + + # python bindings + - package: + name: tiledbsoma + + build: + script: | + # Set the version + echo "${PKG_VERSION}" > ${SRC_DIR}/apis/python/RELEASE-VERSION + + # Define prefix for tiledb and tiledbsoma + export TILEDB_PATH="$PREFIX" + export TILEDBSOMA_PATH="$PREFIX" + + # Use Ninja + export CMAKE_GENERATOR="Ninja" + + # Build the python binding + ${{ PYTHON }} -m pip install apis/python/ -vv --no-deps --no-build-isolation + + requirements: + build: + - if: build_platform != target_platform + then: + - python + - cross-python_${{ target_platform }} + - pybind11 >=2.10.0 + + - ${{ compiler('cxx') }} + - ${{ stdlib("c") }} + - cmake >=3.21 + - ninja + - pkg-config + - git + host: + - python + - setuptools >=70.1 + - pip + - pybind11 >=2.10.0 + # libraries + - libtiledbsoma + - tiledb + run: + - python + - anndata >=0.10.1 + - attrs >=22.2 + - numpy + - pandas + - pyarrow + - scanpy >=1.9.2 + - scipy + - somacore ==1.0.26 + - typing_extensions + + tests: + - python: + imports: + - tiledbsoma + pip_check: true + - requirements: + run: + - pytest + - typeguard + files: + source: + - apis/python/tests/ + script: | + # NOTE: we only test a subset of the test suite to avoid long build times but + # still make sure the package is working. + pytest -vvv \ + apis/python/tests/test_experiment_basic.py \ + apis/python/tests/test_type_system.py \ + apis/python/tests/test_stats.py \ + apis/python/tests/test_simple.py \ + apis/python/tests/test_scene.py \ + apis/python/tests/test_reindexer_api.py \ + apis/python/tests/test_regression.py \ + apis/python/tests/test_point_cloud_dataframe.py + +about: + summary: Python and R SOMA APIs using TileDB's cloud-native format. Ideal for single-cell data at any scale. + license: MIT + license_file: LICENSE + homepage: https://github.com/single-cell-data/TileDB-SOMA/ + +extra: + feedstock-name: tiledbsoma + recipe-maintainers: + - hadim