Added two new files that will be used in the windows debug compile.

This commit is contained in:
Harry Moffat 2009-12-30 23:08:17 +00:00
parent c24a59deff
commit 2cb7eb7580
2 changed files with 124 additions and 0 deletions

View file

@ -0,0 +1,94 @@
#
# python script to create a few key files for the windows build
#
# $Id: setup_winmatlab.py,v 1.29 2009/07/20 19:38:53 hkmoffa Exp $
#
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_d -lctblas_d"
bllibs = bllibstr.replace('-l',' ')
bllist = bllibs.split()
bldir = libdir
libs = ['clib_d']
#
# 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.write('cd cantera\nbuild_cantera\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()

30
Cantera/python/winsetup_d.py Executable file
View file

@ -0,0 +1,30 @@
from distutils.core import setup, Extension
libdir = ['../../build/lib/i686-pc-win32']
# Below I switched to / from \ because python was interpreting \n in the
# string \numpy as a new line character
#
setup(name="Cantera",
version="1.8.0",
description="The Cantera Python Interface",
long_description="""
""",
author="Prof. D. G. Goodwin, Caltech",
author_email="dgoodwin@caltech.edu",
url="http://code.google.com/p/cantera",
package_dir = {'MixMaster':'../../apps/MixMaster'},
py_modules = ["ctml_writer"],
packages = ["Cantera","Cantera.OneD",
"MixMaster","MixMaster.Units"],
ext_modules=[ Extension("Cantera._cantera",
["src/pycantera.cpp"],
include_dirs=["../../build/include",
"src", "../clib/src",
"c:\python26/lib/site-packages/numpy/core/include"],
library_dirs = libdir,
depends = [libdir[0]+'/clib_d.lib'],
libraries = ["clib_d"])
],
)