Skip to content

Commit

Permalink
Add support for ONNXRuntime 1.17.1
Browse files Browse the repository at this point in the history
Notice that this includes a fix to give precedence to the old ONNXRuntime.

Without this, it will currently prefer (non-working) local installations.
  • Loading branch information
ktf committed Apr 11, 2024
1 parent dd35564 commit 9da1a8c
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 7 deletions.
4 changes: 4 additions & 0 deletions Detectors/TRD/pid/include/TRDPID/ML.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
#include "DataFormatsTRD/PID.h"
#include "Framework/ProcessingContext.h"
#include "Framework/InputRecord.h"
#if __has_include(<onnxruntime/core/session/experimental_onnxruntime_cxx_api.h>)
#include <onnxruntime/core/session/experimental_onnxruntime_cxx_api.h>
#else
#include <onnxruntime_cxx_api.h>
#endif
#include <memory>
#include <vector>
#include <array>
Expand Down
4 changes: 4 additions & 0 deletions Detectors/TRD/pid/src/ML.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@
#include "DetectorsBase/Propagator.h"

#include <fmt/format.h>
#if __has_include(<onnxruntime/core/session/experimental_onnxruntime_cxx_api.h>)
#include <onnxruntime/core/session/experimental_onnxruntime_cxx_api.h>
#else
#include <onnxruntime_cxx_api.h>
#endif
#include <boost/range.hpp>

#include <array>
Expand Down
4 changes: 4 additions & 0 deletions Detectors/ZDC/fastsimulation/include/FastSimulations.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
#ifndef O2_ZDC_FAST_SIMULATIONS_H
#define O2_ZDC_FAST_SIMULATIONS_H

#if __has_include(<onnxruntime/core/session/onnxruntime_cxx_api.h>)
#include <onnxruntime/core/session/onnxruntime_cxx_api.h>
#else
#include <onnxruntime_cxx_api.h>
#endif
#include <optional>
#include <mutex>

Expand Down
4 changes: 4 additions & 0 deletions Detectors/ZDC/fastsimulation/include/Processors.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
#ifndef O2_ZDC_FAST_SIMULATIONS_PROCESSORS_H
#define O2_ZDC_FAST_SIMULATIONS_PROCESSORS_H

#if __has_include(<onnxruntime/core/session/onnxruntime_cxx_api.h>)
#include <onnxruntime/core/session/onnxruntime_cxx_api.h>
#else
#include <onnxruntime_cxx_api.h>
#endif
#include <optional>
#include <vector>

Expand Down
6 changes: 6 additions & 0 deletions Detectors/ZDC/simulation/include/ZDCSimulation/Detector.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@

// inclusions and forward decl for fast sim
#ifdef ZDC_FASTSIM_ONNX

#if __has_include(<onnxruntime/core/session/onnxruntime_cxx_api.h>)
#include <onnxruntime/core/session/onnxruntime_cxx_api.h>
#else
#include <onnxruntime_cxx_api.h>
#endif

namespace o2::zdc
{
namespace fastsim
Expand Down
15 changes: 8 additions & 7 deletions dependencies/FindONNXRuntime.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
# granted to it by virtue of its status as an Intergovernmental Organization
# or submit itself to any jurisdiction.

find_package(onnxruntime CONFIG)
if (NOT onnxruntime_FOUND)
find_package(ONNXRuntime::ONNXRuntime CONFIG)
if (ONNXRuntime::ONNXRuntime_FOUND)
set(onnxruntime_FOUND 1)
add_library(onnxruntime::onnxruntime ALIAS ONNXRuntime::ONNXRuntime)
endif()
find_package(ONNXRuntime::ONNXRuntime CONFIG)
if (ONNXRuntime::ONNXRuntime_FOUND)
set(onnxruntime_FOUND 1)
add_library(onnxruntime::onnxruntime ALIAS ONNXRuntime::ONNXRuntime)
endif()

if (NOT ONNXRuntime::ONNXRuntime_FOUND)
find_package(onnxruntime CONFIG)
endif()

0 comments on commit 9da1a8c

Please sign in to comment.