Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@ o2_build_sanity_checks()
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)

find_package(ONNXRuntime::ONNXRuntime CONFIG)
if (ONNXRuntime::ONNXRuntime_FOUND)
add_definitions(-DZDC_FASTSIM_ONNX)
endif()
include(dependencies/FindONNXRuntime.cmake)

include(O2CheckCXXFeatures)
o2_check_cxx_features()
Expand Down
2 changes: 1 addition & 1 deletion Detectors/ZDC/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# granted to it by virtue of its status as an Intergovernmental Organization
# or submit itself to any jurisdiction.

if (ONNXRuntime::ONNXRuntime_FOUND)
if (onnxruntime_FOUND)
add_subdirectory(fastsimulation)
endif()
add_subdirectory(base)
Expand Down
23 changes: 11 additions & 12 deletions Detectors/ZDC/fastsimulation/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
# Copyright 2019-2020 CERN and copyright holders of ALICE O2.
# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
# All rights not expressly granted are reserved.

# This software is distributed under the terms of the GNU General Public
# License v3 (GPL Version 3), copied verbatim in the file "COPYING".

# In applying this license CERN does not waive the privileges and immunities
# granted to it by virtue of its status as an Intergovernmental Organization
# or submit itself to any jurisdiction.
# Copyright 2019-2020 CERN and copyright holders of ALICE O2.
# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
# All rights not expressly granted are reserved.
#
# This software is distributed under the terms of the GNU General Public
# License v3 (GPL Version 3), copied verbatim in the file "COPYING".
#
# In applying this license CERN does not waive the privileges and immunities
# granted to it by virtue of its status as an Intergovernmental Organization
# or submit itself to any jurisdiction.

# @author SwirtaB


o2_add_library(FASTSimulation
SOURCES src/FastSimulations.cxx src/Processors.cxx src/Utils.cxx
PUBLIC_LINK_LIBRARIES ONNXRuntime::ONNXRuntime)
PUBLIC_LINK_LIBRARIES onnxruntime::onnxruntime)

o2_data_file(COPY scales DESTINATION Detectors/ZDC/fastsimulation)

o2_add_executable(fastsim-example
SOURCES tests/run-example.cxx
PUBLIC_LINK_LIBRARIES O2::FASTSimulation
COMPONENT_NAME zdc)

6 changes: 5 additions & 1 deletion Detectors/ZDC/simulation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,20 @@ list(APPEND LinkLibraries O2::SimulationDataFormat
O2::DetectorsRaw
O2::Headers)

if (ONNXRuntime::ONNXRuntime_FOUND)
if (onnxruntime_FOUND)
list(APPEND LinkLibraries O2::FASTSimulation)
endif()

o2_add_library(ZDCSimulation
TARGETVARNAME targetName
SOURCES src/Detector.cxx src/Digitizer.cxx src/SimCondition.cxx
src/ZDCSimParam.cxx src/SpatialPhotonResponse.cxx src/Digits2Raw.cxx
src/DigitizerTest.cxx
PUBLIC_LINK_LIBRARIES ${LinkLibraries})

if (onnxruntime_FOUND)
target_compile_definitions(${targetName} PUBLIC ZDC_FASTSIM_ONNX)
endif()

o2_target_root_dictionary(ZDCSimulation
HEADERS include/ZDCSimulation/Digitizer.h
Expand Down
19 changes: 19 additions & 0 deletions dependencies/FindONNXRuntime.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2019-2020 CERN and copyright holders of ALICE O2.
# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
# All rights not expressly granted are reserved.
#
# This software is distributed under the terms of the GNU General Public
# License v3 (GPL Version 3), copied verbatim in the file "COPYING".
#
# In applying this license CERN does not waive the privileges and immunities
# 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()
endif()