-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
112 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/bin/bash | ||
|
||
set -xe | ||
|
||
BUILD_DIR="${SRC_DIR}/build" | ||
|
||
# Detect OS and architecture | ||
OS=$(uname -s) | ||
ARCH=$(uname -m) | ||
|
||
# Set LDFLAGS for macOS to avoid GNU-style linker flags | ||
if [ "$OS" = "Darwin" ]; then | ||
# Save original LDFLAGS | ||
OLD_LDFLAGS="$LDFLAGS" | ||
# Remove GNU-style linker flags for meson | ||
export LDFLAGS=$(echo $LDFLAGS | sed 's/-Wl,--version//g') | ||
fi | ||
|
||
# Run meson | ||
meson setup --prefix=${PREFIX} --buildtype=release "${BUILD_DIR}" | ||
meson install -C "${BUILD_DIR}" | ||
|
||
# Restore original LDFLAGS if on macOS | ||
if [ "$OS" = "Darwin" ]; then | ||
export LDFLAGS="$OLD_LDFLAGS" | ||
fi | ||
|
||
# Base compilation flags | ||
COMPILE_FLAGS="-O3 -Wall -shared -std=c++17 -fPIC $(python3 -m pybind11 --includes) \ | ||
-I${SRC_DIR}/pybind \ | ||
-I${SRC_DIR}/include \ | ||
-I${PREFIX}/include \ | ||
-L${PREFIX}/lib" | ||
|
||
# Add platform-specific flags | ||
if [ "$OS" = "Darwin" ]; then | ||
# macOS specific flags | ||
COMPILE_FLAGS="$COMPILE_FLAGS -undefined dynamic_lookup" | ||
if [ "$ARCH" = "arm64" ]; then | ||
# Additional arm64 specific flags for conda-build | ||
COMPILE_FLAGS="$COMPILE_FLAGS -mmacosx-version-min=11.0" | ||
else | ||
# x86_64 specific flags | ||
COMPILE_FLAGS="$COMPILE_FLAGS -mmacosx-version-min=10.15" | ||
fi | ||
fi | ||
|
||
# Create lib directory if it doesn't exist | ||
mkdir -p ${PREFIX}/lib | ||
|
||
# Build the extension directly in the lib directory | ||
$CXX $COMPILE_FLAGS pybind/bindings.cpp -o ${PREFIX}/lib/digest$(python3-config --extension-suffix) | ||
|
||
# Create the Python package directory if it doesn't exist | ||
mkdir -p ${SP_DIR} | ||
|
||
# Copy the extension to the Python site-packages | ||
cp ${PREFIX}/lib/digest$(python3-config --extension-suffix) ${SP_DIR}/ | ||
touch ${SP_DIR}/__init__.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{% set name = "digest" %} | ||
{% set version = "0.2.0" %} | ||
|
||
package: | ||
name: {{ name|lower }} | ||
version: {{ version }} | ||
|
||
source: | ||
url: https://github.com/VeryAmazed/digest/archive/refs/tags/v{{ version }}.tar.gz | ||
sha256: a3464dde4d4f6c1fc4808e53894383e9fa3cd3fd41471efe9a7bc955eb0ec91d | ||
|
||
build: | ||
number: 0 | ||
pkg_format: '.conda' | ||
run_exports: | ||
- {{ pin_subpackage(name, max_pin='x.x') }} | ||
|
||
requirements: | ||
build: | ||
- {{ compiler('cxx') }} | ||
- meson | ||
- ninja | ||
- pybind11 | ||
- python | ||
host: | ||
- python | ||
- pip | ||
- pybind11 | ||
run: | ||
- python | ||
- pybind11 | ||
|
||
test: | ||
imports: | ||
- digest | ||
commands: | ||
- python -c "from digest import window_minimizer, syncmer, modimizer" | ||
|
||
about: | ||
home: https://github.com/VeryAmazed/digest | ||
summary: Fast, multi-use k-mer sub-sampling library | ||
description: | | ||
A C++ library that supports various sub-sampling schemes for k-mers in DNA sequences. | ||
Includes Python bindings that allow users to run functions from the C++ library in Python. | ||
license: MIT | ||
license_file: LICENSE | ||
|
||
extra: | ||
recipe-maintainers: | ||
- vikshiv | ||
additional-platforms: | ||
- linux-aarch64 | ||
- osx-arm64 |