]> git.uio.no Git - u/mrichter/AliRoot.git/blob - cmake/PARfiles/SETUP.C.in
Update master to aliroot
[u/mrichter/AliRoot.git] / cmake / PARfiles / SETUP.C.in
1 // Automatically generated SETUP.C for @PARMODULE@
2
3 Int_t SETUP()
4 {
5   TString buf;
6   const char *wd = gSystem->WorkingDirectory();
7
8   // Set include path for CINT (PARfile is unpacked as a subfolder of current workdir)
9   // TODO: prepend path instead of appending (not currently supported by ROOT!)
10   buf.Form(".include %s", wd);
11   gROOT->ProcessLine(buf.Data());
12
13   // Prepend include path for compiled code
14   buf.Form("-I%s %s", wd, gSystem->GetIncludePath());
15   gSystem->SetIncludePath(buf.Data());
16
17   // Prepend library path
18   buf.Form("%s:%s", wd, gSystem->GetDynamicPath());
19   gSystem->SetDynamicPath(buf.Data());
20
21   // Add our rootmap
22   // TODO: disabled because it triggers actual library loading wherever it finds nested classes!
23   // (this is a ROOT bug)
24   // buf.Form("%s/lib@PARMODULE@.rootmap", wd);
25   // gInterpreter->UnloadLibraryMap("lib@PARMODULE@");
26   // gInterpreter->LoadLibraryMap(buf.Data());
27
28   // Append this PARfile's name to the list of currently enabled ones in an environment variable.
29   // The variable will be used by other PARfiles in order to correctly set some paths during the
30   // PARfile build process
31   const char *parEnvVarName = "ALICE_PARFILES_ENABLED";
32   TString parEnvVar = gSystem->Getenv(parEnvVarName);
33   if (!parEnvVar.IsNull()) {
34     parEnvVar.Append(" ");
35   }
36   parEnvVar.Append("@PARMODULE@");
37   gSystem->Setenv(parEnvVarName, parEnvVar.Data());
38
39   // Here we load the library, but beware: if using multiple PARfiles for overriding multiple
40   // AliRoot libraries, they must be loaded in the correct order. With the autoloading, it might
41   // happen that the *wrong* library gets loaded as a dependency
42   gSystem->Load("lib@PARMODULE@");
43
44   return 0;
45 }