source: trunk/anuga_core/compile_all.py @ 8729

Last change on this file since 8729 was 8697, checked in by steve, 12 years ago

Changes to get Padarn's new code working for windows. Do need to setup netcdf dll and netcdf.h in fit_interpolate directory

File size: 3.3 KB
Line 
1import os
2import time
3import sys
4import subprocess
5
6buildroot = os.getcwd()
7
8os.chdir('source')
9os.chdir('anuga')
10
11
12print 'Changing to', os.getcwd()       
13
14#entries = listdir('.')
15
16t0 = time.time()
17
18# Attempt to compile all ANUGA extensions
19
20os.chdir('utilities')
21subprocess.call([sys.executable, 'compile.py', 'quad_tree.c'])
22subprocess.call([sys.executable, 'compile.py', 'sparse_dok.c'])
23subprocess.call([sys.executable, 'compile.py', 'sparse_csr.c'])
24execfile('compile.py')
25
26os.chdir('..')
27os.chdir('advection')
28execfile('..' + os.sep + 'utilities' + os.sep + 'compile.py')
29
30os.chdir('..')
31os.chdir('operators')
32execfile('..' + os.sep + 'utilities' + os.sep + 'compile.py')
33
34os.chdir('..')
35os.chdir('file_conversion')
36execfile('..' + os.sep + 'utilities' + os.sep + 'compile.py')
37
38os.chdir('..')
39os.chdir('geometry')
40execfile('..' + os.sep + 'utilities' + os.sep + 'compile.py')
41
42os.chdir('..')
43os.chdir('structures')
44execfile('..' + os.sep + 'utilities' + os.sep + 'compile.py')
45
46os.chdir('..')
47os.chdir('abstract_2d_finite_volumes')
48execfile('..' + os.sep + 'utilities' + os.sep + 'compile.py')
49
50os.chdir('..')
51os.chdir('file')
52execfile('..' + os.sep + 'utilities' + os.sep + 'compile.py')
53
54os.chdir('..')
55os.chdir('shallow_water')
56execfile('..' + os.sep + 'utilities' + os.sep + 'compile.py')
57
58
59os.chdir('..')
60os.chdir('mesh_engine')
61execfile('..' + os.sep + 'utilities' + os.sep + 'compile.py')
62
63os.chdir('..')
64os.chdir('fit_interpolate')
65subprocess.call([sys.executable, '..' + os.sep + 'utilities' + os.sep + 'compile.py', 'rand48.c'])
66subprocess.call([sys.executable, '..' + os.sep + 'utilities' + os.sep + 'compile.py', 'ptinpoly.c'])
67execfile('..' + os.sep + 'utilities' + os.sep + 'compile.py')
68
69
70os.chdir(buildroot)   
71
72print '-----------------------------------------------'
73print 'Attempting to compile Metis for parallel ANUGA!'
74print '-----------------------------------------------'
75
76# Attempt to compile Metis for use with anuga_parallel
77os.chdir('source')
78os.chdir('anuga_parallel')
79os.chdir('pymetis')
80
81make_logfile = os.path.join(buildroot, 'make_metis.log')
82options = ''
83if sys.platform == 'win32':
84    options = 'for_win32'
85else:
86    if os.name == 'posix':
87        if os.uname()[4] in ['x86_64', 'ia64']:
88            options = ' '
89
90make_command = 'make %s > %s' % (options, make_logfile)
91print make_command
92err = os.system(make_command)
93if err != 0:
94    msg = 'Could not compile Metis '
95    msg += 'on platform %s, %s\n' % (sys.platform, os.name)
96    msg += 'You need to compile Metis manually '
97    msg += 'if you want to run ANUGA in parallel.'
98    raise Exception, msg
99else:
100    msg = 'Compiled Metis succesfully. Output from Make is available in %s'\
101        % make_logfile
102    print msg
103
104
105print '-----------------------------------------------'
106print 'Attempting to compile pypar_extras'
107print '-----------------------------------------------'
108
109os.chdir('..')
110os.chdir('pypar_extras')
111
112cmd = 'python anuga_setup.py'
113print cmd
114err = os.system(cmd)
115if err != 0:
116    msg = 'Could not compile pypar_extras '
117    msg += 'on platform %s, %s\n' % (sys.platform, os.name)
118    msg += 'You need to compile pypar_extras manually '
119    msg += 'if you want to run ANUGA in parallel.'
120    raise Exception, msg
121else:
122    msg = 'Compiled pypar_extras succesfully.'
123    print msg
124
125
126print       
127print 'That took %.3fs' %(time.time() - t0)
128
129
130
131if sys.platform == 'win32':
132    raw_input('Press the RETURN key')
Note: See TracBrowser for help on using the repository browser.