File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -85,9 +85,31 @@ pick_newest_ort_dir() {
8585 sort -V -r | head -1 | awk ' {print $2}'
8686}
8787
88+ ort_dir_has_runtime_lib () {
89+ local dir=" $1 "
90+ local versioned
91+ if [[ -f " $dir /libonnxruntime.so" ]]; then
92+ return 0
93+ fi
94+ versioned=$( find " $dir " -maxdepth 1 -name ' libonnxruntime.so.*.*.*' -type f -print -quit 2> /dev/null)
95+ [[ -n " $versioned " ]]
96+ }
97+
8898find_ort_dir () {
8999 # Check explicit override first.
90100 if [[ -n " ${ORT_DIR:- } " ]]; then
101+ if [[ ! -d " $ORT_DIR " ]]; then
102+ echo >&2 " error: ORT_DIR is not a directory: $ORT_DIR "
103+ echo >&2 " Check ORT_DIR points to an onnxruntime/capi directory."
104+ echo >&2 " Unset ORT_DIR to fall back to auto-discovery."
105+ return 1
106+ fi
107+ if ! ort_dir_has_runtime_lib " $ORT_DIR " ; then
108+ echo >&2 " error: ORT_DIR does not contain libonnxruntime.so: $ORT_DIR "
109+ echo >&2 " Check ORT_DIR points to an onnxruntime/capi directory."
110+ echo >&2 " Unset ORT_DIR to fall back to auto-discovery."
111+ return 1
112+ fi
91113 echo " $ORT_DIR "
92114 return
93115 fi
You can’t perform that action at this time.
0 commit comments