SCons can now build the Matlab toolbox under Windows
This commit is contained in:
parent
e1051b2263
commit
605efec48d
3 changed files with 30 additions and 10 deletions
|
|
@ -12,9 +12,9 @@ if localenv['OS'] == 'Windows':
|
|||
inst = localenv.Install('$ct_libdir', lib)
|
||||
buildTargets.extend(lib)
|
||||
installTargets.extend(inst)
|
||||
|
||||
static_lib = localenv.Library(pjoin('../../lib', 'clib'),
|
||||
source=mglob(localenv, 'src', 'cpp'))
|
||||
inst_static = localenv.Install('$ct_libdir', static_lib)
|
||||
buildTargets.extend(static_lib)
|
||||
installTargets.extend(inst_static)
|
||||
else:
|
||||
static_lib = localenv.Library(pjoin('../../lib', 'clib'),
|
||||
source=mglob(localenv, 'src', 'cpp'))
|
||||
inst_static = localenv.Install('$ct_libdir', static_lib)
|
||||
buildTargets.extend(static_lib)
|
||||
installTargets.extend(inst_static)
|
||||
|
|
|
|||
|
|
@ -12,13 +12,15 @@ class MatlabBuilder(object):
|
|||
includes = ' '.join('-I%s' % Dir(s).abspath for s in env['CPPPATH'])
|
||||
libdir = ' '.join('-L%s' % Dir(s).abspath for s in env['LIBPATH'])
|
||||
libs = ' '.join('-l'+s for s in self.libs)
|
||||
extraFlag = '-cxx' if os.name == 'posix' else ''
|
||||
text = """
|
||||
disp('building Cantera...');
|
||||
cd cantera
|
||||
mex -cxx -v -output ctmethods %(sourcestr)s %(include)s %(libdir)s %(libs)s
|
||||
mex %(extraFlag)s -v -output ctmethods %(include)s %(libdir)s %(libs)s %(sourcestr)s
|
||||
disp('done.');
|
||||
exit
|
||||
""" % dict(sourcestr=sourcestr,
|
||||
extraFlag=extraFlag,
|
||||
include=includes,
|
||||
libdir=libdir,
|
||||
libs=libs)
|
||||
|
|
@ -28,14 +30,25 @@ exit
|
|||
|
||||
localenv = env.Clone()
|
||||
|
||||
libs = ['clib']
|
||||
if localenv['OS'] != 'Windows':
|
||||
libs.extend(env['cantera_libs'])
|
||||
|
||||
localenv.Command('build_cantera.m',
|
||||
mglob(localenv, 'src', 'cpp'),
|
||||
MatlabBuilder(localenv['cantera_libs']))
|
||||
MatlabBuilder(libs))
|
||||
|
||||
localenv['ENV']['PATH'] = os.environ['PATH']
|
||||
|
||||
build_cmd = 'cd ${SOURCE.dir}; %(matlab_cmd)s -nojvm -nosplash -r build_cantera'
|
||||
target = localenv.Command('cantera/ctmethods.mexa64',
|
||||
build_cmd = 'cd ${SOURCE.dir} && "%(matlab_cmd)s" -nojvm -nosplash -r build_cantera'
|
||||
|
||||
|
||||
if os.name == 'posix':
|
||||
mexFile = 'cantera/ctmethods.mexa%i' % localenv['OS_BITS']
|
||||
elif os.name == 'nt':
|
||||
mexFile = 'cantera/ctmethods.mexw%i' % localenv['OS_BITS']
|
||||
|
||||
target = localenv.Command(mexFile,
|
||||
'build_cantera.m',
|
||||
build_cmd % localenv)
|
||||
buildTargets.extend(target)
|
||||
|
|
@ -49,3 +62,8 @@ installTargets.extend(inst)
|
|||
|
||||
inst = localenv.RecursiveInstall(pjoin('$ct_demodir', 'matlab'), 'examples')
|
||||
installTargets.extend(inst)
|
||||
|
||||
if os.name == 'nt':
|
||||
inst = localenv.Install(pjoin('$prefix', 'matlab', 'toolbox'),
|
||||
localenv['clib_shared'])
|
||||
installTargets.extend(inst)
|
||||
|
|
|
|||
|
|
@ -446,6 +446,8 @@ of this file is:
|
|||
# ********************************************
|
||||
env['OS'] = platform.system()
|
||||
|
||||
env['OS_BITS'] = int(platform.architecture()[0][:2])
|
||||
|
||||
# Try to find a Fortran compiler:
|
||||
if env['f90_interface'] in ('y','default'):
|
||||
foundF90 = False
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue