[package]
name = "numrs-core"
version = "0.1.10"
edition = "2021"
authors = ["Rodrigo Aguiluz Mena"]
description = "A high-performance numerical computing library with multi-backend dispatch (SIMD, BLAS/MKL, WebGPU) and zero-cost abstractions"
license = "AGPL-3.0-only"
repository = "https://github.com/rjaguiluz/numrs"
homepage = "https://numrs.dev"
documentation = "https://numrs.dev/doc"
readme = "README.md"
keywords = ["numerical", "array", "numpy", "blas", "simd"]
categories = ["mathematics", "science", "algorithms"]
exclude = [
    "ARCHITECTURE_DIAGRAM.md",
    "BENCHMARK*.md",
    "CHECKLIST*.md",
    "CLEANUP*.md",
    "GUIA*.md",
    "MKL_THREADING.md",
    "NUMPY_COMPARISON.md",
    "RESUMEN_EJECUTIVO.md",
    "STATIC_BLAS_LINKING.md",
    "KERNEL_SELECTION_FLOW.md",
    "DISPATCH_SYSTEM.md",
    "PROGRESS.md",
    "compare_results.csv",
    "ops_impl.md",
    "ops_three.md",
    "OPS_CHECK.md",
    ".github/",
    ".venv/",
    ".pytest_cache/",
    "js/",
    "python/",
    "scripts/",
    "diagrams/",
    "test_*.rs",
    "*.o",
    "*.pdb",
]

[lib]
name = "numrs"
path = "src/lib.rs"

[dependencies]
anyhow = "1.0"
thiserror = "1.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"

# GPU dependencies - optional, enabled only for non-WASM targets
wgpu = { version = "23", optional = true }
pollster = { version = "0.3", optional = true }
bytemuck = { version = "1.17", features = ["derive"] }
once_cell = "1.21"
num_cpus = "1.15"
blas = { version = "0.20", optional = true }
rayon = { version = "1.7", optional = true }
chrono = "0.4"
sysinfo = "0.30"
futures = "0.3"

[dev-dependencies]
criterion = "0.5"
rand = "0.8"

[[example]]
name = "dispatch_demo"
path = "examples/dispatch_demo.rs"
required-features = []

[[bin]]
name = "numrs-bench"
path = "src/bin/numrs_bench/main.rs"
required-features = []

[[bin]]
name = "numrs-ops"
path = "src/bin/numrs_ops.rs"
required-features = []

[[bench]]
name = "ops_bench"
harness = false

[[bench]]
name = "promotion_bench"
harness = false

[build-dependencies]
vcpkg = "0.2"

[features]
# Default features: BLAS backend + WebGPU (native) + WebGL (browser) + Parallel CPU
# Note: native-gpu is auto-enabled for non-WASM targets via target-specific features
default = ["blas-backend", "webgpu", "webgl", "parallel"]
blas-backend = ["blas", "cblas", "intel-mkl-src", "blis-src"]
disabled-blas = []  # Force disable BLAS (useful for WASM or testing)
wasm-simd = []      # Enable WASM SIMD128 intrinsics
native-gpu = ["wgpu", "pollster"]  # GPU backend for native targets (not WASM)
parallel = ["rayon"] # Enable parallel CPU operations using Rayon

# GPU backends - wgpu with different backend configurations
# webgpu: Native WebGPU for desktop (Vulkan/Metal/DX12)
webgpu = []
# webgl: WebGL fallback for browsers and older systems
webgl = []

# Link BLAS provider per-target at compile time:
# x86_64 → MKL (Windows, Linux, macOS via Rosetta)
# ARM/other → BLIS (Linux ARM, RISC-V, etc.)
# WASM → No BLAS (pure Rust)
[target.'cfg(all(target_arch = "x86_64", not(target_arch = "wasm32")))'.dependencies]
# MKL static linking for x86_64 (sequential but fully static)
intel-mkl-src = { version = "0.8", default-features = false, features = ["mkl-static-lp64-seq"], optional = true }
cblas = { version = "0.5", optional = true }
# GPU deps for native x86_64
wgpu = { version = "23", optional = false }
pollster = { version = "0.3", optional = false }

[target.'cfg(all(not(target_arch = "x86_64"), not(target_arch = "wasm32")))'.dependencies]
# BLIS static linking for ARM and other architectures (automatic, no feature needed)
blis-src = { version = "0.2", optional = true }
cblas = { version = "0.5", optional = true }
# GPU deps for native non-x86_64 (ARM, etc.)
wgpu = { version = "23", optional = false }
pollster = { version = "0.3", optional = false }

[target.'cfg(target_os = "macos")'.dependencies]
# macOS: Accelerate framework (system-provided, always static)
accelerate-src = "0.3"
# Metal backend (macOS only)
metal = "0.27"
objc = "0.2"

[target.'cfg(target_arch = "wasm32")'.dependencies]
# WASM-specific dependencies for browser compatibility
# WASM-specific dependencies for browser compatibility
wasm-bindgen = "0.2"
web-sys = { version = "0.3", features = ["Window", "Document", "HtmlCanvasElement", "WebGl2RenderingContext", "GpuCanvasContext", "console"] }
js-sys = "0.3"
console_error_panic_hook = "0.1"
wasm-bindgen-futures = "0.4"
wgpu = { version = "23", features = ["webgl", "wgsl"] } # Enable webgl fallback and wgsl support, defaults enabled for WebGPU backend
pollster = "0.3"
