From 4bb51bc48366030ef66090774ab6afd57d72c5d4 Mon Sep 17 00:00:00 2001
From: Andre Sailer <andre.philippe.sailer@cern.ch>
Date: Mon, 28 Oct 2019 14:53:02 +0100
Subject: [PATCH] InitAClick: account for different library name on apple

---
 DDG4/examples/initAClick.C         | 10 ++++++----
 examples/LHeD/scripts/initAClick.C | 10 ++++++----
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/DDG4/examples/initAClick.C b/DDG4/examples/initAClick.C
index 5878c05ef..f7efad091 100644
--- a/DDG4/examples/initAClick.C
+++ b/DDG4/examples/initAClick.C
@@ -63,10 +63,12 @@ int initAClick(const char* command=0)  {
   std::string defs    = "";
   std::string libs    = " -L"+rootsys+"/lib";
   std::string inc     = " -I"+dd4hep+"/examples/DDG4/examples -I"+dd4hep + " -I"+dd4hep+"/include";
+  std::string ext = "so";
   if ( !geant4.empty() )  {
     inc  += " -I"+geant4+"/include/Geant4";
 #ifdef __APPLE__
     libs += (" -L"+geant4+"/lib");
+    ext = "dylib";
 #else
     libs += (" -L"+geant4+"/lib -L"+geant4+"/lib64");
 #endif
@@ -82,10 +84,10 @@ int initAClick(const char* command=0)  {
 #ifndef __APPLE__
   libs += " -lCore -lMathCore -pthread -lm -ldl -rdynamic";
 #endif
-  libs += " " +dd4hep+"/lib/libDD4hepGaudiPluginMgr.so";
-  libs += " " +dd4hep+"/lib/libDDCore.so";
-  libs += " " +dd4hep+"/lib/libDDG4.so";
-  gSystem->Load("libDD4hepGaudiPluginMgr.so");
+  libs += " " +dd4hep+"/lib/libDD4hepGaudiPluginMgr." + ext;
+  libs += " " +dd4hep+"/lib/libDDCore."+ ext;
+  libs += " " +dd4hep+"/lib/libDDG4."+ ext;
+  gSystem->Load(std::string("libDD4hepGaudiPluginMgr." + ext).c_str());
   gSystem->AddIncludePath(inc.c_str());
   gSystem->AddLinkedLibs(libs.c_str());
   std::cout << "+++ Includes:   " << gSystem->GetIncludePath() << std::endl;
diff --git a/examples/LHeD/scripts/initAClick.C b/examples/LHeD/scripts/initAClick.C
index 55a073ca4..b0495e11c 100644
--- a/examples/LHeD/scripts/initAClick.C
+++ b/examples/LHeD/scripts/initAClick.C
@@ -63,10 +63,12 @@ int initAClick(const char* command=0)  {
   std::string defs    = "";
   std::string libs    = " -L"+rootsys+"/lib";
   std::string inc     = " -I"+dd4hep+"/examples/LHeD/scripts -I"+dd4hep + " -I"+dd4hep+"/include"+clhep+"/include -I"+geant4+"/include";
+  std::string ext = "so";
   if ( !geant4.empty() )  {
     inc  += " -I"+geant4+"/include/Geant4";
 #ifdef __APPLE__
     libs += (" -L"+geant4+"/lib");
+    ext = "dylib";
 #else
     libs += (" -L"+geant4+"/lib -L"+geant4+"/lib64");
 #endif
@@ -82,10 +84,10 @@ int initAClick(const char* command=0)  {
 #ifndef __APPLE__
   libs += " -lCore -lMathCore -pthread -lm -ldl -rdynamic";
 #endif
-  libs += " " +dd4hep+"/lib/libDD4hepGaudiPluginMgr.so";
-  libs += " " +dd4hep+"/lib/libDDCore.so";
-  libs += " " +dd4hep+"/lib/libDDG4.so";
-  gSystem->Load("libDD4hepGaudiPluginMgr");
+  libs += " " +dd4hep+"/lib/libDD4hepGaudiPluginMgr." + ext;
+  libs += " " +dd4hep+"/lib/libDDCore." + ext;
+  libs += " " +dd4hep+"/lib/libDDG4." + ext;
+  gSystem->Load(std::string("libDD4hepGaudiPluginMgr." + ext).c_str());
   gSystem->AddIncludePath(inc.c_str());
   gSystem->AddLinkedLibs(libs.c_str());
   std::cout << "+++ Includes:   " << gSystem->GetIncludePath() << std::endl;
-- 
GitLab