diff --git a/Cantera/matlab/setup_winmatlab.py b/Cantera/matlab/setup_winmatlab.py new file mode 100644 index 000000000..c41132377 --- /dev/null +++ b/Cantera/matlab/setup_winmatlab.py @@ -0,0 +1,93 @@ +# +# python script to create a few key files for the windows build +# +# $Id$ +# +import sys +import os +import os.path + +# +# We are currently in the CanteraRoot/Cantera/matlab directory +CurrDir=os.getcwd() +# +# Get a list of path + 'matlab' +# +CantDir=os.path.split(CurrDir) +# +# Get a list of CanteraRoot + 'Cantera' +# +CantRootList=os.path.split(CantDir[0]) +# +# CanteraRoot will contain the absolute path name +# of the development root directory +# +CanteraRoot=CantRootList[0] + +bindir = CanteraRoot + '/bin' +libdir = CanteraRoot + '/build/lib/i686-pc-win32' +incdir = CanteraRoot + '/build/include' +dflibdir = '' + +bllibstr = "-lctlapack -lctblas" +bllibs = bllibstr.replace('-l',' ') +bllist = bllibs.split() + +bldir = libdir + +libs = ['clib'] +# +# setup.m file +# This is a utility matlab file that tells matlab to +# jump down a directory and execute build_cantera.m +# +f = open('setup.m','w') +f.write('cd cantera\nbuild_cantera\nexit\n') +f.close() +# +# cantera/build_Cantera.m +# +# Here we create the file cantera/build_Cantera.m +# This file contains the command which is executed from within matlab +# to build the cantera extension +# +fb = open('cantera/build_cantera.m','w') +fb.write(""" +disp('building Cantera..'); +mex -v -I"""+incdir+""" private/ctmethods.cpp private/ctfunctions.cpp ... + private/xmlmethods.cpp private/phasemethods.cpp ... + private/thermomethods.cpp private/kineticsmethods.cpp ... + private/transportmethods.cpp private/reactormethods.cpp ... + private/reactornetmethods.cpp ... + private/wallmethods.cpp private/flowdevicemethods.cpp ... + private/funcmethods.cpp ... + private/mixturemethods.cpp ... + private/onedimmethods.cpp private/surfmethods.cpp ... +""") +s = '' +for lib in libs: + s += ' '+libdir+'/'+lib+'.lib ...\n' +fb.write(s) +if bllist: + s = '' + for lib in bllist: + s += ' '+bldir+'/'+lib+'.lib ...\n' + fb.write(s) +# fb.write(' "'+dflibdir+'/dformd.lib" ...\n') +# fb.write(' "'+dflibdir+'/dfconsol.lib" ...\n') +# fb.write(' "'+dflibdir+'/dfport.lib" \n') +fb.write(' \n') +fb.close() +# +# Here we create the file ctbin.m. +# This is a matlab command which specified the ctbin directory +# within matlab. However we have a problem. This refers to the +# development computer, while we may be on the target computer. +# Don't know how to resolve this atm. +# +fp = open('cantera/ctbin.m','w') +fp.write("""function path = ctbin +path = '"""+bindir+"""'; +""") +fp.close() + diff --git a/Cantera/matlab/setup_winmatlab.py.in b/Cantera/matlab/setup_winmatlab.py.in deleted file mode 100644 index 618f19a2a..000000000 --- a/Cantera/matlab/setup_winmatlab.py.in +++ /dev/null @@ -1,56 +0,0 @@ - -import sys - -bindir = '@ct_bindir@' -libdir = '@buildlib@' -incdir = '@buildinc@' -dflibdir = '' - -bllibstr = "-lctlapack -lctblas" -bllibs = bllibstr.replace('-l',' ') -bllist = bllibs.split() - -bldir = "@buildlib@" - -libs = ['clib'] - -f = open('setup.m','w') -f.write('cd cantera\nbuild_cantera\nexit\n') -f.close() - -fb = open('cantera/build_cantera.m','w') -fb.write(""" -disp('building Cantera..'); -mex -g -I"""+incdir+""" private/ctmethods.cpp private/ctfunctions.cpp ... - private/xmlmethods.cpp private/phasemethods.cpp ... - private/thermomethods.cpp private/kineticsmethods.cpp ... - private/transportmethods.cpp private/reactormethods.cpp ... - private/reactornetmethods.cpp ... - private/wallmethods.cpp private/flowdevicemethods.cpp ... - private/funcmethods.cpp ... - private/mixturemethods.cpp ... - private/onedimmethods.cpp private/surfmethods.cpp ... -""") -s = '' -for lib in libs: - s += ' '+libdir+'/'+lib+'.lib ...\n' -fb.write(s) -if bllist: - s = '' - for lib in bllist: - s += ' '+bldir+'/'+lib+'.lib ...\n' - fb.write(s) -# fb.write(' "'+dflibdir+'/dformd.lib" ...\n') -# fb.write(' "'+dflibdir+'/dfconsol.lib" ...\n') -# fb.write(' "'+dflibdir+'/dfport.lib" \n') - -fb.write(' \n') - -fb.close() - -fp = open('cantera/ctbin.m','w') -fp.write("""function path = ctbin -path = '"""+bindir+"""'; -""") -fp.close() -