From 9ba334176f0263114221b51e859dcea234e9722d Mon Sep 17 00:00:00 2001
From: Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
Date: Wed, 9 Dec 2020 11:05:19 +0100
Subject: [PATCH] Made xAODTrackingCnv build as part of AthAnalysis.

Following the setup in 21.2, the package only builds one
tool for AthAnalysis. The one used by xAODTrackingAthenaPool
in this project (as well).
---
 Event/xAOD/xAODTrackingCnv/CMakeLists.txt     | 45 +++++++++++++------
 .../components/xAODTrackingCnv_entries.cxx    | 25 +++++++----
 2 files changed, 47 insertions(+), 23 deletions(-)

diff --git a/Event/xAOD/xAODTrackingCnv/CMakeLists.txt b/Event/xAOD/xAODTrackingCnv/CMakeLists.txt
index d48e57d6c758..a093942c0072 100644
--- a/Event/xAOD/xAODTrackingCnv/CMakeLists.txt
+++ b/Event/xAOD/xAODTrackingCnv/CMakeLists.txt
@@ -3,17 +3,34 @@
 # Declare the package name:
 atlas_subdir( xAODTrackingCnv )
 
-# Component(s) in the package:
-atlas_add_library( xAODTrackingCnvLib
-   xAODTrackingCnv/*.h
-   INTERFACE
-   PUBLIC_HEADERS xAODTrackingCnv
-   LINK_LIBRARIES xAODTracking TrkTrack GaudiKernel )
-
-atlas_add_component( xAODTrackingCnv
-   src/*.h src/*.cxx src/components/*.cxx
-   LINK_LIBRARIES xAODTracking TrkTrack AthenaBaseComps AthenaKernel
-   EventPrimitives GaudiKernel GeneratorObjects MCTruthClassifierLib Particle
-   ParticleTruth TrkLinks TrkParticleBase TrkTruthData VxVertex 
-   TrkToolInterfaces xAODCore xAODTrackingCnvLib
-   PRIVATE_LINK_LIBRARIES CxxUtils )
+# Component(s) in the package. Built in a much more lightweight fashion for
+# AthAnalysis.
+if( XAOD_ANALYSIS )
+
+   atlas_add_library( xAODTrackingCnvLib
+      xAODTrackingCnv/ITrackParticleCompressorTool.h
+      INTERFACE
+      PUBLIC_HEADERS xAODTrackingCnv
+      LINK_LIBRARIES xAODTracking GaudiKernel )
+
+   atlas_add_component( xAODTrackingCnv
+      src/TrackParticleCompressorTool.* src/components/*.cxx
+      LINK_LIBRARIES AthenaBaseComps CxxUtils xAODTrackingCnvLib )
+
+else()
+
+   atlas_add_library( xAODTrackingCnvLib
+      xAODTrackingCnv/*.h
+      INTERFACE
+      PUBLIC_HEADERS xAODTrackingCnv
+      LINK_LIBRARIES xAODTracking TrkTrack GaudiKernel )
+
+   atlas_add_component( xAODTrackingCnv
+      src/*.h src/*.cxx src/components/*.cxx
+      LINK_LIBRARIES xAODTracking TrkTrack AthenaBaseComps AthenaKernel
+      EventPrimitives GaudiKernel GeneratorObjects MCTruthClassifierLib Particle
+      ParticleTruth TrkLinks TrkParticleBase TrkTruthData VxVertex
+      TrkToolInterfaces xAODCore xAODTrackingCnvLib
+      PRIVATE_LINK_LIBRARIES CxxUtils )
+
+endif()
diff --git a/Event/xAOD/xAODTrackingCnv/src/components/xAODTrackingCnv_entries.cxx b/Event/xAOD/xAODTrackingCnv/src/components/xAODTrackingCnv_entries.cxx
index 2e08c663b6c3..9c54f4449666 100644
--- a/Event/xAOD/xAODTrackingCnv/src/components/xAODTrackingCnv_entries.cxx
+++ b/Event/xAOD/xAODTrackingCnv/src/components/xAODTrackingCnv_entries.cxx
@@ -1,12 +1,19 @@
-#include "../TrackCollectionCnvTool.h"
-#include "../RecTrackParticleContainerCnvTool.h"
-#include "../TrackParticleCnvAlg.h"
-#include "../VertexCnvAlg.h"
+//
+// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+//
+
+#ifndef XAOD_ANALYSIS
+#   include "../TrackCollectionCnvTool.h"
+#   include "../RecTrackParticleContainerCnvTool.h"
+#   include "../TrackParticleCnvAlg.h"
+#   include "../VertexCnvAlg.h"
+#endif // NOT XAOD_ANALYSIS
 #include "../TrackParticleCompressorTool.h"
 
-DECLARE_COMPONENT( xAODMaker::RecTrackParticleContainerCnvTool )
-DECLARE_COMPONENT( xAODMaker::TrackCollectionCnvTool )
+#ifndef XAOD_ANALYSIS
+   DECLARE_COMPONENT( xAODMaker::RecTrackParticleContainerCnvTool )
+   DECLARE_COMPONENT( xAODMaker::TrackCollectionCnvTool )
+   DECLARE_COMPONENT( xAODMaker::TrackParticleCnvAlg )
+   DECLARE_COMPONENT( xAODMaker::VertexCnvAlg )
+#endif // NOT XAOD_ANALYSIS
 DECLARE_COMPONENT( xAODMaker::TrackParticleCompressorTool )
-DECLARE_COMPONENT( xAODMaker::TrackParticleCnvAlg )
-DECLARE_COMPONENT( xAODMaker::VertexCnvAlg )
-
-- 
GitLab