# 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.

#add_compile_options(-O0 -g -fPIC)

o2_add_library(GlobalTrackingStudy
               TARGETVARNAME targetName
               SOURCES src/TPCTrackStudy.cxx
                       src/TrackingStudy.cxx
                       src/SVStudy.cxx
                       src/TrackMCStudy.cxx
                       src/TPCDataFilter.cxx
                       src/ITSOffsStudy.cxx
                       src/DumpTracks.cxx
                       src/V0Ext.cxx
                       src/TrackInfoExt.cxx
                       src/TrackMCStudyConfig.cxx
                       src/TrackMCStudyTypes.cxx
                       src/TPCClusSelector.cxx
                       src/CheckResidSpec.cxx
                       src/CheckResidConfig.cxx
                       src/HistoManager.cxx
               PUBLIC_LINK_LIBRARIES O2::GlobalTracking
                                     O2::GlobalTrackingWorkflowReaders
                                     O2::GlobalTrackingWorkflowHelpers
                                     O2::DataFormatsGlobalTracking
                                     O2::DetectorsVertexing
                                     O2::TPCWorkflow
                                     O2::SimulationDataFormat)

o2_target_root_dictionary(GlobalTrackingStudy
                          HEADERS include/GlobalTrackingStudy/V0Ext.h
                                  include/GlobalTrackingStudy/TrackInfoExt.h
                                  include/GlobalTrackingStudy/TrackMCStudyConfig.h
                                  include/GlobalTrackingStudy/TrackMCStudyTypes.h
                                  include/GlobalTrackingStudy/CheckResidTypes.h
                                  include/GlobalTrackingStudy/CheckResidConfig.h
                                  include/GlobalTrackingStudy/HistoManager.h
                          LINKDEF src/GlobalTrackingStudyLinkDef.h
)

o2_add_executable(study-workflow
                  COMPONENT_NAME sv
                  SOURCES src/sv-study-workflow.cxx
                  PUBLIC_LINK_LIBRARIES O2::GlobalTrackingStudy)

o2_add_executable(study-workflow
                  COMPONENT_NAME tpc-track
                  SOURCES src/tpc-track-study-workflow.cxx
                  PUBLIC_LINK_LIBRARIES O2::GlobalTrackingStudy)

o2_add_executable(study-workflow
                  COMPONENT_NAME tracking
                  SOURCES src/tracking-study-workflow.cxx
                  PUBLIC_LINK_LIBRARIES O2::GlobalTrackingStudy)

o2_add_executable(study-workflow
                  COMPONENT_NAME trackMC
                  SOURCES src/trackMCStudy-workflow.cxx
                  PUBLIC_LINK_LIBRARIES O2::GlobalTrackingStudy)

o2_add_executable(filter-workflow
                  COMPONENT_NAME tpc-data
                  SOURCES src/tpc-data-filter-workflow.cxx
                  PUBLIC_LINK_LIBRARIES O2::GlobalTrackingStudy)

o2_add_executable(study-workflow
                  COMPONENT_NAME its-offset
                  SOURCES src/its-offset-study-workflow.cxx
                  PUBLIC_LINK_LIBRARIES O2::GlobalTrackingStudy)

o2_add_executable(dump-workfow
                  COMPONENT_NAME bc-tracks
                  SOURCES src/track-dump-workflow.cxx
                  PUBLIC_LINK_LIBRARIES O2::GlobalTrackingStudy)

o2_add_executable(resid-workfow
                  COMPONENT_NAME check
                  SOURCES src/check-resid-workflow.cxx
                  PUBLIC_LINK_LIBRARIES O2::GlobalTrackingStudy)

if (OpenMP_CXX_FOUND)
    target_compile_definitions(${targetName} PRIVATE WITH_OPENMP)
    target_link_libraries(${targetName} PRIVATE OpenMP::OpenMP_CXX)
endif()
