Traditional make process auto-download works
Implemented via Install.py script
This commit is contained in:
@ -17,16 +17,16 @@ parser = ArgumentParser(prog='Install.py',
|
||||
|
||||
# settings
|
||||
|
||||
version = "2.1.3"
|
||||
version = "2.1.4"
|
||||
|
||||
# help message
|
||||
|
||||
HELP = """
|
||||
Syntax from src dir: make lib-hdnnp args="-b"
|
||||
or: make lib-hdnnp args="-b -v 2.1.3"
|
||||
or: make lib-hdnnp args="-b -v 2.1.4"
|
||||
or: make lib-hdnnp args="-p /usr/local/n2p2"
|
||||
|
||||
Syntax from lib dir: python Install.py -b -v 2.1.3
|
||||
Syntax from lib dir: python Install.py -b -v 2.1.4
|
||||
or: python Install.py -b
|
||||
or: python Install.py -p /usr/local/n2p2
|
||||
|
||||
@ -38,7 +38,7 @@ make lib-hdnnp args="-p $HOME/n2p2" # use existing n2p2 installation in $HOME/n2
|
||||
|
||||
# known checksums for different n2p2 versions. used to validate the download.
|
||||
checksums = { \
|
||||
'2.1.3' : '5cd30194701db198e4a72ee94fa6e0db', \
|
||||
'2.1.4' : '9595b066636cd6b90b0fef93398297a5', \
|
||||
}
|
||||
|
||||
# parse and process arguments
|
||||
@ -61,7 +61,6 @@ if not args.build and not args.path:
|
||||
buildflag = args.build
|
||||
pathflag = args.path is not None
|
||||
n2p2path = args.path
|
||||
mode = args.mode
|
||||
|
||||
homepath = fullpath('.')
|
||||
homedir = "%s/n2p2" % (homepath)
|
||||
@ -98,7 +97,7 @@ if buildflag:
|
||||
# build n2p2
|
||||
print("Building n2p2 ...")
|
||||
n_cpus = get_cpus()
|
||||
cmd = 'cd %s/n2p2-%s/src; make -j%d libnnpif' % (homepath, version, n_cpus)
|
||||
cmd = 'unset MAKEFLAGS MAKELEVEL MAKEOVERRIDES MFLAGS && cd %s/n2p2-%s/src && make -j%d libnnpif' % (homepath, version, n_cpus)
|
||||
try:
|
||||
txt = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
|
||||
print(txt.decode('UTF-8'))
|
||||
@ -106,6 +105,9 @@ if buildflag:
|
||||
print("Make failed with:\n %s" % e.output.decode('UTF-8'))
|
||||
sys.exit(1)
|
||||
|
||||
# set correct homedir for linking step
|
||||
homedir = "%s/n2p2-%s" % (homepath, version)
|
||||
|
||||
# create 2 links in lib/hdnnp to n2p2 installation dir
|
||||
|
||||
print("Creating links to n2p2 include and lib files")
|
||||
@ -113,5 +115,8 @@ if os.path.isfile("includelink") or os.path.islink("includelink"):
|
||||
os.remove("includelink")
|
||||
if os.path.isfile("liblink") or os.path.islink("liblink"):
|
||||
os.remove("liblink")
|
||||
os.symlink(os.path.join(homedir, 'src'), 'includelink')
|
||||
os.symlink(os.path.join(homedir, 'src'), 'liblink')
|
||||
if os.path.isfile("Makefile.lammps") or os.path.islink("Makefile.lammps"):
|
||||
os.remove("Makefile.lammps")
|
||||
os.symlink(os.path.join(homedir, 'include'), 'includelink')
|
||||
os.symlink(os.path.join(homedir, 'lib'), 'liblink')
|
||||
os.symlink(os.path.join(homedir, 'lib', 'Makefile.lammps-extra'), 'Makefile.lammps')
|
||||
|
||||
@ -1,24 +0,0 @@
|
||||
# Settings that the LAMMPS build will import when this package library is used
|
||||
# Normally, you do NOT need to edit this file!
|
||||
|
||||
# Check out if n2p2 or a link is right here.
|
||||
N2P2_LOCALDIR=$(realpath ../../lib/hdnnp/n2p2)
|
||||
ifeq ($(N2P2_DIR),)
|
||||
N2P2_DIR=$(shell test -d $(N2P2_LOCALDIR) && echo $(N2P2_LOCALDIR))
|
||||
else
|
||||
# If n2p2 is not found in this directory then use environment variable or set manually here:
|
||||
# N2P2_DIR=
|
||||
endif
|
||||
|
||||
# Give up if n2p2 not found yet.
|
||||
ifeq ($(N2P2_DIR),)
|
||||
$(error Cannot find library for USER-HDNNP package, please set environment or make variable N2P2_DIR manually.)
|
||||
endif
|
||||
|
||||
# Read extra N2P2_ compilation flags from makefile provided by n2p2:
|
||||
include $(N2P2_DIR)/lib/Makefile.lammps-extra
|
||||
|
||||
# Next, add general info to include/lib/path variables.
|
||||
hdnnp_SYSINC += -I$(N2P2_DIR)/include
|
||||
hdnnp_SYSLIB += -L$(N2P2_DIR)/lib -lnnpif -lnnp
|
||||
hdnnp_SYSPATH +=
|
||||
@ -38,6 +38,8 @@ if (test $1 = 1) then
|
||||
|
||||
if (test -e ../Makefile.package) then
|
||||
sed -i -e 's/[^ \t]*hdnnp[^ \t]* //g' ../Makefile.package
|
||||
sed -i -e 's|^PKG_INC =[ \t]*|&-I../../lib/hdnnp/includelink |' ../Makefile.package
|
||||
sed -i -e 's|^PKG_PATH =[ \t]*|&-L../../lib/hdnnp/liblink |' ../Makefile.package
|
||||
sed -i -e 's|^PKG_SYSINC =[ \t]*|&$(hdnnp_SYSINC) |' ../Makefile.package
|
||||
sed -i -e 's|^PKG_SYSLIB =[ \t]*|&$(hdnnp_SYSLIB) |' ../Makefile.package
|
||||
sed -i -e 's|^PKG_SYSPATH =[ \t]*|&$(hdnnp_SYSPATH) |' ../Makefile.package
|
||||
@ -47,9 +49,8 @@ if (test $1 = 1) then
|
||||
sed -i -e '/^include.*hdnnp.*$/d' ../Makefile.package.settings
|
||||
# multiline form needed for BSD sed on Macs
|
||||
sed -i -e '4 i \
|
||||
include ..\/..\/lib\/hdnnp\/Makefile.lammps\
|
||||
include ..\/..\/lib\/hdnnp\/Makefile.lammps
|
||||
' ../Makefile.package.settings
|
||||
|
||||
fi
|
||||
|
||||
elif (test $1 = 0) then
|
||||
|
||||
Reference in New Issue
Block a user