Updates to SCons scripts to support the new directory structure
This commit is contained in:
parent
a310345b9e
commit
eb2cab5f2b
12 changed files with 88 additions and 110 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -6,6 +6,7 @@
|
|||
*.obj
|
||||
*.exe.manifest
|
||||
build
|
||||
src/base/config.h
|
||||
stage
|
||||
.sconsign.dblite
|
||||
.sconf_temp
|
||||
|
|
|
|||
38
SConstruct
38
SConstruct
|
|
@ -805,10 +805,11 @@ if not env['HAS_MATH_H_ERF']:
|
|||
else:
|
||||
configh['USE_BOOST_MATH'] = None
|
||||
|
||||
config_h = env.Command('build/include/cantera/kernel/config.h',
|
||||
'Cantera/src/base/config.h.in',
|
||||
config_h = env.Command('include/cantera/base/config.h',
|
||||
'include/cantera/base/config.h.in',
|
||||
ConfigBuilder(configh))
|
||||
env.AlwaysBuild(config_h)
|
||||
env['config_h_target'] = config_h
|
||||
|
||||
# *********************
|
||||
# *** Build Cantera ***
|
||||
|
|
@ -836,14 +837,6 @@ for header in mglob(env, 'Cantera/cxx/include', 'h'):
|
|||
inst = env.Install('$inst_incdir', header)
|
||||
installTargets.extend(inst)
|
||||
|
||||
env['clib_header_targets'] = []
|
||||
for header in mglob(env, 'Cantera/clib/src', 'h'):
|
||||
hcopy = env.Command('build/include/cantera/clib/%s' % header.name, header,
|
||||
Copy('$TARGET', '$SOURCE'))
|
||||
buildTargets.append(header)
|
||||
inst = env.Install(pjoin('$inst_incdir','clib'), header)
|
||||
installTargets.extend(inst)
|
||||
env['clib_header_targets'].append(hcopy)
|
||||
|
||||
inst = env.Install(pjoin('$inst_incdir', 'kernel'), config_h)
|
||||
installTargets.extend(inst)
|
||||
|
|
@ -874,27 +867,24 @@ Export('env', 'buildDir', 'buildTargets', 'installTargets', 'demoTargets')
|
|||
VariantDir('build/ext', 'ext', duplicate=0)
|
||||
SConscript('build/ext/SConscript')
|
||||
|
||||
VariantDir('build/kernel', 'Cantera/src', duplicate=0)
|
||||
SConscript('build/kernel/SConscript')
|
||||
|
||||
VariantDir('build/interfaces/clib', 'Cantera/clib', duplicate=0)
|
||||
SConscript('build/interfaces/clib/SConscript')
|
||||
|
||||
VariantDir('build/interfaces/cxx', 'Cantera/cxx', duplicate=0)
|
||||
SConscript('build/interfaces/cxx/SConscript')
|
||||
VariantDir('build/src', 'src', duplicate=0)
|
||||
SConscript('build/src/SConscript')
|
||||
|
||||
if env['f90_interface'] == 'y':
|
||||
VariantDir('build/interfaces/fortran/', 'Cantera/fortran', duplicate=1)
|
||||
SConscript('build/interfaces/fortran/SConscript')
|
||||
VariantDir('build/fortran/', 'src/fortran', duplicate=1)
|
||||
SConscript('build/src/fortran/SConscript')
|
||||
|
||||
if env['python_package'] in ('full','minimal'):
|
||||
SConscript('Cantera/python/SConscript')
|
||||
SConscript('src/python/SConscript')
|
||||
|
||||
if env['matlab_toolbox'] == 'y':
|
||||
SConscript('Cantera/matlab/SConscript')
|
||||
SConscript('src/matlab/SConscript')
|
||||
|
||||
VariantDir('build/tools', 'tools', duplicate=0)
|
||||
SConscript('build/tools/SConscript')
|
||||
SConscript('build/src/apps/SConscript')
|
||||
|
||||
if env['OS'] != 'Windows':
|
||||
VariantDir('build/platform', 'platform/posix', duplicate=0)
|
||||
SConscript('build/platform/SConscript')
|
||||
|
||||
# Data files
|
||||
inst = env.Install('$inst_datadir', mglob(env, pjoin('data','inputs'), 'cti', 'xml'))
|
||||
|
|
|
|||
|
|
@ -42,8 +42,7 @@ def prep_gtest(env):
|
|||
return localenv
|
||||
|
||||
# (subdir, library name, (file extensions), prepfunction)
|
||||
libs = [('tpx','tpx',['cpp'],prep_default),
|
||||
('gtest/src','gtest',['^gtest-all.cc'], prep_gtest)]
|
||||
libs = [('gtest/src','gtest',['^gtest-all.cc'], prep_gtest)]
|
||||
|
||||
if env['build_with_f2c']:
|
||||
libs.append(('f2c_math', 'ctmath', ['cpp','c'], prep_f2c))
|
||||
|
|
|
|||
|
|
@ -15,11 +15,10 @@ if '@python_package@' == 'full':
|
|||
author="Prof. D. G. Goodwin, Caltech",
|
||||
author_email="dgoodwin@caltech.edu",
|
||||
url="http://code.google.com/p/cantera",
|
||||
package_dir = {'MixMaster':'../../apps/MixMaster'},
|
||||
packages = ["","Cantera","Cantera.OneD",
|
||||
"MixMaster","MixMaster.Units"],
|
||||
package_data = {'Cantera': dataFiles},
|
||||
ext_modules=[Extension('_spam', ['src/spam.c'])])
|
||||
ext_modules=[Extension('_spam', ['../../src/python/spam.c'])])
|
||||
|
||||
elif '@python_package@' == 'minimal':
|
||||
setup(name="Cantera CTI File Processor",
|
||||
|
|
|
|||
24
platform/posix/SConscript
Normal file
24
platform/posix/SConscript
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import sys
|
||||
|
||||
from buildutils import *
|
||||
|
||||
Import('env', 'buildTargets', 'installTargets')
|
||||
localenv = env.Clone()
|
||||
|
||||
### Generate customized scripts ###
|
||||
|
||||
# 'setup_cantera'
|
||||
v = sys.version_info
|
||||
localenv['python_module_loc'] = pjoin(localenv['prefix'], 'lib', 'python%i.%i' % v[:2], 'site-packages')
|
||||
target = localenv.SubstFile('setup_cantera', 'setup_cantera.in')
|
||||
buildTargets.extend(target)
|
||||
inst = localenv.Install('$inst_bindir','setup_cantera')
|
||||
installTargets.append(inst)
|
||||
|
||||
# 'mixmaster'
|
||||
if env['python_package'] == 'full':
|
||||
target = localenv.SubstFile('mixmaster', 'mixmaster.in')
|
||||
buildTargets.extend(target)
|
||||
inst = localenv.Install('$inst_bindir', 'mixmaster')
|
||||
localenv.AddPostAction(inst, Chmod('$TARGET', 0755))
|
||||
installTargets.extend(inst)
|
||||
|
|
@ -25,6 +25,7 @@ def numericsSetup(env, subdir, extensions):
|
|||
# (subdir, library name, (file extensions), (extra setup(env)))
|
||||
libs = [('base', 'ctbase', ['cpp'], baseSetup),
|
||||
('thermo', 'thermo', ['cpp'], defaultSetup),
|
||||
('tpx', 'tpx', ['cpp'], defaultSetup),
|
||||
('equil', 'equil', ['cpp','c'], equilSetup),
|
||||
('converters', 'converters', ['cpp'], defaultSetup),
|
||||
('numerics', 'ctnumerics', ['cpp'], numericsSetup),
|
||||
|
|
@ -37,17 +38,31 @@ libs = [('base', 'ctbase', ['cpp'], baseSetup),
|
|||
|
||||
for subdir, libname, extensions, setup in libs:
|
||||
localenv = env.Clone()
|
||||
localenv.Append(CPPPATH=Dir('../include/cantera/kernel'))
|
||||
localenv.Append(CPPPATH=Dir('#include'))
|
||||
localenv.Append(CPPPATH=Dir('#src')) # todo: remove when not needed
|
||||
source = setup(localenv, subdir, extensions)
|
||||
for header in mglob(localenv, subdir, 'h'):
|
||||
h = localenv.Command('../include/cantera/kernel/%s' % header.name, header,
|
||||
Copy('$TARGET', '$SOURCE'))
|
||||
buildTargets.extend(h)
|
||||
inst = localenv.Install(pjoin('$inst_incdir', 'kernel'), h)
|
||||
installTargets.extend(inst)
|
||||
|
||||
lib = localenv.Library(pjoin('../lib', libname),
|
||||
source=source)
|
||||
lib = localenv.Library(pjoin('../lib', libname), source=source)
|
||||
localenv.Depends(lib, localenv['config_h_target'])
|
||||
inst = localenv.Install('$inst_libdir', lib)
|
||||
buildTargets.extend(lib)
|
||||
installTargets.extend(inst)
|
||||
|
||||
# clib is a bit different
|
||||
localenv = env.Clone()
|
||||
source = defaultSetup(localenv, 'clib', ['cpp'])
|
||||
localenv.Append(CPPPATH=[Dir('#include'), Dir('#src')])
|
||||
|
||||
if env['OS'] == 'Windows':
|
||||
lib = localenv.SharedLibrary(pjoin('../lib', 'clib'),
|
||||
source=source,
|
||||
LIBS=localenv['cantera_libs'])
|
||||
env['clib_shared'] = lib
|
||||
else:
|
||||
lib = localenv.Library(pjoin('../lib', 'clib'),
|
||||
source=source)
|
||||
|
||||
localenv.Depends(lib, localenv['config_h_target'])
|
||||
inst = localenv.Install('$inst_libdir', lib)
|
||||
buildTargets.extend(lib)
|
||||
installTargets.extend(inst)
|
||||
|
|
|
|||
|
|
@ -3,63 +3,20 @@ from buildutils import *
|
|||
Import('env', 'buildTargets', 'installTargets')
|
||||
localenv = env.Clone()
|
||||
|
||||
programs = [('cti2ctml', ['src/cti2ctml.cpp'], ['ctbase']),
|
||||
('ck2cti', ['src/ck2cti.cpp'], ['converters','ctbase','tpx']),
|
||||
('csvdiff', mglob(localenv, 'testtools', 'cpp'), [])]
|
||||
programs = [('cti2ctml', ['cti2ctml.cpp'], ['ctbase']),
|
||||
('ck2cti', ['ck2cti.cpp'], ['converters','ctbase','tpx'])]
|
||||
|
||||
localenv.Append(CPPPATH=['#src', '#include'])
|
||||
|
||||
for name, src, libs in programs:
|
||||
prog = localenv.Program(target=pjoin('..', 'bin', name),
|
||||
prog = localenv.Program(target=pjoin('#build/bin', name),
|
||||
source=src,
|
||||
LIBS=libs)
|
||||
inst = localenv.Install('$inst_bindir', prog)
|
||||
buildTargets.extend(prog)
|
||||
installTargets.extend(inst)
|
||||
|
||||
# Copy application templates
|
||||
installTargets.extend(
|
||||
localenv.Install(pjoin('$inst_templdir','cxx'),
|
||||
mglob(localenv, pjoin('templates','cxx'), '*')) +
|
||||
localenv.Install(pjoin('$inst_templdir','f90'),
|
||||
mglob(localenv, pjoin('templates','f90'), '*')) +
|
||||
localenv.Install(pjoin('$inst_templdir','f77'),
|
||||
mglob(localenv, pjoin('templates','f77'), '*')))
|
||||
|
||||
# Copy man pages
|
||||
if env['INSTALL_MANPAGES']:
|
||||
inst = localenv.Install('$inst_mandir', mglob(localenv, 'man', '*'))
|
||||
installTargets.extend(inst)
|
||||
|
||||
### Generate customized scripts ###
|
||||
|
||||
# 'setup_cantera'
|
||||
v = sys.version_info
|
||||
localenv['python_module_loc'] = pjoin(localenv['prefix'], 'lib', 'python%i.%i' % v[:2], 'site-packages')
|
||||
target = localenv.SubstFile('setup_cantera', 'setup_cantera.in')
|
||||
buildTargets.extend(target)
|
||||
inst = localenv.Install('$inst_bindir','setup_cantera')
|
||||
installTargets.append(inst)
|
||||
|
||||
# 'mixmaster'
|
||||
if env['python_package'] == 'full':
|
||||
target = localenv.SubstFile('mixmaster', 'mixmaster.in')
|
||||
buildTargets.extend(target)
|
||||
inst = localenv.Install('$inst_bindir', 'mixmaster')
|
||||
localenv.AddPostAction(inst, Chmod('$TARGET', 0755))
|
||||
installTargets.extend(inst)
|
||||
|
||||
# 'ctnew'
|
||||
target = localenv.SubstFile('ctnew', 'ctnew.in')
|
||||
buildTargets.extend(target)
|
||||
inst = localenv.Install('$inst_bindir', 'ctnew')
|
||||
localenv.AddPostAction(inst, Chmod('$TARGET', 0755))
|
||||
installTargets.extend(inst)
|
||||
|
||||
# 'ctpath.m', 'cantera_demos.m'
|
||||
if env['matlab_toolbox'] == 'y':
|
||||
target = localenv.SubstFile('ctpath.m', 'ctpath.m.in')
|
||||
buildTargets.extend(target)
|
||||
inst = localenv.Install('$inst_matlab_dir', target)
|
||||
installTargets.extend(inst)
|
||||
|
||||
inst = localenv.Install('$inst_matlab_dir', 'cantera_demos.m')
|
||||
installTargets.extend(inst)
|
||||
|
|
|
|||
|
|
@ -1,20 +0,0 @@
|
|||
from buildutils import *
|
||||
|
||||
Import('env', 'buildTargets', 'installTargets')
|
||||
|
||||
localenv = env.Clone()
|
||||
|
||||
if localenv['OS'] == 'Windows':
|
||||
lib = localenv.SharedLibrary(pjoin('../../lib', 'clib'),
|
||||
source=mglob(localenv, 'src', 'cpp'),
|
||||
LIBS=env['cantera_libs'])
|
||||
env['clib_shared'] = lib
|
||||
inst = localenv.Install('$inst_libdir', lib)
|
||||
buildTargets.extend(lib)
|
||||
installTargets.extend(inst)
|
||||
else:
|
||||
static_lib = localenv.Library(pjoin('../../lib', 'clib'),
|
||||
source=mglob(localenv, 'src', 'cpp'))
|
||||
inst_static = localenv.Install('$inst_libdir', static_lib)
|
||||
buildTargets.extend(static_lib)
|
||||
installTargets.extend(inst_static)
|
||||
|
|
@ -60,9 +60,20 @@ target = localenv.Command(mexFile,
|
|||
'build_cantera.m',
|
||||
build_cmd % localenv)
|
||||
buildTargets.extend(target)
|
||||
localenv.Depends(target, env['clib_header_targets'])
|
||||
|
||||
|
||||
### Install the Matlab toolbox ###
|
||||
|
||||
# 'ctpath.m'
|
||||
target = localenv.SubstFile('ctpath.m', 'ctpath.m.in')
|
||||
buildTargets.extend(target)
|
||||
inst = localenv.Install('$inst_matlab_dir', target)
|
||||
installTargets.extend(inst)
|
||||
|
||||
# 'cantera_demos.m'
|
||||
inst = localenv.Install('$inst_matlab_dir', 'cantera_demos.m')
|
||||
installTargets.extend(inst)
|
||||
|
||||
inst = localenv.RecursiveInstall('$inst_matlab_dir', 'cantera')
|
||||
installTargets.extend(inst)
|
||||
|
||||
|
|
|
|||
|
|
@ -19,14 +19,16 @@ for var in ('VS80COMNTOOLS', 'VS90COMNTOOLS', 'VS100COMNTOOLS'):
|
|||
if var in os.environ:
|
||||
localenv['ENV'][var] = os.environ[var]
|
||||
|
||||
make_setup = localenv.SubstFile('setup.py', 'setup.py.in')
|
||||
make_setup = localenv.SubstFile('#interfaces/python/setup.py',
|
||||
'#interfaces/python/setup.py.in')
|
||||
|
||||
if localenv['python_package'] == 'full':
|
||||
libs = ['clib']
|
||||
if localenv['OS'] != 'Windows':
|
||||
libs.extend(env['cantera_libs'])
|
||||
localenv.Append(CPPPATH=['#src', '#include'])
|
||||
|
||||
pymodule = localenv.SharedLibrary('Cantera/_cantera', ['src/pycantera.cpp'],
|
||||
pymodule = localenv.SharedLibrary('Cantera/_cantera', ['pycantera.cpp'],
|
||||
LIBS=libs,
|
||||
SHLIBPREFIX='',
|
||||
SHLIBSUFFIX=gcv('SO'))
|
||||
|
|
@ -34,13 +36,13 @@ if localenv['python_package'] == 'full':
|
|||
localenv.Depends(pymodule, make_setup)
|
||||
if localenv['OS'] == 'Windows':
|
||||
for file in localenv['clib_shared']:
|
||||
dest = pjoin('Cantera', 'python', 'Cantera', file.name)
|
||||
dest = pjoin('interfaces', 'python', 'Cantera', file.name)
|
||||
localenv.AddPreAction(pymodule,Copy(dest, file))
|
||||
|
||||
elif localenv['python_package'] == 'minimal':
|
||||
pymodule = make_setup
|
||||
|
||||
moddir = pjoin('Cantera', 'python')
|
||||
moddir = pjoin('interfaces', 'python')
|
||||
localenv.AddPostAction(make_setup,
|
||||
'cd %s && $python_cmd setup.py build' % moddir)
|
||||
|
||||
Loading…
Add table
Reference in a new issue