From 272d6f8740038d0be0e2cd21829b9463af1a1861 Mon Sep 17 00:00:00 2001
From: Markus Frank <Markus.Frank@cern.ch>
Date: Fri, 9 Aug 2019 17:17:29 +0200
Subject: [PATCH] Fix plugin service linkage for MAC

---
 DDCore/include/DD4hep/config.h        | 6 +++---
 GaudiPluginService/CMakeLists.txt     | 2 ++
 GaudiPluginService/interface/DD4hep.h | 9 ++++-----
 cmake/MakeGaudiMap.cmake              | 3 +--
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/DDCore/include/DD4hep/config.h b/DDCore/include/DD4hep/config.h
index 036ff5cac..e00188d62 100644
--- a/DDCore/include/DD4hep/config.h
+++ b/DDCore/include/DD4hep/config.h
@@ -20,7 +20,7 @@
 
 #define DD4HEP_CONDITIONS_DEBUG  1
 /// Valid implementations of the Gaudi plugin service are 1 and 2
-#define DD4HEP_PLUGINSVC_VERSION 2
+#define DD4HEP_PLUGINSVC_VERSION 1
 
 #ifdef DD4HEP_INSTANCE_COUNTS
 #define INCREMENT_COUNTER InstanceCount::increment(this)
@@ -36,6 +36,6 @@ namespace dd4hep {
   /// Namespace for implementation details of the AIDA detector description toolkit
   namespace detail {
 
-  } /* End namespace detail  */
-} /*   End namespace dd4hep    */
+  }       /* End namespace detail    */
+}         /*   End namespace dd4hep  */
 #endif    /* DD4HEP_CONFIG_H         */
diff --git a/GaudiPluginService/CMakeLists.txt b/GaudiPluginService/CMakeLists.txt
index f41600997..e4856a7a9 100644
--- a/GaudiPluginService/CMakeLists.txt
+++ b/GaudiPluginService/CMakeLists.txt
@@ -11,7 +11,9 @@ if( APPLE )
 endif()
 target_compile_options(DD4hepGaudiPluginMgr PRIVATE -Wno-shadow)
 target_compile_options(DD4hepGaudiPluginMgr PRIVATE -Wno-unused)
+target_compile_options(DD4hepGaudiPluginMgr PRIVATE -Wno-unused-parameter)
 target_compile_options(DD4hepGaudiPluginMgr PRIVATE -Wno-deprecated)
+target_compile_options(DD4hepGaudiPluginMgr PRIVATE -Wno-keyword-macro)
 target_compile_options(DD4hepGaudiPluginMgr PRIVATE -Wno-return-type-c-linkage)
 
 target_link_libraries(DD4hepGaudiPluginMgr ${CMAKE_DL_LIBS} ${Boost_FILESYSTEM_LIBRARY} )
diff --git a/GaudiPluginService/interface/DD4hep.h b/GaudiPluginService/interface/DD4hep.h
index 8d22e753f..a86064d0b 100644
--- a/GaudiPluginService/interface/DD4hep.h
+++ b/GaudiPluginService/interface/DD4hep.h
@@ -33,16 +33,13 @@ namespace std {
 #pragma clang diagnostic pop
 #endif
 
-#if GAUDI_PLUGIN_SERVICE_VERSION==2
+#if GAUDI_PLUGIN_SERVICE_VERSION == 2
 #define GAUDI_PLUGIN_SERVICE_V2 1
 #include <Gaudi/PluginService.h>
-using namespace Gaudi::PluginService::v2;
-
-#elif GAUDI_PLUGIN_SERVICE_VERSION==1
+#elif GAUDI_PLUGIN_SERVICE_VERSION == 1
 #define private public
 #define GAUDI_PLUGIN_SERVICE_V1 1
 #include <Gaudi/PluginService.h>
-using namespace Gaudi::PluginService::v1;
 #undef private
 #endif
 
@@ -63,6 +60,7 @@ extern "C"  {
   /// Access factory by name
 #if GAUDI_PLUGIN_SERVICE_VERSION==2
   std::any MAKE_FUNC(create,GAUDI_PLUGIN_SERVICE_VERSION)(const char* id, const char* /* sig */)   {
+    using namespace Gaudi::PluginService::v2;
     const Details::Registry::FactoryInfo& info = Details::Registry::instance().getInfo(id, true);
     return info.factory;
   }
@@ -76,6 +74,7 @@ extern "C"  {
 #if GAUDI_PLUGIN_SERVICE_VERSION==2
   /// Add a new factory to the registry
   void MAKE_FUNC(add_factory,GAUDI_PLUGIN_SERVICE_VERSION)(const char* id, std::any&& stub, const char* /* sig */, const char* /* ret */)   {
+    using namespace Gaudi::PluginService::v2;
     Details::Registry::Properties props = {};
     std::string lib_name = "";
     Details::Registry::instance().add( id, {lib_name, std::move( stub ), std::move( props )} );
diff --git a/cmake/MakeGaudiMap.cmake b/cmake/MakeGaudiMap.cmake
index 12da90c2d..47ef97ce8 100644
--- a/cmake/MakeGaudiMap.cmake
+++ b/cmake/MakeGaudiMap.cmake
@@ -10,6 +10,7 @@ message(STATUS " *** Gaudi listcomponents: Generate map for ${libname} ..." )
 
   if(APPLE)
     SET ( ENV{DYLD_LIBRARY_PATH} ${genmap_install_dir}:$ENV{DYLD_LIBRARY_PATH}:$ENV{DD4HEP_LIBRARY_PATH} )
+    EXECUTE_PROCESS( COMMAND echo DYLD_LIBRARY_PATH = $ENV{DYLD_LIBRARY_PATH} )
   else()
     SET ( ENV{LD_LIBRARY_PATH} ${genmap_install_dir}:$ENV{LD_LIBRARY_PATH} )
     #SET ( ENV{LD_PRELOAD} /lib64/libglapi.so )
@@ -19,5 +20,3 @@ message(STATUS " *** Gaudi listcomponents: Generate map for ${libname} ..." )
     ${Gaudi_listcomponents_CMD} -o ${rootmapfile} ${libname}
     WORKING_DIRECTORY ${genmap_install_dir}
     )
-
-
-- 
GitLab