[Rivet-svn] r2075 - trunk/bin

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Thu Nov 19 13:19:18 GMT 2009


Author: buckley
Date: Thu Nov 19 13:19:18 2009
New Revision: 2075

Log:
Adding HepMC include path to rivet-config --cppflags, and adding rivet-buildplugin convenience script

Added:
   trunk/bin/rivet-buildplugin   (contents, props changed)
Modified:
   trunk/bin/Makefile.am
   trunk/bin/rivet-config.in

Modified: trunk/bin/Makefile.am
==============================================================================
--- trunk/bin/Makefile.am	Thu Nov 19 12:45:52 2009	(r2074)
+++ trunk/bin/Makefile.am	Thu Nov 19 13:19:18 2009	(r2075)
@@ -1,4 +1,4 @@
-bin_SCRIPTS = rivet-config 
+bin_SCRIPTS = rivet-config rivet-buildplugin
 dist_bin_SCRIPTS = aida2flat aida2root compare-histos make-html make-plots rivet-mkanalysis chop_bins
 EXTRA_DIST = flat2aida
 

Added: trunk/bin/rivet-buildplugin
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/bin/rivet-buildplugin	Thu Nov 19 13:19:18 2009	(r2075)
@@ -0,0 +1,53 @@
+#! /usr/bin/env bash
+
+## Print help
+PROG=$(basename $0)
+tmp=$(echo $* | egrep -- '--\<help\>|-\<h\>')
+if test $# -lt 2 || test -n "$tmp"; then
+    echo "$PROG: compilation helper for Rivet analysis plugins"
+    echo
+    echo "Usage: $PROG <libname> <source1> [source2> ...]"
+    echo "<libname> can be a path, provided the filename is of the form 'Rivet*.so'"
+    echo
+    echo "Options:"
+    echo "  -h | --help: display this help message"
+    test -n "$tmp"
+    exit $?
+fi
+
+## Work out shared library build flags by platform
+shared_flags=
+SWVERS=`which sw_vers`
+if test "$SWVERS" && test -x "$SWVERS"; then
+  ## Mac OS X
+  shared_flags="-undefined dynamic_lookup -bundle"
+else
+  ## Unix
+  shared_flags="-shared -fPIC"
+fi
+
+## Get a C++ compiler
+if [[ -z "$CXX" ]]; then
+    CXX=g++
+fi
+
+## Get and check the library name
+libname=$1
+match=$(basename "$libname" | egrep '^Rivet.*\.so')
+if test -z "$match"; then
+    echo "Library name '$libname' does not have the required 'Rivet*.so' name pattern" 1>&2
+    exit 1
+fi
+
+## Get the source files
+shift
+sources="$@"
+
+## Get Rivet include flags
+RIVETCONFIG=$(PATH="$PATH:." which rivet-config)
+cppflags=$($RIVETCONFIG --cppflags)
+
+## Build
+cmd="$CXX -o \"$libname\" $shared_flags $cppflags $sources"
+echo $cmd
+eval $cmd

Modified: trunk/bin/rivet-config.in
==============================================================================
--- trunk/bin/rivet-config.in	Thu Nov 19 12:45:52 2009	(r2074)
+++ trunk/bin/rivet-config.in	Thu Nov 19 13:19:18 2009	(r2075)
@@ -61,7 +61,9 @@
 
 ## "Pre-rolled" build info
 tmp=$( echo "$*" | egrep -- '--\<cppflags\>')
-test -n "$tmp" && OUT="$OUT -I at includedir@"
+irivet="@includedir@"
+ihepmc="@HEPMCINCPATH@"
+test -n "$tmp" && OUT="$OUT -I${irivet} -I${ihepmc}"
 
 tmp=$( echo "$*" | egrep -- '--\<ldflags\>')
 test -n "$tmp" && OUT="$OUT -L at libdir@"


More information about the Rivet-svn mailing list