Skip to content
Snippets Groups Projects
Commit c9ba73d9 authored by Joseph Ciurej's avatar Joseph Ciurej
Browse files

Added staging support and improved error handling for METIS@:4 installs.

parent b5d0a388
Branches
Tags
No related merge requests found
...@@ -72,6 +72,8 @@ def install(self, spec, prefix): ...@@ -72,6 +72,8 @@ def install(self, spec, prefix):
make(*options) make(*options)
# Compile and install library files # Compile and install library files
ccompile = Executable(self.compiler.cc)
mkdir(prefix.bin) mkdir(prefix.bin)
binfiles = ('pmetis', 'kmetis', 'oemetis', 'onmetis', 'partnmesh', binfiles = ('pmetis', 'kmetis', 'oemetis', 'onmetis', 'partnmesh',
'partdmesh', 'mesh2nodal', 'mesh2dual', 'graphchk') 'partdmesh', 'mesh2nodal', 'mesh2dual', 'graphchk')
...@@ -86,8 +88,7 @@ def install(self, spec, prefix): ...@@ -86,8 +88,7 @@ def install(self, spec, prefix):
install(h, prefix.include) install(h, prefix.include)
mkdir(prefix.share) mkdir(prefix.share)
sharefiles = (('Programs', 'io.c'), ('Test', 'mtest.c'), sharefiles = (('Graphs', '4elt.graph'), ('Graphs', 'metis.mesh'),
('Graphs', '4elt.graph'), ('Graphs', 'metis.mesh'),
('Graphs', 'test.mgraph')) ('Graphs', 'test.mgraph'))
for sharefile in tuple(join_path(*sf) for sf in sharefiles): for sharefile in tuple(join_path(*sf) for sf in sharefiles):
install(sharefile, prefix.share) install(sharefile, prefix.share)
...@@ -102,28 +103,20 @@ def install(self, spec, prefix): ...@@ -102,28 +103,20 @@ def install(self, spec, prefix):
load_flag = '-Wl,-whole-archive' load_flag = '-Wl,-whole-archive'
no_load_flag = '-Wl,-no-whole-archive' no_load_flag = '-Wl,-no-whole-archive'
os.system('%s -fPIC -shared %s libmetis.a %s -o libmetis.%s' % \ ccompile('-fPIC', '-shared', load_flag, 'libmetis.a', no_load_flag,
(self.compiler.cc, load_flag, no_load_flag, lib_dsuffix)) '-o', '%s/libmetis.%s' % (prefix.lib, lib_dsuffix))
install('libmetis.%s' % lib_dsuffix, prefix.lib)
# Set up and run tests on installation # Set up and run tests on installation
inc_flags = '-I%s' % prefix.include ccompile('-I%s' % prefix.include, '-L%s' % prefix.lib,
lib_flags = '-L%s' % prefix.lib '-Wl,-rpath=%s' % (prefix.lib if '+shared' in spec else ''),
if '+shared' in spec: join_path('Programs', 'io.o'), join_path('Test', 'mtest.c'),
lib_flags += ' -Wl,-rpath=%s' % prefix.lib '-o', '%s/mtest' % prefix.bin, '-lmetis', '-lm')
symlink(join_path(prefix.share, 'io.c'), 'io.c')
symlink(join_path(prefix.share, 'mtest.c'), 'mtest.c')
os.system('%s %s -c io.c' % (self.compiler.cc, inc_flags))
os.system('%s %s %s mtest.c io.o -o mtest -lmetis -lm' % \
(self.compiler.cc, inc_flags, lib_flags))
test_bin = lambda testname: join_path(prefix.bin, testname) test_bin = lambda testname: join_path(prefix.bin, testname)
test_graph = lambda graphname: join_path(prefix.share, graphname) test_graph = lambda graphname: join_path(prefix.share, graphname)
graph = test_graph('4elt.graph') graph = test_graph('4elt.graph')
os.system('./mtest %s' % graph) os.system('%s %s' % (test_bin('mtest'), graph))
os.system('%s %s 40' % (test_bin('kmetis'), graph)) os.system('%s %s 40' % (test_bin('kmetis'), graph))
os.system('%s %s' % (test_bin('onmetis'), graph)) os.system('%s %s' % (test_bin('onmetis'), graph))
graph = test_graph('test.mgraph') graph = test_graph('test.mgraph')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment