Commit b3244f9c authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

more lib compilation updates

parent 8bba29d9
Loading
Loading
Loading
Loading
+17 −17
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ try:
  except: from urllib import urlretrieve as geturl
except:
  def geturl(url,fname):
    cmd = "curl -o %s %s" % (fname,url)
    cmd = 'curl -L -o "%s" %s' % (fname,url)
    txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
    return txt

@@ -139,7 +139,7 @@ if buildflag:

  if os.path.isdir(kimdir):
    print("kim-api is already installed at %s.\nRemoving it for re-install" % kimdir)
    cmd = "rm -rf %s" % kimdir
    cmd = 'rm -rf "%s"' % kimdir
    subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)

  # configure LAMMPS to use kim-api to be installed
@@ -160,48 +160,48 @@ if buildflag:
  print("Downloading kim-api tarball ...")
  geturl(url,"%s/%s.tgz" % (thisdir,version))
  print("Unpacking kim-api tarball ...")
  cmd = "cd %s; rm -rf %s; tar zxvf %s.tgz" % (thisdir,version,version)
  cmd = 'cd "%s"; rm -rf "%s"; tar -xzvf %s.tgz' % (thisdir,version,version)
  subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)

  # configure kim-api

  print("Configuring kim-api ...")
  cmd = "cd %s/%s; ./configure --prefix='%s'" % (thisdir,version,kimdir)
  cmd = 'cd "%s/%s"; ./configure --prefix="%s"' % (thisdir,version,kimdir)
  subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)

  # build kim-api

  print("Configuring example Models")
  cmd = "cd %s/%s; make add-examples" % (thisdir,version)
  cmd = 'cd "%s/%s"; make add-examples' % (thisdir,version)
  txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
  if verboseflag: print (txt.decode("UTF-8"))

  if everythingflag:
    print("Configuring all OpenKIM models, this will take a while ...")
    cmd = "cd %s/%s; make add-OpenKIM" % (thisdir,version)
    cmd = 'cd "%s/%s"; make add-OpenKIM' % (thisdir,version)
    txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
    if verboseflag: print(txt.decode("UTF-8"))

  print("Building kim-api ...")
  cmd = "cd %s/%s; make" % (thisdir,version)
  cmd = 'cd "%s/%s"; make' % (thisdir,version)
  txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
  if verboseflag: print(txt.decode("UTF-8"))

  # install kim-api

  print("Installing kim-api ...")
  cmd = "cd %s/%s; make install" % (thisdir,version)
  cmd = 'cd "%s/%s"; make install' % (thisdir,version)
  txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
  if verboseflag: print(txt.decode("UTF-8"))

  cmd = "cd %s/%s; make install-set-default-to-v1" %(thisdir,version)
  cmd = 'cd "%s/%s"; make install-set-default-to-v1' %(thisdir,version)
  txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
  if verboseflag: print(txt.decode("UTF-8"))

  # remove source files

  print("Removing kim-api source and build files ...")
  cmd = "cd %s; rm -rf %s; rm -rf %s.tgz" % (thisdir,version,version)
  cmd = 'cd "%s"; rm -rf %s; rm -rf %s.tgz' % (thisdir,version,version)
  subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)

# add a single model (and possibly its driver) to existing KIM installation
@@ -219,11 +219,11 @@ if addflag:
  geturl(url,"%s/%s.tgz" % (thisdir,addmodelname))

  print("Unpacking item tarball ...")
  cmd = "cd %s; tar zxvf %s.tgz" % (thisdir,addmodelname)
  cmd = 'cd "%s"; tar -xzvf %s.tgz' % (thisdir,addmodelname)
  subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)

  print("Building item ...")
  cmd = "cd %s/%s; make; make install" %(thisdir,addmodelname)
  cmd = 'cd "%s/%s"; make; make install' %(thisdir,addmodelname)
  try:
    txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
  except subprocess.CalledProcessError as e:
@@ -231,18 +231,18 @@ if addflag:
    # Error: but first, check to see if it needs a driver
    firstRunOutput = e.output.decode("UTF-8")

    cmd = "cd %s/%s; make kim-item-type" % (thisdir,addmodelname)
    cmd = 'cd "%s/%s"; make kim-item-type' % (thisdir,addmodelname)
    txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
    txt = txt.decode("UTF-8")
    if txt == "ParameterizedModel":

      # Get and install driver

      cmd = "cd %s/%s; make model-driver-name" % (thisdir,addmodelname)
      cmd = 'cd "%s/%s"; make model-driver-name' % (thisdir,addmodelname)
      txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
      adddrivername = txt.decode("UTF-8").strip()
      print("First installing model driver: %s..." % adddrivername)
      cmd = "cd %s; python Install.py -n -a %s" % (thisdir,adddrivername)
      cmd = 'cd "%s"; python Install.py -n -a %s' % (thisdir,adddrivername)
      try:
        txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
      except subprocess.CalledProcessError as e:
@@ -254,7 +254,7 @@ if addflag:
      # now install the model that needed the driver

      print("Now installing model : %s" % addmodelname)
      cmd = "cd %s; python Install.py -n -a %s" % (thisdir,addmodelname)
      cmd = 'cd "%s"; python Install.py -n -a %s' % (thisdir,addmodelname)
      try:
        txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
      except subprocess.CalledProcessError as e:
@@ -272,5 +272,5 @@ if addflag:

  if verboseflag: print(txt.decode("UTF-8"))
  print("Removing kim item source and build files ...")
  cmd = "cd %s; rm -rf %s; rm -rf %s.tgz" %(thisdir,addmodelname,addmodelname)
  cmd = 'cd "%s"; rm -rf %s; rm -rf %s.tgz' %(thisdir,addmodelname,addmodelname)
  subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)

lib/mscg/.gitignore

0 → 100644
+4 −0
Original line number Diff line number Diff line
# files to ignore
/liblink
/includelink
/MSCG-release-master
+72 −66
Original line number Diff line number Diff line
@@ -3,45 +3,48 @@
# Install.py tool to download, unpack, build, and link to the MS-CG library
# used to automate the steps described in the README file in this dir

import sys,os,re,commands
from __future__ import print_function
import sys,os,re,subprocess

try:
  import ssl
  try: from urllib.request import urlretrieve as geturl
  except: from urllib import urlretrieve as geturl
except:
  def geturl(url,fname):
    cmd = 'curl -L -o "%s" %s' % (fname,url)
    txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
    return txt

# help message

help = """
Syntax from src dir: make lib-mscg args="-h hpath hdir -g -b [suffix] -l"
Syntax from lib dir: python Install.py -h hpath hdir -g -b [suffix] -l
Syntax from src dir: make lib-mscg args="-p [path] -m [suffix]"
Syntax from lib dir: python Install.py -p [path]  -m [suffix]

specify one or more options, order does not matter

  -h = set home dir of MS-CG to be hpath/hdir
       hpath can be full path, contain '~' or '.' chars
       default hpath = . = lib/mscg
       default hdir = MSCG-release-master = what GitHub zipfile unpacks to
  -g = grab (download) zipfile from MS-CG GitHub website
       unpack it to hpath/hdir
       hpath must already exist
       if hdir already exists, it will be deleted before unpack
  -b = build MS-CG library in its src dir
       optional suffix specifies which src/Make/Makefile.suffix to use
  -b = download and build MS-CG library (default)
  -p = specify folder of existing MS-CG installation
  -m = machine suffix specifies which src/Make/Makefile.suffix to use
       default suffix = g++_simple
  -l = create 2 softlinks (includelink,liblink) in lib/mscg to MS-CG src dir

Example:

make lib-mscg args="-g -b -l"   # download/build in lib/mscg/MSCG-release-master
make lib-mscg args="-b "   # download/build in lib/mscg/MSCG-release-master
"""

# settings

url = "https://github.com/uchicago-voth/MSCG-release/archive/master.zip"
zipfile = "MS-CG-master.zip"
zipdir = "MSCG-release-master"
url = "http://github.com/uchicago-voth/MSCG-release/archive/master.tar.gz"
tarfile = "MS-CG-master.tar.gz"
tardir = "MSCG-release-master"

# print error message or help

def error(str=None):
  if not str: print help
  else: print "ERROR",str
  if not str: print(help)
  else: print("ERROR",str)
  sys.exit()

# expand to full path name
@@ -54,76 +57,79 @@ def fullpath(path):

args = sys.argv[1:]
nargs = len(args)
if nargs == 0: error()

homepath = "."
homedir = zipdir
homedir = tardir

grabflag = 0
buildflag = 0
buildflag = True
pathflag = False
linkflag = True
msuffix = "g++_simple"
linkflag = 0

iarg = 0
while iarg < nargs:
  if args[iarg] == "-h":
    if iarg+3 > nargs: error()
    homepath = args[iarg+1]
    homedir = args[iarg+2]
    iarg += 3
  elif args[iarg] == "-g":
    grabflag = 1
    iarg += 1
  elif args[iarg] == "-b":
    buildflag = 1
    if iarg+1 < nargs and args[iarg+1][0] != '-':
  if args[iarg] == "-p":
    if iarg+2 > nargs: error()
    mscgpath = fullpath(args[iarg+1])
    pathflag = True
    buildflag = False
    iarg += 2
  elif args[iarg] == "-m":
    if iarg+2 > nargs: error()
    msuffix = args[iarg+1]
      iarg += 1
    iarg += 1
  elif args[iarg] == "-l":
    linkflag = 1
    iarg += 2
  elif args[iarg] == "-b":
    buildflag = True
    iarg += 1
  else: error()

homepath = fullpath(homepath)
if not os.path.isdir(homepath): error("MS-CG path does not exist")
homedir = "%s/%s" % (homepath,homedir)

# download and unpack MS-CG zipfile
if (pathflag):
    if not os.path.isdir(mscgpath): error("MS-CG path does not exist")
    homedir = mscgpath

if (buildflag and pathflag):
    error("Cannot use -b and -p flag at the same time")

if grabflag:
  print "Downloading MS-CG ..."
  cmd = "curl -L %s > %s/%s" % (url,homepath,zipfile)
  print cmd
  print commands.getoutput(cmd)
# download and unpack MS-CG tarfile

  print "Unpacking MS-CG zipfile ..."
  if os.path.exists("%s/%s" % (homepath,zipdir)):
    commands.getoutput("rm -rf %s/%s" % (homepath,zipdir))
  cmd = "cd %s; unzip %s" % (homepath,zipfile)
  commands.getoutput(cmd)
  if os.path.basename(homedir) != zipdir:
    if os.path.exists(homedir): commands.getoutput("rm -rf %s" % homedir)
    os.rename("%s/%s" % (homepath,zipdir),homedir)
if buildflag:
  print("Downloading MS-CG ...")
  geturl(url,"%s/%s" % (homepath,tarfile))

  print("Unpacking MS-CG tarfile ...")
  if os.path.exists("%s/%s" % (homepath,tardir)):
    cmd = 'rm -rf "%s/%s"' % (homepath,tardir)
    subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
  cmd = 'cd "%s"; tar -xzvf %s' % (homepath,tarfile)
  subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
  os.remove("%s/%s" % (homepath,tarfile))
  if os.path.basename(homedir) != tardir:
    if os.path.exists(homedir):
      cmd = 'rm -rf "%s"' % homedir
      subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
    os.rename("%s/%s" % (homepath,tardir),homedir)

# build MS-CG

if buildflag:
  print "Building MS-CG ..."
  cmd = "cd %s/src; cp Make/Makefile.%s .; make -f Makefile.%s" % \
  print("Building MS-CG ...")
  cmd = 'cd "%s/src"; cp Make/Makefile.%s .; make -f Makefile.%s' % \
      (homedir,msuffix,msuffix)
  txt = commands.getoutput(cmd)
  print txt
  txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
  print(txt.decode('UTF-8'))

# create 2 links in lib/mscg to MS-CG src dir

if linkflag:
  print "Creating links to MS-CG include and lib files"
  print("Creating links to MS-CG include and lib files")
  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")
  cmd = "ln -s %s/src includelink" % homedir
  commands.getoutput(cmd)
  cmd = "ln -s %s/src liblink" % homedir
  commands.getoutput(cmd)
  cmd = 'ln -s "%s/src" includelink' % homedir
  subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
  cmd = 'ln -s "%s/src" liblink' % homedir
  subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
+1 −1
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ OBJ = $(SRC:.cpp=.o)
# ------ SETTINGS ------

CC =	        g++
CCFLAGS =       -O -g -fPIC -Wall #-Wno-deprecated
CCFLAGS =       -O3 -g -fPIC -Wall #-Wno-deprecated
ARCHIVE =	ar
ARCHFLAG =	-rc
DEPFLAGS =      -M

lib/poems/Makefile.mingw32-cross

deleted100644 → 0
+0 −110
Original line number Diff line number Diff line
# *
# *_________________________________________________________________________*
# *      POEMS: PARALLELIZABLE OPEN SOURCE EFFICIENT MULTIBODY SOFTWARE     *
# *      DESCRIPTION: SEE READ-ME                                           *
# *      FILE NAME: Makefile                                                *
# *      AUTHORS: See Author List                                           * 
# *      GRANTS: See Grants List                                            *
# *      COPYRIGHT: (C) 2005 by Authors as listed in Author's List          *
# *      LICENSE: Please see License Agreement                              *
# *      DOWNLOAD: Free at www.rpi.edu/~anderk5                             *
# *      ADMINISTRATOR: Prof. Kurt Anderson                                 *
# *                     Computational Dynamics Lab                          *
# *                     Rensselaer Polytechnic Institute                    *
# *                     110 8th St. Troy NY 12180                           * 
# *      CONTACT:        anderk5@rpi.edu                                    *
# *_________________________________________________________________________*/

SHELL = /bin/sh

# which file will be copied to Makefile.lammps

EXTRAMAKE = Makefile.lammps.empty

# ------ FILES ------

SRC_MAIN = workspace.cpp system.cpp poemsobject.cpp 
INC_MAIN = workspace.h system.h poemsobject.h

SRC_BODY =      body.cpp rigidbody.cpp particle.cpp inertialframe.cpp
INC_BODY =      bodies.h body.h rigidbody.h particle.h inertialframe.h


SRC_JOINT =     joint.cpp revolutejoint.cpp prismaticjoint.cpp sphericaljoint.cpp \
    freebodyjoint.cpp body23joint.cpp mixedjoint.cpp
INC_JOINT =     joints.h joint.h revolutejoint.h prismaticjoint.h sphericaljoint.h \
    freebodyjoint.h body23joint.h mixedjoint.h

SRC_POINT =     point.cpp fixedpoint.cpp
INC_POINT =     points.h point.h fixedpoint.h

SRC_SOLVE = solver.cpp  
INC_SOLVE = solver.h  

SRC_ORDERN = onsolver.cpp onfunctions.cpp onbody.cpp
INC_ORDERN = onsolver.h onfunctions.h onbody.h

SRC_MAT =       virtualmatrix.cpp matrix.cpp matrixfun.cpp mat3x3.cpp virtualcolmatrix.cpp \
    colmatrix.cpp vect3.cpp virtualrowmatrix.cpp rowmatrix.cpp mat6x6.cpp vect6.cpp \
    fastmatrixops.cpp colmatmap.cpp eulerparameters.cpp vect4.cpp norm.cpp mat4x4.cpp \
    
INC_MAT =       matrices.h virtualmatrix.h matrix.h matrixfun.h mat3x3.h virtualcolmatrix.h \
    colmatrix.h vect3.h virtualrowmatrix.h rowmatrix.h mat6x6.h vect6.h \
    fastmatrixops.h colmatmap.h eulerparameters.h vect4.h norm.h mat4x4.h 

SRC_MISC = poemstreenode.cpp
INC_MISC = poemslist.h poemstreenode.h poemstree.h poemsnodelib.h SystemProcessor.h defines.h POEMSChain.h

SRC = $(SRC_MAIN) $(SRC_BODY) $(SRC_JOINT) $(SRC_POINT) $(SRC_SOLVE) $(SRC_ORDERN) $(SRC_MAT) $(SRC_MISC) 
INC = $(INC_MAIN) $(INC_BODY) $(INC_JOINT) $(INC_POINT) $(INC_SOLVE) $(INC_ORDERN) $(INC_MAT) $(INC_MISC) 

FILES = $(SRC) $(INC) Makefile Authors_List.txt Grants_List.txt POEMS_License.txt README Copyright_Notice

# ------ DEFINITIONS ------

DIR = Obj_mingw32/
LIB = $(DIR)libpoems.a
OBJ = $(SRC:%.cpp=$(DIR)%.o)

# ------ SETTINGS ------

CC =	        i686-w64-mingw32-g++
CCFLAGS =	-O2 -march=i686 -mtune=generic -mfpmath=387 -mpc64	\
		-ffast-math -funroll-loops -finline-functions -fno-rtti	\
		-fno-exceptions -fstrict-aliasing \
		-Wall -W -Wno-uninitialized 
ARCHIVE =	i686-w64-mingw32-ar
ARCHFLAG =	-rcs
DEPFLAGS =      -M
LINK =         	i686-w64-mingw32-g++
LINKFLAGS =	-O
USRLIB =
SYSLIB =

# ------ MAKE PROCEDURE ------

default: $(DIR) $(LIB)

$(DIR):
	-mkdir $(DIR)

$(LIB): $(OBJ)
	$(ARCHIVE) $(ARFLAGS) $(LIB) $(OBJ)
	@cp $(EXTRAMAKE) Makefile.lammps

# ------ COMPILE RULES ------

$(DIR)%.o:%.cpp
	$(CC) $(CCFLAGS) -c $< -o $@

# ------ DEPENDENCIES ------

include .depend

# ------ CLEAN ------

clean:
	-rm $(DIR)*.o $(DIR)*.d *~ $(LIB)

tar:
	-tar -cvf ../POEMS.tar $(FILES)
Loading