From 4714fd76e71577c330029272164cce58baba90d7 Mon Sep 17 00:00:00 2001
From: Markus Frank <markus.frank@cern.ch>
Date: Wed, 11 Mar 2015 19:53:39 +0000
Subject: [PATCH] See previous commit

---
 DDCore/include/DD4hep/Memory.h       | 55 ++++++++++++++++++++++++++++
 DDEve/CMakeLists.txt                 |  1 -
 DDRec/include/DDRec/API/Exceptions.h |  2 +-
 DDRec/src/Surface.cpp                |  6 +--
 DDSurfaces/CMakeLists.txt            |  1 -
 UtilityApps/CMakeLists.txt           |  2 -
 cmake/DD4hep.cmake                   |  7 ++++
 cmake/FindROOT.cmake                 |  2 +-
 8 files changed, 67 insertions(+), 9 deletions(-)
 create mode 100644 DDCore/include/DD4hep/Memory.h

diff --git a/DDCore/include/DD4hep/Memory.h b/DDCore/include/DD4hep/Memory.h
new file mode 100644
index 000000000..511802878
--- /dev/null
+++ b/DDCore/include/DD4hep/Memory.h
@@ -0,0 +1,55 @@
+// $Id: Readout.h 951 2013-12-16 23:37:56Z Christian.Grefe@cern.ch $
+//====================================================================
+//  AIDA Detector description implementation for LCD
+//--------------------------------------------------------------------
+//
+//  Author     : M.Frank
+//
+//====================================================================
+#ifndef DD4HEP_MEMORY_H
+#define DD4HEP_MEMORY_H
+
+// Framework include files
+#include "RVersion.h"
+
+// C/C++ include files
+#include <memory>
+
+/// Namespace for the AIDA detector description toolkit
+namespace DD4hep  {
+
+  /// Out version of the std auto_ptr implementation base either on auto_ptr or unique_ptr.
+  /**
+   *  Only need to overload constructor. Everything else 
+   *  like operator->, operator*, get, release etc. comes from base.
+   *
+   *   \author  M.Frank
+   *   \version 1.0
+   *   \ingroup DD4HEP_GEOMETRY
+   */
+  template <typename T> class dd4hep_ptr
+#if __cplusplus >= 201103L && ROOT_VERSION_CODE >= ROOT_VERSION(6,0,0)
+    : public std::unique_ptr<T>  {
+ public:
+  typedef std::unique_ptr<T> base_t;
+#else
+  : public std::auto_ptr<T>  {
+ public:
+    typedef std::auto_ptr<T> base_t;
+    void swap(base_t& c) { *this = c; c.release(); }
+#endif
+    /// Default Constructor.
+    dd4hep_ptr() : base_t() {}
+    /// Constructor from pointer
+    dd4hep_ptr(T* p) : base_t(p) {}
+    /// Constructor from copy
+    dd4hep_ptr(base_t& c) : base_t(c) {}
+    /// Assignment operator
+    dd4hep_ptr& operator=(base_t& c) {
+      this->swap(c);
+      return *this;
+    }
+  };
+}
+
+#endif  // DD4HEP_MEMORY_H
diff --git a/DDEve/CMakeLists.txt b/DDEve/CMakeLists.txt
index 3f80634f2..73b2ea3ca 100644
--- a/DDEve/CMakeLists.txt
+++ b/DDEve/CMakeLists.txt
@@ -45,7 +45,6 @@ list(APPEND sources G__DDEve.cxx)
 
 add_library(DD4hepEve SHARED ${sources})
 target_link_libraries(DD4hepEve DD4hepCore DD4hepG4 ${ROOT_EVE_LIBRARIES} -lFTGL ${LCIO_LIBRARIES} )
-SET( CMAKE_CXX_FLAGS "-Wall -Wextra -pedantic -Wno-long-long")
 
 SET_TARGET_PROPERTIES( DD4hepEve PROPERTIES VERSION ${DD4hep_VERSION} SOVERSION ${DD4hep_SOVERSION})
 
diff --git a/DDRec/include/DDRec/API/Exceptions.h b/DDRec/include/DDRec/API/Exceptions.h
index 24a76f78a..8710524ab 100644
--- a/DDRec/include/DDRec/API/Exceptions.h
+++ b/DDRec/include/DDRec/API/Exceptions.h
@@ -17,7 +17,7 @@
 
 #include <stdexcept>
 #include <string>
-#include <strstream>
+#include <sstream>
 
 namespace DD4hep {
 namespace DDRec {
diff --git a/DDRec/src/Surface.cpp b/DDRec/src/Surface.cpp
index 5d53c4ae3..28aef5f07 100644
--- a/DDRec/src/Surface.cpp
+++ b/DDRec/src/Surface.cpp
@@ -1,12 +1,12 @@
 #include "DDRec/Surface.h"
 #include "DD4hep/objects/DetectorInterna.h"
+#include "DD4hep/Memory.h"
 
 #include "DDRec/MaterialManager.h"
 
 #include <cmath>
 #include <memory>
 #include <exception>
-#include <memory> 
 
 #include "TGeoMatrix.h"
 #include "TGeoShape.h"
@@ -553,7 +553,7 @@ namespace DD4hep {
       // need to get the inverse transformation ( see Detector.cpp )
       // std::auto_ptr<TGeoHMatrix> wtI( new TGeoHMatrix( wm.Inverse() ) ) ;
       // has been fixed now, no need to get the inverse anymore:
-      std::auto_ptr<TGeoHMatrix> wtI( new TGeoHMatrix( wm ) ) ;
+      dd4hep_ptr<TGeoHMatrix> wtI( new TGeoHMatrix( wm ) ) ;
 
       //---- if the volSurface is not in the DetElement's volume, we need to mutliply the path to the volume to the
       // DetElements world transform
@@ -571,7 +571,7 @@ namespace DD4hep {
       //      std::cout << "  +++ new world transform matrix  : " << std::endl ;
 
 #if 0 //fixme: which convention to use here - the correct should be wtI, however it is the inverse of what is stored in DetElement ???
-      std::auto_ptr<TGeoHMatrix> wt( new TGeoHMatrix( wtI->Inverse() ) ) ;
+      dd4hep_ptr<TGeoHMatrix> wt( new TGeoHMatrix( wtI->Inverse() ) ) ;
       wt->Print() ;
       // cache the world transform for the surface
       _wtM = wt.release()  ;
diff --git a/DDSurfaces/CMakeLists.txt b/DDSurfaces/CMakeLists.txt
index d63db334a..686837af4 100644
--- a/DDSurfaces/CMakeLists.txt
+++ b/DDSurfaces/CMakeLists.txt
@@ -31,7 +31,6 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
 
 #add_library(${PackageName} SHARED ${sources} )
 
-#SET(CMAKE_CXX_FLAGS "-Wall -Wextra -pedantic -Wno-long-long")
 #SET_TARGET_PROPERTIES( ${PackageName} PROPERTIES VERSION ${DDSurfaces_VERSION} SOVERSION ${DDSurfaces_SOVERSION})
 
 #--- install target-------------------------------------
diff --git a/UtilityApps/CMakeLists.txt b/UtilityApps/CMakeLists.txt
index a7e2b87e5..a6c4bfc82 100644
--- a/UtilityApps/CMakeLists.txt
+++ b/UtilityApps/CMakeLists.txt
@@ -7,8 +7,6 @@ include_directories( ${CMAKE_SOURCE_DIR}/DDCore/include
                      ${CMAKE_SOURCE_DIR}/DDRec/include  
 		     ${CMAKE_SOURCE_DIR}/DDTest/include )
 
-
-
 #-----------------------------------------------------------------------------------
 add_executable(geoDisplay src/display.cpp)
 target_link_libraries(geoDisplay DD4hepCore )
diff --git a/cmake/DD4hep.cmake b/cmake/DD4hep.cmake
index 6efecca22..a88d12053 100644
--- a/cmake/DD4hep.cmake
+++ b/cmake/DD4hep.cmake
@@ -1,3 +1,10 @@
+
+#---------------------------------------------------------------------------------------------------
+##SET( CMAKE_CXX_FLAGS "-std=c++11 -Wall -Wextra -pedantic -Wno-long-long")
+SET( CMAKE_CXX_FLAGS "-Wall -Wextra -pedantic -Wno-long-long")
+
+add_definitions(-DBOOST_SPIRIT_USE_PHOENIX_V3)
+
 #---------------------------------------------------------------------------------------------------
 # add_dd4hep_plugin ( libraryName )
 #
diff --git a/cmake/FindROOT.cmake b/cmake/FindROOT.cmake
index 0c8b468aa..a57e8eb6e 100644
--- a/cmake/FindROOT.cmake
+++ b/cmake/FindROOT.cmake
@@ -101,7 +101,7 @@ function(root_generate_dictionary dictionary)
   #---call rootcint------------------------------------------
   add_custom_command(OUTPUT ${dictionary}.cxx ${dictionary}.h
                      COMMAND echo ${ROOTCINT_EXECUTABLE} -cint -f  ${dictionary}.cxx 
-                                          -c ${ARG_OPTIONS} ${includedirs} ${headerfiles} ${linkdefs} 
+                                          -c -p ${ARG_OPTIONS} ${includedirs} ${headerfiles} ${linkdefs} 
                      COMMAND ${ROOTCINT_EXECUTABLE} -f  ${dictionary}.cxx 
                                           -c -p ${ARG_OPTIONS} ${includedirs} ${headerfiles} ${linkdefs} 
                      DEPENDS ${headerfiles} ${linkdefs})
-- 
GitLab