Skip to content

Commit

Permalink
- remove manual Ttree loading in executable needed by Ubuntu v>11.0 a…
Browse files Browse the repository at this point in the history
…nd handle the issue in CMakeLists

- correct a typo in Readme.md of the FairRoot installation
  • Loading branch information
NicolasWinckler committed Jul 1, 2015
1 parent e2157f5 commit 75ab8a4
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 25 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The template demonstrate and implement the following:

1. Install [FairSoft](https://github.com/FairRootGroup/FairSoft/tree/dev)

we use here "fair_install" as a directory name, you can use what you went!
we use here "fair_install" as a directory name, you can use what you want!
```bash
mkdir ~/fair_install
cd ~/fair_install
Expand Down
52 changes: 48 additions & 4 deletions example/Tutorial7/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
# GNU Lesser General Public Licence version 3 (LGPL) version 3, #
# copied verbatim in the file "LICENSE" #
################################################################################
# Create a library called "libFairTestDetector" which includes the source files given in
# the array .
# The extension is already found. Any number of sources could be listed here.
# Create a library called "libTutorial7"

set(INCLUDE_DIRECTORIES
${BASE_INCLUDE_DIRECTORIES}
Expand Down Expand Up @@ -129,6 +127,52 @@ If (Boost_FOUND)
run/FairTestDetector/runFileSinkBinT7b.cxx
)

############################################################
# Check if we run on Ubuntu version>=11 and if it is the case
# add --no-as-needed flag to the linker.
# it is needed on Ubuntu xx>=11 to load Ttree in executables
# see : https://root.cern.ch/phpBB3/viewtopic.php?f=3&t=14064
# Alternative is to instantiate a TApplication or load manually with gsystem in main file
set(UBUNTU_GREATERTHAN_v11_LINKER_FLAG )

if(NOT CMAKE_SYSTEM_NAME MATCHES Darwin)
# use the LSB stuff if possible
EXECUTE_PROCESS(
COMMAND cat /etc/lsb-release
COMMAND grep DISTRIB_ID
COMMAND awk -F= "{ print $2 }"
COMMAND tr "\n" " "
COMMAND sed "s/ //"
OUTPUT_VARIABLE LSB_ID
RESULT_VARIABLE LSB_ID_RESULT
)
EXECUTE_PROCESS(
COMMAND cat /etc/lsb-release
COMMAND grep DISTRIB_RELEASE
COMMAND awk -F= "{ print $2 }"
COMMAND tr "\n" " "
COMMAND sed "s/ //"
OUTPUT_VARIABLE LSB_VER
RESULT_VARIABLE LSB_VER_RESULT
)

#message("LSB output: ${LSB_ID_RESULT}:${LSB_ID} ${LSB_VER_RESULT}:${LSB_VER}")
if(NOT ${LSB_ID} STREQUAL "")
# found some, use it :D
set(INSTALLER_PLATFORM "${LSB_ID}-${LSB_VER}" CACHE PATH "Installer chosen platform")
if(${LSB_ID} STREQUAL "Ubuntu" AND ${LSB_VER} VERSION_GREATER "10.0")
#message(STATUS "Running on ${INSTALLER_PLATFORM} which is more recent than Ubuntu 11.0")
#message(STATUS "--no-as-needed flag is added to the linker of Tutorial7 executables")
set(UBUNTU_GREATERTHAN_v11_LINKER_FLAG "-Wl,--no-as-needed")
endif()
else(NOT ${LSB_ID} STREQUAL "")
set(INSTALLER_PLATFORM "linux-generic" CACHE PATH "Installer chosen platform")
endif(NOT ${LSB_ID} STREQUAL "")
endif(NOT CMAKE_SYSTEM_NAME MATCHES Darwin)
############################################################



List(LENGTH Exe_Names _length)
Math(EXPR _length ${_length}-1)

Expand All @@ -137,7 +181,7 @@ If (Boost_FOUND)
List(GET Exe_Source ${_file} _src)
Set(EXE_NAME ${_name})
Set(SRCS ${_src})
Set(DEPENDENCIES Tutorial7)
Set(DEPENDENCIES Tutorial7 ${UBUNTU_GREATERTHAN_v11_LINKER_FLAG})
GENERATE_EXECUTABLE()
EndForEach(_file RANGE 0 ${_length})
EndIf (Boost_FOUND)
4 changes: 0 additions & 4 deletions example/Tutorial7/run/FairTestDetector/runSamplerBinT7b.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@
#include "MyDigiSerializer.h"
#include "SimpleTreeReader.h"

/// ROOT
#include "TSystem.h"

using namespace std;

typedef Tuto3DigiSerializer_t SerializerPolicy;
Expand Down Expand Up @@ -149,7 +146,6 @@ int main(int argc, char** argv)
try
{
s_catch_signals();
gSystem->Load("libTree.so");
DeviceOptions_t options;
try
{
Expand Down
4 changes: 0 additions & 4 deletions example/Tutorial7/run/FairTestDetector/runSamplerBoostT7b.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@
// payload/data class
#include "FairTestDetectorDigi.h"

/// ROOT
#include "TSystem.h"

using namespace std;
/// ////////////////////////////////////////////////////////////////////////
// payload definition
Expand Down Expand Up @@ -160,7 +157,6 @@ int main(int argc, char** argv)
try
{
s_catch_signals();
gSystem->Load("libTree.so");
DeviceOptions_t options;
try
{
Expand Down
4 changes: 0 additions & 4 deletions example/Tutorial7/run/runSamplerBinT7.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@
#include "MyDigiSerializer.h"
#include "MyDigi.h"

/// ROOT
#include "TSystem.h"

using namespace std;
/// ////////////////////////////////////////////////////////////////////////
// payload and policy type definitions
Expand Down Expand Up @@ -163,7 +160,6 @@ int main(int argc, char** argv)
try
{
s_catch_signals();
gSystem->Load("libTree.so");
DeviceOptions_t options;
try
{
Expand Down
4 changes: 0 additions & 4 deletions example/Tutorial7/run/runSamplerBoostT7.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@
/// FairRoot - Tutorial 7
#include "MyDigi.h"

/// ROOT
#include "TSystem.h"

using namespace std;
/// ////////////////////////////////////////////////////////////////////////
// payload and policy type definitions
Expand Down Expand Up @@ -167,7 +164,6 @@ int main(int argc, char** argv)
try
{
s_catch_signals();
gSystem->Load("libTree.so");
DeviceOptions_t options;
try
{
Expand Down
4 changes: 0 additions & 4 deletions example/Tutorial7/run/runSamplerRootT7.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@
/// FairRoot - Tutorial 7
#include "MyDigi.h"

/// ROOT
#include "TSystem.h"

using namespace std;
/// ////////////////////////////////////////////////////////////////////////
// payload and policy type definitions
Expand Down Expand Up @@ -164,7 +161,6 @@ int main(int argc, char** argv)
try
{
s_catch_signals();
gSystem->Load("libTree.so");
DeviceOptions_t options;
try
{
Expand Down

0 comments on commit 75ab8a4

Please sign in to comment.