# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
#
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
# to registry (e.g., crates.io) dependencies.
#
# If you are reading this file be aware that the original Cargo.toml
# will likely look very different (and much more reasonable).
# See Cargo.toml.orig for the original contents.

[package]
edition = "2024"
rust-version = "1.87"
name = "rlx-ocr"
version = "0.2.0"
authors = [
    "Eugene Hauptmann",
    "Nataliya Kosmyna",
]
build = false
autolib = false
autobins = false
autoexamples = false
autotests = false
autobenches = false
description = "OCR engine for RLX — text detection + recognition"
readme = false
license = "GPL-3.0-only"
repository = "https://github.com/MIT-RLX/rlx-models"
resolver = "2"

[features]
all-backends = [
    "metal",
    "mlx",
    "cuda",
    "rocm",
    "gpu",
    "vulkan",
]
amd-gpu = ["rocm"]
apple-silicon = [
    "metal",
    "mlx",
    "gpu",
]
convert-rten = [
    "rten-inference",
    "dep:rten-model-file",
]
cuda = ["rlx-runtime/cuda"]
default = [
    "rlx",
    "tensor-ops",
]
gpu = ["rlx-runtime/gpu"]
metal = ["rlx-runtime/metal"]
mlx = ["rlx-runtime/mlx"]
nvidia-gpu = ["cuda"]
parity-ocrs = [
    "rten-inference",
    "dep:ocrs",
    "dep:ureq",
]
portable-gpu = ["gpu"]
rlx = []
rocm = ["rlx-runtime/rocm"]
rten-inference = [
    "tensor-ops",
    "dep:rayon",
    "rten/rten_format",
]
rten-mmap = [
    "rten-inference",
    "rten/mmap",
]
tensor-ops = ["dep:rten"]
vulkan = ["rlx-runtime/vulkan"]

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

[[bin]]
name = "rlx-ocr"
path = "src/bin/rlx_ocr.rs"

[[bin]]
name = "rlx-ocr-convert"
path = "src/bin/rlx_ocr_convert.rs"
required-features = ["convert-rten"]

[[test]]
name = "assets"
path = "tests/assets.rs"

[[test]]
name = "det_shape_probe"
path = "tests/det_shape_probe.rs"
required-features = ["rten-inference"]

[[test]]
name = "env"
path = "tests/env.rs"

[[test]]
name = "ocr_backend_bench"
path = "tests/ocr_backend_bench.rs"
required-features = [
    "rlx",
    "convert-rten",
]

[[test]]
name = "ocr_backend_common"
path = "tests/ocr_backend_common.rs"

[[test]]
name = "ocr_backend_quick_check"
path = "tests/ocr_backend_quick_check.rs"
required-features = [
    "rlx",
    "convert-rten",
]

[[test]]
name = "ocr_batch_quick_check"
path = "tests/ocr_batch_quick_check.rs"
required-features = ["rlx"]

[[test]]
name = "ocr_parity"
path = "tests/ocr_parity.rs"
required-features = [
    "parity-ocrs",
    "convert-rten",
]

[[test]]
name = "ocr_perf_vs_reference"
path = "tests/ocr_perf_vs_reference.rs"
required-features = [
    "parity-ocrs",
    "convert-rten",
]

[[test]]
name = "recognition_native_bisect"
path = "tests/recognition_native_bisect.rs"
required-features = [
    "rlx",
    "rten-inference",
]

[[bench]]
name = "ocr_vs_reference"
path = "benches/ocr_vs_reference.rs"
harness = false
required-features = [
    "parity-ocrs",
    "convert-rten",
]

[dependencies.anyhow]
version = "1"

[dependencies.bytemuck]
version = "1"
features = ["derive"]

[dependencies.half]
version = "2"
features = ["bytemuck"]

[dependencies.image]
version = "0.25"
features = [
    "jpeg",
    "png",
]
default-features = false

[dependencies.memmap2]
version = "0.9"

[dependencies.ocrs]
version = "0.12.2"
optional = true
default-features = false

[dependencies.rayon]
version = "1.12"
optional = true

[dependencies.rlx-cli]
version = "0.2.0"

[dependencies.rlx-core]
version = "0.2.0"
package = "rlx-models-core"

[dependencies.rlx-flow]
version = "0.2.1"

[dependencies.rlx-ir]
version = "0.2.1"

[dependencies.rlx-runtime]
version = "0.2.1"
features = ["cpu"]
default-features = false

[dependencies.rten]
version = "0.24"
optional = true
default-features = false

[dependencies.rten-imageproc]
version = "0.24"

[dependencies.rten-model-file]
version = "0.24"
optional = true

[dependencies.rten-tensor]
version = "0.24"

[dependencies.safetensors]
version = "0.7"

[dependencies.ureq]
version = "2"
features = ["tls"]
optional = true
default-features = false

[dev-dependencies.criterion]
version = "0.5"
features = ["html_reports"]

[dev-dependencies.ureq]
version = "2"
features = ["tls"]
default-features = false

[lints.clippy]
manual_range_contains = "allow"
needless_range_loop = "allow"
too_many_arguments = "allow"
upper_case_acronyms = "allow"

[lints.clippy.all]
level = "warn"
priority = -1

[lints.rust.unused]
level = "warn"
priority = 0
