Skip to content
This repository has been archived by the owner on Sep 5, 2020. It is now read-only.

Commit

Permalink
Rename library and environmental variable pointing to installation path
Browse files Browse the repository at this point in the history
For the sake of backward compatibility, a variable with the old name is
still exported, and a symlink with the old name of the library is
provided.
  • Loading branch information
andrey-popov committed Apr 13, 2016
1 parent d764845 commit 5d555df
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 27 deletions.
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Check if the installation path of PECFwk is provided
ifeq ($(PEC_FWK_INSTALL), )
$(error Mandatory environment variable PEC_FWK_INSTALL is not set)
ifeq ($(MENSURA_INSTALL), )
$(error Mandatory environment variable MENSURA_INSTALL is not set)
endif

# Make sure ROOT is available
Expand Down Expand Up @@ -37,7 +37,7 @@ MODULES := $(MODULES_STATIC) $(MODULES_SHARED)

LIB_DIR := lib
# Library built from modules that do not produce shared libraries on their own
MAIN_LIB_NAME := libPECFwk.so
MAIN_LIB_NAME := libmensura.so
MAIN_LIB_PATH := $(LIB_DIR)/$(MAIN_LIB_NAME)


Expand All @@ -54,14 +54,15 @@ $(MAIN_LIB_PATH): $(MODULES_STATIC)
@ $(CC) -shared -Wl,-soname,$(MAIN_LIB_NAME).4 -o $@.4.0 \
-Wl,--whole-archive $(MODULE_STATIC_LIBS) -Wl,--no-whole-archive
@ ln -sf $(MAIN_LIB_NAME).4.0 $@.4; ln -sf $(MAIN_LIB_NAME).4 $@
@ ln -sf $(MAIN_LIB_NAME) $(LIB_DIR)/libPECFwk.so

link-libs: $(MODULES_SHARED)
@ mkdir -p $(LIB_DIR)
@ cd $(LIB_DIR); for m in $(MODULES_SHARED); \
do for f in `find $(PEC_FWK_INSTALL)/$(MODULES_DIR)/$$m/lib/ -regex ".*/lib.*\.so.*$$"`; \
do for f in `find $(MENSURA_INSTALL)/$(MODULES_DIR)/$$m/lib/ -regex ".*/lib.*\.so.*$$"`; \
do ln -sf $$f .; done \
done
@ cd $(LIB_DIR); ln -sf $(wildcard $(PEC_FWK_INSTALL)/$(MODULES_DIR)/PECReader/lib/*.pcm) .
@ cd $(LIB_DIR); ln -sf $(wildcard $(MENSURA_INSTALL)/$(MODULES_DIR)/PECReader/lib/*.pcm) .

$(MODULES):
@ +make -s -C $(MODULES_DIR)/$@
Expand Down
2 changes: 1 addition & 1 deletion Makefile.inc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Flags to control compilation and linking
CC = g++
INCLUDE = -I$(PEC_FWK_INSTALL)/include -I$(PEC_FWK_INSTALL) -I$(shell root-config --incdir) -I$(BOOST_ROOT)/include
INCLUDE = -I$(MENSURA_INSTALL)/include -I$(MENSURA_INSTALL) -I$(shell root-config --incdir) -I$(BOOST_ROOT)/include
OPFLAGS = -O2
CFLAGS = -Wall -Wextra -Wno-unused-function -fPIC -std=c++14 $(INCLUDE) $(OPFLAGS)
3 changes: 2 additions & 1 deletion env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ function set_environment

"-p")

export PEC_FWK_INSTALL=`pwd`
export MENSURA_INSTALL=`pwd`
export PEC_FWK_INSTALL=`pwd` # Provided for backward compatibility
#echo "Framework-specific variables have been set"
;;
esac
Expand Down
10 changes: 5 additions & 5 deletions include/mensura/core/FileInPath.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* \class FileInPath
* \brief Allows to resolve a (possibly) relative file path w.r.t. to several possible locations
*
* A relative path is first resolved w.r.t. to $PEC_FWK_INSTALL/data/, then w.r.t. the current
* A relative path is first resolved w.r.t. to $MENSURA_INSTALL/data/, then w.r.t. the current
* directory. Supports also an absolute path.
*/
class FileInPath
Expand All @@ -22,7 +22,7 @@ class FileInPath
/**
* \brief Constructor
*
* Reads the values of the PEC_FWK_INSTALL environmental variable and stores it in
* Reads the values of the MENSURA_INSTALL environmental variable and stores it in
* intallPath. If the variable is not set, an exception is thrown.
*/
FileInPath();
Expand All @@ -33,7 +33,7 @@ class FileInPath
*
* If an absolute path is given, the method returns it unchanged after verifying that such
* file exists. If the path is not absolute, the method tries to resolve it first w.r.t.
* $PEC_FWK_INSTALL/data/ then w.r.t. the current directory. If the path is resolved, which
* $MENSURA_INSTALL/data/ then w.r.t. the current directory. If the path is resolved, which
* means it points to an existing file, an equivalent absolute path is returned. Otherwise
* an exception is thrown.
*/
Expand All @@ -43,15 +43,15 @@ class FileInPath
* \brief Resolves the file path
*
* Does precisely the same as Resolve(string const &), but tries to resolve a relative path
* w.r.t. $PEC_FWK_INSTALL/data/$prefix/ instead of $PEC_FWK_INSTALL/data/.
* w.r.t. $MENSURA_INSTALL/data/$prefix/ instead of $MENSURA_INSTALL/data/.
*/
std::string Resolve(std::string const &prefix, std::string const &path) const;

private:
/**
* \brief Path in which the framework is intalled
*
* Read from the environmental variable PEC_FWK_INSTALL. The path stored in this variable
* Read from the environmental variable MENSURA_INSTALL. The path stored in this variable
* terminates with '/'.
*/
std::string installPath;
Expand Down
4 changes: 2 additions & 2 deletions include/mensura/extensions/PileUpWeight.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ class PileUpWeight: public AnalysisPlugin
* with any one). The second parameter is the name of a file with MC distributions over the
* "true" number of pile-up interactions before any event selection (it might differ from
* the nominal distribution due to a bug in random-number engine). The both file names are
* resolved w.r.t. directory $PEC_FWK_INSTALL/data/PileUp/. The last parameter is a
* desired systematical variation as defined in [1].
* resolved w.r.t. directory $MENSURA_INSTALL/data/PileUp/. The last parameter is a desired
* systematical variation as defined in [1].
* [1] https://twiki.cern.ch/twiki/bin/view/CMS/PileupSystematicErrors
*/
PileUpWeight(std::string const &name, std::string const &dataPUFileName,
Expand Down
4 changes: 2 additions & 2 deletions modules/PECReader/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Standard definitions
include $(PEC_FWK_INSTALL)/Makefile.inc
include $(MENSURA_INSTALL)/Makefile.inc


# Paths to source and object files
Expand Down Expand Up @@ -45,7 +45,7 @@ $(OBJ_DIR)/%.o: $(SOURCE_DIR)/%.cpp

$(SOURCE_DIR)/$(DICT_CPP_NAME).cpp: $(SOURCE_DIR)/classes.h $(SOURCE_DIR)/classes_def.xml
@ cd $(SOURCE_DIR); \
rootcling -f $(DICT_CPP_NAME).cpp -s $(LIB_NAME) -I$(PEC_FWK_INSTALL)/include \
rootcling -f $(DICT_CPP_NAME).cpp -s $(LIB_NAME) -I$(MENSURA_INSTALL)/include \
classes.h classes_def.xml
@ touch -r $(SOURCE_DIR)/$(DICT_CPP_NAME).cpp $(SOURCE_DIR)/$(DICT_PCM_NAME)
#^ In the first command of the recipe, rootcling produces cpp and pcm files. The $(DICT_PATH)
Expand Down
2 changes: 1 addition & 1 deletion modules/core/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Standard definitions
include $(PEC_FWK_INSTALL)/Makefile.inc
include $(MENSURA_INSTALL)/Makefile.inc


# Paths to source and object files
Expand Down
6 changes: 3 additions & 3 deletions modules/core/src/FileInPath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ using namespace std;
FileInPath::FileInPath()
{
// Read the install path from the environment
char const *path = getenv("PEC_FWK_INSTALL");
char const *path = getenv("MENSURA_INSTALL");

if (not path)
throw runtime_error("FileInPath::FileInPath: Mandatory environment variable "
"PEC_FWK_INSTALL is not defined.");
"MENSURA_INSTALL is not defined.");


installPath = path;
Expand Down Expand Up @@ -54,7 +54,7 @@ string FileInPath::Resolve(string const &prefix, string const &path) const
canonicalPrefix += '/';


// Try to resolve the path w.r.t. $PEC_FWK_INSTALL/data/
// Try to resolve the path w.r.t. $MENSURA_INSTALL/data/
string tryPath = installPath + "/data/" + canonicalPrefix + path;

if (boost::filesystem::exists(tryPath))
Expand Down
2 changes: 1 addition & 1 deletion modules/extensions/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Standard definitions
include $(PEC_FWK_INSTALL)/Makefile.inc
include $(MENSURA_INSTALL)/Makefile.inc


# Paths to source and object files
Expand Down
2 changes: 1 addition & 1 deletion modules/external/BTagCalibration/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Standard definitions
include $(PEC_FWK_INSTALL)/Makefile.inc
include $(MENSURA_INSTALL)/Makefile.inc


# Paths to source and object files
Expand Down
2 changes: 1 addition & 1 deletion modules/external/JERC/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Standard definitions
include $(PEC_FWK_INSTALL)/Makefile.inc
include $(MENSURA_INSTALL)/Makefile.inc


# Paths to source and object files
Expand Down
8 changes: 4 additions & 4 deletions test/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Check if an installation path of PECFwk is provided
ifeq ($(PEC_FWK_INSTALL), )
$(error Mandatory environment variable PEC_FWK_INSTALL is not set)
ifeq ($(MENSURA_INSTALL), )
$(error Mandatory environment variable MENSURA_INSTALL is not set)
endif

# Make sure ROOT is available
Expand All @@ -15,11 +15,11 @@ endif


# Flags to control compilation and linking
INCLUDE := -I$(PEC_FWK_INSTALL)/include -I$(shell root-config --incdir)
INCLUDE := -I$(MENSURA_INSTALL)/include -I$(shell root-config --incdir)
OPFLAGS := -O2
CFLAGS := -Wall -Wextra -std=c++14 $(INCLUDE) $(OPFLAGS)
LDFLAGS := $(shell root-config --libs) -lTreePlayer -lHistPainter \
-L$(PEC_FWK_INSTALL)/lib -lPECFwk -lPECReader -Wl,-rpath=$(PEC_FWK_INSTALL)/lib \
-L$(MENSURA_INSTALL)/lib -lmensura -lPECReader -Wl,-rpath=$(MENSURA_INSTALL)/lib \
-L$(BOOST_ROOT)/lib -lboost_filesystem -Wl,-rpath=$(BOOST_ROOT)/lib


Expand Down

0 comments on commit 5d555df

Please sign in to comment.