]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
PAR: generate rootmap
authordberzano <dario.berzano@cern.ch>
Tue, 27 Jan 2015 21:19:57 +0000 (22:19 +0100)
committerdberzano <dario.berzano@cern.ch>
Thu, 29 Jan 2015 11:57:51 +0000 (12:57 +0100)
cmake/GenParFile.cmake
cmake/PARfiles/Makefile.in
cmake/PARfiles/SETUP.C.in

index 97e5433ed8e6ea83d07fea3d750a5c24a9b5374b..78d5784723af73c22fc8c90fe64f9c5870b322f2 100644 (file)
@@ -1,12 +1,20 @@
-macro(add_parfile PARMODULE PARSOURCES PARHEADERS PARLINKDEF)
+macro(add_parfile PARMODULE PARSOURCES PARHEADERS PARLINKDEF PARLIBDEPS)
 
   message(STATUS "PARfile generation: ${PARMODULE}")
-  message(STATUS "--> Module: ${PARMODULE}")
-  message(STATUS "--> Sources: ${PARSOURCES}")
+
+  # Libraries
+  foreach(THISLIB ${PARLIBDEPS})
+    set(_PARLIBDEPS "${_PARLIBDEPS} lib${THISLIB}")
+  endforeach()
+  string(STRIP "${_PARLIBDEPS}" PARLIBDEPS)
 
   # Export variable
   set(PARMODULE "${PARMODULE}")
 
+  message(STATUS "--> Module: ${PARMODULE}")
+  message(STATUS "--> Sources: ${PARSOURCES}")
+  message(STATUS "--> Deps: ${PARLIBDEPS}")
+
   foreach(LOOPVAR ${PARSOURCES})
     message(STATUS "----> ${LOOPVAR}")
   endforeach()
index e8d11eff443f28038dae0d834696b1bf5e9be233..d580f11491a3cea1496f5d363119ae66bf917fbf 100644 (file)
@@ -6,6 +6,9 @@ include Makefile.arch
 # Name of this module
 PAR_MODULE := @PARMODULE@
 
+# This module depends on the following libraries
+PAR_LIBDEPS := @PARLIBDEPS@
+
 # Include paths
 PAR_INCLUDES = -I. -I$(ALICE_ROOT)/include -I$(ALICE_PHYSICS)/include -I$(ROOTSYS)/include
 
@@ -30,7 +33,7 @@ COLG := \033[32m
 COLZ := \033[m
 
 # Default rule (it's the first one, "all" is just a convention)
-all: lib$(PAR_MODULE).so
+all: lib$(PAR_MODULE).rootmap lib$(PAR_MODULE).so
        @echo -e "[$(COLM)$(PAR_MODULE)$(COLZ)] $(COLG)PARfile built successfully$(COLZ)"
 
 # Abstract rule to compile classes to objects
@@ -50,6 +53,11 @@ G__$(PAR_MODULE).cxx: $(HDRS) $(DHDR)
        @echo -e "[$(COLM)$(PAR_MODULE)$(COLZ)]" generating dictionary
        @rootcint -f $@ -c -p $(PAR_INCLUDES) $^
 
+# Generate rootmap (for automatic loading of libraries)
+lib$(PAR_MODULE).rootmap: lib$(PAR_MODULE).so
+       @echo -e "[$(COLM)$(PAR_MODULE)$(COLZ)]" generating rootmap
+       @rlibmap -o $@ -l lib$(PAR_MODULE) -d $(PAR_LIBDEPS) -c $(DHDR)
+
 # Delete all
 clean:
-       rm -f $(OBJS) *.so G__$(PAR_MODULE).*
+       rm -f $(OBJS) *.so G__$(PAR_MODULE).* *.rootmap
index cf01e48a30351dc3559b269aeb055a91288cfcf1..033162adc98f1c64657983664fd6b1d648a98646 100644 (file)
@@ -6,10 +6,11 @@ Int_t SETUP()
   const char *wd = gSystem->WorkingDirectory();
 
   // Set include path for CINT (PARfile is unpacked as a subfolder of current workdir)
+  // TODO: prepend path instead of appending (not currently supported by ROOT!)
   buf.Form(".include %s", wd);
   gROOT->ProcessLine(buf.Data());
 
-  // Prepend include path for other stuff
+  // Prepend include path for compiled code
   buf.Form("-I%s %s", wd, gSystem->GetIncludePath());
   gSystem->SetIncludePath(buf.Data());
 
@@ -17,18 +18,13 @@ Int_t SETUP()
   buf.Form("%s:%s", wd, gSystem->GetDynamicPath());
   gSystem->SetDynamicPath(buf.Data());
 
-  // Load library
-  if ( gSystem->Load("lib@PARMODULE@") < 0 ) {
-    // Error loading
-    return -1;
-  }
+  // Add our rootmap
+  // TODO: disabled because it triggers actual library loading wherever it finds nested classes!
+  // buf.Form("%s/lib@PARMODULE@.rootmap", wd);
+  // gInterpreter->UnloadLibraryMap("lib@PARMODULE@");
+  // gInterpreter->LoadLibraryMap(buf.Data());
 
-  // Set our location, so that other packages can find us
-  //gSystem->Setenv("@PARMODULE@_INCLUDE", "@PARMODULE@");
-
-  // Set our lib coordinates, so that other packages can link to us
-  //buf.Form("-L%s -l@PARMODULE@", wd);
-  //gSystem->Setenv("@PARMODULE@_LIBS", buf.Data());
+  // Note: there is no need to actually load the library thanks to the rootmap
 
   return 0;
 }