From bdb19b5738503a2336896a4dd7ec67b28ac859f6 Mon Sep 17 00:00:00 2001 From: Gabriele Musco Date: Fri, 18 Jul 2025 07:33:07 +0200 Subject: [PATCH] fix: rely on system packages for onnxruntime --- scripts/build_mercury.sh | 51 ----------------------------------- src/builders/build_mercury.rs | 12 +++------ src/depcheck/mercury_deps.rs | 15 +++++++++++ src/ui/app.rs | 2 +- 4 files changed, 19 insertions(+), 61 deletions(-) diff --git a/scripts/build_mercury.sh b/scripts/build_mercury.sh index b3db66a..932d343 100755 --- a/scripts/build_mercury.sh +++ b/scripts/build_mercury.sh @@ -2,57 +2,6 @@ set -ev -PREFIX=$1 - -CACHE_DIR=$2 - -if [[ -z $PREFIX ]] || [[ -z $CACHE_DIR ]]; then - echo "Usage: $0 PREFIX CACHE_DIR" - exit 1 -fi - -ONNX_RELEASES=$(curl -sSL "https://api.github.com/repos/microsoft/onnxruntime/releases") -NUM_RELEASES=$(echo "$ONNX_RELEASES" | jq -r '[ select (.[]!=null) ] | length') - -for (( IDX=0; IDX VecDeque { +pub fn get_build_mercury_jobs() -> VecDeque { let mut jobs = VecDeque::new(); jobs.push_back(WorkerJob::new_printer( "Building Mercury...", @@ -17,10 +14,7 @@ pub fn get_build_mercury_jobs(profile: &Profile) -> VecDeque { .join("scripts/build_mercury.sh") .to_string_lossy() .to_string(), - Some(vec![ - profile.prefix.to_string_lossy().to_string(), - get_cache_dir().to_string_lossy().to_string(), - ]), + None, )); jobs diff --git a/src/depcheck/mercury_deps.rs b/src/depcheck/mercury_deps.rs index a7e59be..d8c61b5 100644 --- a/src/depcheck/mercury_deps.rs +++ b/src/depcheck/mercury_deps.rs @@ -7,6 +7,21 @@ use std::collections::HashMap; fn mercury_deps() -> Vec { vec![ dep_opencv(), + Dependency { + name: "onnxruntime-dev".into(), + dep_type: DepType::Include, + filename: "onnxruntime/onnxruntime_c_api.h".into(), + packages: HashMap::from([ + (LinuxDistro::Arch, "onnxruntime".into()), + (LinuxDistro::Debian, "libonnxruntime-dev".into()), + (LinuxDistro::Fedora, "onnxruntime-devel".into()), + // alpine doesn't seem to have the package + // (LinuxDistro::Alpine, "".into()), + (LinuxDistro::Gentoo, "sci-ml/onnx".into()), + // opensuse doesn't seem to have the package + // (LinuxDistro::Suse, "".into()), + ]), + }, Dependency { name: "jq".into(), dep_type: DepType::Executable, diff --git a/src/ui/app.rs b/src/ui/app.rs index dc9d3b3..db02e88 100644 --- a/src/ui/app.rs +++ b/src/ui/app.rs @@ -548,7 +548,7 @@ impl AsyncComponent for App { jobs.extend(get_build_basalt_jobs(&profile, clean_build)); } if profile.features.mercury_enabled { - jobs.extend(get_build_mercury_jobs(&profile)); + jobs.extend(get_build_mercury_jobs()); } jobs.extend(match profile.xrservice_type { XRServiceType::Monado => get_build_monado_jobs(&profile, clean_build),