From 0b7276ad66670fcd5785600ed15296cf2cb3e0e8 Mon Sep 17 00:00:00 2001 From: nicolas <nicolas@nptool> Date: Fri, 11 Jan 2013 15:51:18 +0000 Subject: [PATCH] * Modify configure script and DetectorManager.cxx in order to compile only the part of DetectorManager which corresponds to the detector given as arguments of the configure script --- NPLib/VDetector/DetectorManager.cxx | 27 ++++++++++++++++++ NPLib/configure | 44 +++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) diff --git a/NPLib/VDetector/DetectorManager.cxx b/NPLib/VDetector/DetectorManager.cxx index 089dee5da..d3954a3ae 100644 --- a/NPLib/VDetector/DetectorManager.cxx +++ b/NPLib/VDetector/DetectorManager.cxx @@ -6,6 +6,7 @@ #include <cstdlib> // Detector +#include "DetectorList.inc" #include "TMust2Physics.h" #include "TCATSPhysics.h" #include "TSSSDPhysics.h" @@ -101,6 +102,7 @@ void DetectorManager::ReadConfigurationFile(string Path) //////////// Search for Gaspard //////////// //////////////////////////////////////////// else if (LineBuffer.compare(0, 14, "GaspardTracker") == 0 && GPDTracker == false) { +#ifdef GASPARD GPDTracker = true ; cout << "//////// Gaspard Tracker ////////" << endl; @@ -114,11 +116,13 @@ void DetectorManager::ReadConfigurationFile(string Path) // Add array to the VDetector Vector AddDetector("GASPARD", myDetector); +#endif } //////////////////////////////////////////// //////////// Search for Hyde //////////// //////////////////////////////////////////// else if (LineBuffer.compare(0, 11, "HydeTracker") == 0 && HYDTracker == false) { +#ifdef HYDE HYDTracker = true ; cout << "//////// Hyde Tracker ////////" << endl; @@ -132,11 +136,13 @@ void DetectorManager::ReadConfigurationFile(string Path) // Add array to the VDetector Vector AddDetector("HYDE", myDetector); +#endif } //////////////////////////////////////////// ///////////// Search for Paris ///////////// //////////////////////////////////////////// else if (LineBuffer.compare(0, 5, "Paris") == 0 && ParisDet == false) { +#ifdef PARIS ParisDet = true; cout << "//////// Paris ////////" << endl << endl; @@ -149,11 +155,13 @@ void DetectorManager::ReadConfigurationFile(string Path) // Add array to the VDetector Vector AddDetector("PARIS", myDetector); +#endif } //////////////////////////////////////////// ///////////// Search for Paris' Shield ///// //////////////////////////////////////////// else if (LineBuffer.compare(0, 6, "Shield") == 0 && ShieldDet == false) { +#ifdef SHIELD ShieldDet = true; cout << "//////// Shield ////////" << endl << endl; @@ -166,12 +174,14 @@ void DetectorManager::ReadConfigurationFile(string Path) // Add array to the VDetector Vector AddDetector("SHIELD", myDetector); +#endif } //////////////////////////////////////////// //////// Search for MUST2 Array //////// //////////////////////////////////////////// else if (LineBuffer.compare(0, 10, "MUST2Array") == 0 && MUST2 == false) { +#ifdef MUST2 MUST2 = true; cout << "//////// MUST2 Array ////////" << endl << endl; @@ -185,12 +195,14 @@ void DetectorManager::ReadConfigurationFile(string Path) // Add array to the VDetector Vector AddDetector("MUST2", myDetector); +#endif } //////////////////////////////////////////// //////// Search for CATS Array //////// //////////////////////////////////////////// else if (LineBuffer.compare(0, 9, "CATSArray") == 0 && CATS == false) { +#ifdef CATS MUST2 = true; cout << "//////// CATS Array ////////" << endl << endl; @@ -204,12 +216,14 @@ void DetectorManager::ReadConfigurationFile(string Path) // Add array to the VDetector Vector AddDetector("CATS", myDetector); +#endif } //////////////////////////////////////////// ////////// Search for W1 (Micron) ///////// //////////////////////////////////////////// else if (LineBuffer.compare(0, 2, "W1") == 0 && W1 == false) { +#ifdef W1 W1 = true; cout << "//////// W1 ////////" << endl; @@ -223,12 +237,14 @@ void DetectorManager::ReadConfigurationFile(string Path) // Add array to the VDetector Vector AddDetector("W1", myDetector); +#endif } //////////////////////////////////////////// ////////// Search for SSSD ///////// //////////////////////////////////////////// else if (LineBuffer.compare(0, 9, "SSSDArray") == 0 && SSSD == false) { +#ifdef SSSD SSSD = true ; cout << "//////// SSSD ////////" << endl << endl; @@ -242,12 +258,14 @@ void DetectorManager::ReadConfigurationFile(string Path) // Add array to the VDetector Vector AddDetector("SSSD", myDetector); +#endif } //////////////////////////////////////////// ///////////// Search for Plastic /////////// //////////////////////////////////////////// else if (LineBuffer.compare(0, 19, "ScintillatorPlastic") == 0 && ScintillatorPlastic == false) { +#ifdef PLASTIC ScintillatorPlastic = true; cout << "//////// Plastic ////////" << endl << endl; @@ -260,12 +278,14 @@ void DetectorManager::ReadConfigurationFile(string Path) // Add array to the VDetector Vector AddDetector("Plastic", myDetector); +#endif } //////////////////////////////////////////// ///////////// Search for SPEG ////////////// //////////////////////////////////////////// else if (LineBuffer.compare(0, 4, "SPEG") == 0 && SPEG == false) { +#ifdef SPEG SPEG = true ; cout << "//////// SPEG Spectrometer ////////" << endl; @@ -279,12 +299,14 @@ void DetectorManager::ReadConfigurationFile(string Path) // Add array to the VDetector Vector AddDetector("SPEG", myDetector); +#endif } /////////////////////////////////////////////////////////// //////////// Search for EXL Csi gamma detector //////////// /////////////////////////////////////////////////////////// else if (LineBuffer.compare(0, 3, "EXL") == 0 && EXL == false) { +#ifdef EXL EXL = true ; cout << "//////// EXL Csi gamma detector ////////" << endl; @@ -298,12 +320,14 @@ void DetectorManager::ReadConfigurationFile(string Path) // Add array to the VDetector Vector AddDetector("EXL", myDetector); +#endif } //////////////////////////////////////////// ////////////// Search for TAC ////////////// //////////////////////////////////////////// else if (LineBuffer.compare(0, 3, "TAC") == 0 && TAC == false) { +#ifdef TAC TAC = true ; cout << "//////// TAC ////////" << endl; @@ -317,12 +341,14 @@ void DetectorManager::ReadConfigurationFile(string Path) // Add array to the VDetector Vector AddDetector("TAC", myDetector); +#endif } //////////////////////////////////////////// ///////////// Search for Trifoil /////////// //////////////////////////////////////////// else if (LineBuffer.compare(0, 7, "Trifoil") == 0 && Trifoil == false) { +#ifdef TRIFOIL Trifoil = true; cout << "//////// Trifoil ////////" << endl << endl; @@ -335,6 +361,7 @@ void DetectorManager::ReadConfigurationFile(string Path) // Add array to the VDetector Vector AddDetector("Trifoil", myDetector); +#endif } //////////////////////////////////////////// diff --git a/NPLib/configure b/NPLib/configure index 9d915cab2..3076a6ea2 100755 --- a/NPLib/configure +++ b/NPLib/configure @@ -130,6 +130,50 @@ do done +########################################################################## +# Create DetectorList.inc file in VDetector directory used for compiling # +# only the detectors given in arguments # +########################################################################## +# output file +outfile="VDetector/DetectorList.inc" +echo " + Creating $outfile file....." + +# if output file exists delete it +if [ -e $outfile ] ; then + rm $outfile +fi ; + +# create output file +echo "// WARNING:" >> $outfile +echo "// This file is automatically generated by the configure script." >> $outfile +echo "// If you modify this file by hand, changes won't persist the next time you run ./configure." >> $outfile +echo "//" >> $outfile + +# loop recursively on sub-directories containing a Makefile file +for file in */Makefile +do + # remove "Makefile" string from file name + name=${file%\/*} + # file name in lower/upper case + lname=$(echo "$name" | tr '[A-Z]' '[a-z]') + uname=$(echo "$name" | tr '[a-z]' '[A-Z]') + # if no arguments are given, add all detectors in Makefile.detector + # by default + if [ $# = 0 ] ; then + # build target + echo "#define $uname" >> $outfile + else + # only add Makefile.detector target if it is in the + # arguments list + if echo "$args" | grep -q "$lname" ; then + # build target + echo "#define $uname" >> $outfile + fi ; + fi ; +done + + + ######################## # Build core libraries # ######################## -- GitLab