Skip to content
Snippets Groups Projects
Commit 54c52c3b authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

adjust compilation settings to link in plumed library statically and all its dependencies

parent df3390e2
No related branches found
No related tags found
No related merge requests found
/plumed2* /plumed2*
/includelink /includelink
/liblink /liblink
/plumed-*
...@@ -156,7 +156,6 @@ if buildflag: ...@@ -156,7 +156,6 @@ if buildflag:
if not checkmd5sum(checksums[version],filename): if not checkmd5sum(checksums[version],filename):
error("Checksum for plumed2 library does not match") error("Checksum for plumed2 library does not match")
print("Unpacking plumed2 tarball ...") print("Unpacking plumed2 tarball ...")
if os.path.exists("%s/plumed2-%s" % (homepath,version)): if os.path.exists("%s/plumed2-%s" % (homepath,version)):
cmd = 'rm -rf "%s/plumed2-%s"' % (homepath,version) cmd = 'rm -rf "%s/plumed2-%s"' % (homepath,version)
...@@ -188,3 +187,7 @@ if linkflag: ...@@ -188,3 +187,7 @@ if linkflag:
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
cmd = 'ln -s "%s/plumed2/lib" liblink' % homepath cmd = 'ln -s "%s/plumed2/lib" liblink' % homepath
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
if os.path.isfile("Makefile.lammps.static"):
print("Creating Makefile.lammps")
cmd = 'cat liblink/plumed/src/lib/Plumed.inc.static Makefile.lammps.static > Makefile.lammps'
# Settings that the LAMMPS build will import when this package library is used
plumed_SYSINC =
plumed_SYSLIB = $(PLUMED_LOAD)
plumed_SYSPATH =
# Install/unInstall package files in LAMMPS # Install/unInstall package files in LAMMPS
# edit 2 Makefile.package files to include/exclude ATC info # mode = 0/1/2 for uninstall/install/update
mode=$1
# enforce using portable C locale
LC_ALL=C
export LC_ALL
# arg1 = file, arg2 = file it depends on
action () {
if (test $mode = 0) then
rm -f ../$1
elif (! cmp -s $1 ../$1) then
if (test -z "$2" || test -e ../$2) then
cp $1 ..
if (test $mode = 2) then
echo " updating src/$1"
fi
fi
elif (test -n "$2") then
if (test ! -e ../$2) then
rm -f ../$1
fi
fi
}
# all package files with no dependencies
for file in *.cpp *.h; do
test -f ${file} && action $file
done
# edit 2 Makefile.package files to include/exclude package info
if (test $1 = 1) then if (test $1 = 1) then
if (test -e ../Makefile.package) then if (test -e ../Makefile.package) then
sed -i -e 's|^PKG_LIB =[ \t]*|& -lplumedWrapper -ldl |' ../Makefile.package sed -i -e 's/[^ \t]*plumed[^ \t]* //' ../Makefile.package
if ( ! test -e ../../lib/plumed/liblink/plumed/src/lib/Plumed.inc.static ) then
sed -i -e 's|^PKG_SYSINC =[ \t]*|& -D__PLUMED_HAS_DLOPEN |' ../Makefile.package
fi
sed -i -e 's|^PKG_INC =[ \t]*|&-I../../lib/plumed/includelink |' ../Makefile.package sed -i -e 's|^PKG_INC =[ \t]*|&-I../../lib/plumed/includelink |' ../Makefile.package
sed -i -e 's|^PKG_PATH =[ \t]*|&-L../../lib/plumed/liblink |' ../Makefile.package sed -i -e 's|^PKG_SYSINC =[ \t]*|&$(plumed_SYSINC) |' ../Makefile.package
sed -i -e 's|^PKG_SYSLIB =[ \t]*|&$(plumed_SYSLIB) |' ../Makefile.package
sed -i -e 's|^PKG_SYSPATH =[ \t]*|&$(plumed_SYSPATH) |' ../Makefile.package
fi fi
if (test -e ../Makefile.package.settings) then if (test -e ../Makefile.package.settings) then
# This is for statically linking plumed2 sed -i -e '/^include.*plumed.*$/d' ../Makefile.package.settings
if ( test -e ../../lib/plumed/liblink/src/lib/Plumed.inc.static ) then
fname=../../lib/plumed/liblink/src/lib/Plumed.inc.static
sed -i -e '4 i \
include '$fname'
' ../Makefile.package.settings
# This is for linking plumed2 as a runtime library -- this is the default behavior
else
# multiline form needed for BSD sed on Macs # multiline form needed for BSD sed on Macs
sed -i -e '4 i \ sed -i -e '4 i \
PLUMED_LOAD=-ldl include ..\/..\/lib\/plumed\/Makefile.lammps
' ../Makefile.package.settings ' ../Makefile.package.settings
fi
fi fi
cp fix_plumed.cpp ..
cp fix_plumed.h ..
elif (test $1 = 0) then elif (test $1 = 0) then
if (test -e ../Makefile.package) then if (test -e ../Makefile.package) then
sed -i -e 's/[^ \t]*-lplumedWrapper -ldl[^ \t]* //' ../Makefile.package sed -i -e 's/[^ \t]*plumed[^ \t]* //' ../Makefile.package
sed -i -e 's/[^ \t]*-D__PLUMED_HAS_DLOPEN[^ \t]* //' ../Makefile.package fi
sed -i -e 's|[^ \t]*-I../../lib/plumed/includelink[^ \t]* ||' ../Makefile.package
sed -i -e 's|[^ \t]*-L../../lib/plumed/liblink[^ \t]* ||' ../Makefile.package if (test -e ../Makefile.package.settings) then
sed -i -e '/^include.*plumed.*$/d' ../Makefile.package.settings
fi fi
rm -f ../fix_plumed.cpp
rm -f ../fix_plumed.h
fi fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment