Added SCons installation targets for libraries and binaries
This commit is contained in:
parent
81fb345b96
commit
702ae7251d
9 changed files with 82 additions and 56 deletions
|
|
@ -1,13 +1,10 @@
|
|||
from buildutils import *
|
||||
|
||||
Import('env', 'build')
|
||||
|
||||
# (subdir, library name, (file extensions))
|
||||
libs = [BuildOpts('src', 'clib')]
|
||||
|
||||
print os.getcwd()
|
||||
for lib in libs:
|
||||
localenv = env.Clone()
|
||||
localenv.Library(pjoin('../../lib', lib.name),
|
||||
source=mglob(localenv, lib.subdir, *lib.extensions))
|
||||
Import('env', 'buildTargets', 'installTargets')
|
||||
|
||||
localenv = env.Clone()
|
||||
lib = localenv.Library(pjoin('../../lib', 'clib'),
|
||||
source=mglob(localenv, 'src', 'cpp'))
|
||||
inst = localenv.Install('$ct_libdir', lib)
|
||||
buildTargets.extend(lib)
|
||||
installTargets.extend(inst)
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
from buildutils import *
|
||||
|
||||
Import('env', 'build')
|
||||
Import('env', 'buildTargets', 'installTargets')
|
||||
|
||||
# (subdir, library name, (file extensions))
|
||||
libs = [BuildOpts('src', 'ctcxx')]
|
||||
|
||||
print os.getcwd()
|
||||
for lib in libs:
|
||||
localenv = env.Clone()
|
||||
localenv.Library(pjoin('../../lib', lib.name),
|
||||
source=mglob(localenv, lib.subdir, *lib.extensions))
|
||||
localenv = env.Clone()
|
||||
lib = localenv.Library(pjoin('../../lib', 'ctcxx'),
|
||||
source=mglob(localenv, 'src', 'cpp'))
|
||||
inst = localenv.Install('$ct_libdir', lib)
|
||||
|
||||
buildTargets.extend(lib)
|
||||
installTargets.extend(inst)
|
||||
|
|
|
|||
|
|
@ -1,13 +1,15 @@
|
|||
from buildutils import *
|
||||
|
||||
Import('env', 'build')
|
||||
Import('env', 'buildTargets', 'installTargets')
|
||||
|
||||
localenv = env.Clone()
|
||||
|
||||
localenv.Library(target=pjoin('..','..','lib','fct'),
|
||||
source=mglob(localenv, 'src', 'f90', 'cpp'))
|
||||
lib = localenv.Library(target=pjoin('..','..','lib','fct'),
|
||||
source=mglob(localenv, 'src', 'f90', 'cpp'))
|
||||
inst = localenv.Install('$ct_libdir', lib)
|
||||
|
||||
# Copy the mod files to the include directory
|
||||
for mod in mglob(localenv, 'src', 'mod'):
|
||||
env.Command('../../include/cantera/%s' % mod.name, mod,
|
||||
Copy('$TARGET', '$SOURCE'))
|
||||
copy = localenv.Command('../../include/cantera/%s' % mod.name, mod,
|
||||
Copy('$TARGET', '$SOURCE'))
|
||||
localenv.AddPostAction(lib, copy)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
from buildutils import *
|
||||
|
||||
Import('env', 'build')
|
||||
Import('env', 'buildTargets', 'installTargets')
|
||||
|
||||
class MatlabBuilder(object):
|
||||
def __init__(self, libs):
|
||||
|
|
@ -41,10 +41,15 @@ if env['build_with_f2c']:
|
|||
else:
|
||||
linkLibs.append('gfortran')
|
||||
|
||||
localenv.Command('cantera/build_cantera.m', mglob(localenv, 'cantera/private', 'cpp'),
|
||||
localenv.Command('cantera/build_cantera.m',
|
||||
mglob(localenv, 'cantera/private', 'cpp'),
|
||||
MatlabBuilder(linkLibs))
|
||||
|
||||
localenv['ENV']['PATH'] = os.environ['PATH']
|
||||
|
||||
localenv.Command('cantera/ctfunctions.mexa64', 'cantera/build_cantera.m',
|
||||
'cd ${SOURCE.dir}; %(matlab_cmd)s -nojvm -nosplash -r build_cantera' % localenv)
|
||||
build_cmd = 'cd ${SOURCE.dir}; %(matlab_cmd)s -nojvm -nosplash -r build_cantera'
|
||||
target = localenv.Command('cantera/ctfunctions.mexa64',
|
||||
'cantera/build_cantera.m',
|
||||
build_cmd % localenv)
|
||||
|
||||
buildTargets.extend(target)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
from buildutils import *
|
||||
import distutils.sysconfig
|
||||
|
||||
Import('env', 'build')
|
||||
Import('env', 'buildTargets', 'installTargets')
|
||||
|
||||
localenv = env.Clone()
|
||||
|
||||
|
|
@ -38,6 +38,7 @@ pymodule = localenv.SharedLibrary('Cantera/_cantera', ['src/pycantera.cpp'],
|
|||
LIBS=linkLibs,
|
||||
SHLIBPREFIX='',
|
||||
SHLIBSUFFIX=gcv('SO'))
|
||||
buildTargets.extend(pymodule)
|
||||
|
||||
localenv.AddPreAction(pymodule, make_ctconf)
|
||||
localenv.AddPostAction(pymodule, 'cd Cantera/python; python setup.py build')
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
from buildutils import *
|
||||
|
||||
Import('env', 'build')
|
||||
Import('env','buildTargets','installTargets')
|
||||
localenv = env.Clone()
|
||||
|
||||
# (subdir, library name, (file extensions))
|
||||
|
|
@ -16,10 +16,12 @@ libs = [('base', 'ctbase', ['cpp']),
|
|||
('zeroD', 'zeroD', ['cpp']),
|
||||
]
|
||||
|
||||
print os.getcwd()
|
||||
for subdir, libname, extensions in libs:
|
||||
for header in mglob(localenv, subdir, 'h'):
|
||||
env.Command('../include/cantera/kernel/%s' % header.name, header,
|
||||
Copy('$TARGET', '$SOURCE'))
|
||||
lib = localenv.Library(pjoin('../lib', libname),
|
||||
source=mglob(localenv, subdir, *extensions))
|
||||
inst = localenv.Install('$ct_libdir', lib)
|
||||
buildTargets.extend(lib)
|
||||
installTargets.extend(inst)
|
||||
|
|
|
|||
33
SConstruct
33
SConstruct
|
|
@ -221,12 +221,23 @@ if env['blas_lapack_libs'] == '':
|
|||
else:
|
||||
ens['blas_lapack_libs'] = ','.split(env['blas_lapack_libs'])
|
||||
|
||||
|
||||
if env['use_sundials'] == 'y' and env['sundials_include']:
|
||||
env.Append(CPPPATH=env['sundials_include'])
|
||||
if env['use_sundials'] == 'y' and env['sundials_libdir']:
|
||||
env.Append(LIBPATH=env['sundials_libdir'])
|
||||
|
||||
env['ct_libdir'] = pjoin(env['prefix'], 'lib')
|
||||
env['ct_bindir'] = pjoin(env['prefix'], 'bin')
|
||||
env['ct_incdir'] = pjoin(env['prefix'], 'include', 'cantera')
|
||||
env['ct_incroot'] = pjoin(env['prefix'], 'include')
|
||||
env['ct_datadir'] = pjoin(env['prefix'], 'data')
|
||||
env['ct_demodir'] = pjoin(env['prefix'], 'demos')
|
||||
env['ct_templdir'] = pjoin(env['prefix'], 'templates')
|
||||
env['ct_tutdir'] = pjoin(env['prefix'], 'tutorials')
|
||||
env['ct_docdir'] = pjoin(env['prefix'], 'doc')
|
||||
env['ct_dir'] = env['prefix']
|
||||
env['ct_mandir'] = pjoin(env['prefix'])
|
||||
|
||||
# *********************
|
||||
# *** Build Cantera ***
|
||||
# *********************
|
||||
|
|
@ -242,7 +253,9 @@ for header in mglob(env, 'Cantera/clib/src', 'h'):
|
|||
|
||||
env.Command('build/include/cantera/config.h', 'config.h', Copy('$TARGET', '$SOURCE'))
|
||||
|
||||
build = 'build'
|
||||
buildDir = 'build'
|
||||
buildTargets = []
|
||||
installTargets = []
|
||||
env.SConsignFile()
|
||||
env.Append(CPPPATH=[Dir(os.getcwd()),
|
||||
Dir('build/include/cantera/kernel'),
|
||||
|
|
@ -253,7 +266,7 @@ env.Append(CPPPATH=[Dir(os.getcwd()),
|
|||
FORTRANFLAGS=['-fPIC'],
|
||||
F90FLAGS=['-fPIC'])
|
||||
|
||||
Export('env', 'build')
|
||||
Export('env', 'buildDir', 'buildTargets', 'installTargets')
|
||||
|
||||
VariantDir('build/ext', 'ext', duplicate=0)
|
||||
SConscript('build/ext/SConscript')
|
||||
|
|
@ -267,13 +280,21 @@ SConscript('build/interfaces/clib/SConscript')
|
|||
VariantDir('build/interfaces/cxx', 'Cantera/cxx', duplicate=0)
|
||||
SConscript('build/interfaces/cxx/SConscript')
|
||||
|
||||
VariantDir('build/interfaces/fortran/', 'Cantera/fortran', duplicate=1)
|
||||
SConscript('build/interfaces/fortran/SConscript')
|
||||
if env['f90_interface']:
|
||||
VariantDir('build/interfaces/fortran/', 'Cantera/fortran', duplicate=1)
|
||||
SConscript('build/interfaces/fortran/SConscript')
|
||||
|
||||
SConscript('Cantera/python/SConscript')
|
||||
if env['BUILD_PYTHON']:
|
||||
SConscript('Cantera/python/SConscript')
|
||||
|
||||
if env['matlab_toolbox'] == 'y':
|
||||
SConscript('Cantera/matlab/SConscript')
|
||||
|
||||
VariantDir('build/tools', 'tools', duplicate=0)
|
||||
SConscript('build/tools/SConscript')
|
||||
|
||||
# Meta-targets
|
||||
build_cantera = Alias('build', buildTargets)
|
||||
install_cantera = Alias('install', installTargets)
|
||||
|
||||
Default(build_cantera)
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
from buildutils import *
|
||||
|
||||
Import('env', 'build')
|
||||
Import('env', 'buildDir', 'buildTargets', 'installTargets')
|
||||
localenv = env.Clone()
|
||||
|
||||
# (subdir, library name, (file extensions))
|
||||
libs = [('tpx','tpx',['cpp']),
|
||||
]
|
||||
libs = [('tpx','tpx',['cpp'])]
|
||||
|
||||
print os.getcwd()
|
||||
if env['build_with_f2c']:
|
||||
|
|
@ -18,11 +17,11 @@ if env['build_with_f2c']:
|
|||
arithenv.Append(LINKFLAGS='-lm', CPPFLAGS='-DNO_FPINIT')
|
||||
arithenv.Program('f2c_libs/arithchk/arithchk', source='f2c_libs/arithchk/arithchk.c')
|
||||
arithenv.Command('arith.h', 'f2c_libs/arithchk/arithchk', '$SOURCE > $TARGET')
|
||||
arithenv.Command('f2c_libs/arith.h', 'arith.h', CopyNoPrefix(build))
|
||||
arithenv.Command('f2c_libs/arith.h', 'arith.h', CopyNoPrefix(buildDir))
|
||||
|
||||
# Possibly system-depenent headers
|
||||
localenv.Command('f2c_libs/signal1.h', 'f2c_libs/signal1.h0', CopyNoPrefix(build))
|
||||
localenv.Command('f2c_libs/sysdep1.h', 'f2c_libs/sysdep1.h0', CopyNoPrefix(build))
|
||||
localenv.Command('f2c_libs/signal1.h', 'f2c_libs/signal1.h0', CopyNoPrefix(buildDir))
|
||||
localenv.Command('f2c_libs/sysdep1.h', 'f2c_libs/sysdep1.h0', CopyNoPrefix(buildDir))
|
||||
|
||||
libs.append(('f2c_libs', 'ctf2c', 'c'))
|
||||
|
||||
|
|
@ -43,3 +42,6 @@ if env['use_sundials'] == 'n':
|
|||
for subdir, libname, extensions in libs:
|
||||
lib = localenv.Library(pjoin('../lib', libname),
|
||||
source=mglob(localenv, subdir, *extensions))
|
||||
inst = localenv.Install('$ct_libdir', lib)
|
||||
buildTargets.extend(lib)
|
||||
installTargets.extend(inst)
|
||||
|
|
|
|||
|
|
@ -1,18 +1,16 @@
|
|||
from buildutils import *
|
||||
|
||||
Import('env')
|
||||
Import('env', 'buildTargets', 'installTargets')
|
||||
localenv = env.Clone()
|
||||
|
||||
bindir = pjoin('..','bin')
|
||||
programs = [('cti2ctml', ['src/cti2ctml.cpp'], ['ctbase']),
|
||||
('ck2cti', ['src/ck2cti.cpp'], ['converters','ctbase','tpx','ctcxx']),
|
||||
('fixtext', ['src/fixtext.cpp'] , [])]
|
||||
|
||||
localenv = env.Clone()
|
||||
localenv.Program(target=pjoin(bindir, 'cti2ctml'),
|
||||
source=['src/cti2ctml.cpp'],
|
||||
LIBS=['ctbase'])
|
||||
|
||||
localenv.Program(target=pjoin(bindir, 'ck2cti'),
|
||||
source=['src/ck2cti.cpp'],
|
||||
LIBS=['converters','ctbase','tpx','ctcxx'])
|
||||
|
||||
localenv.Program(target=pjoin(bindir, 'fixtext'),
|
||||
source=['src/fixtext.cpp'])
|
||||
for name, src, libs in programs:
|
||||
prog = localenv.Program(target=pjoin('..', 'bin', name),
|
||||
source=src,
|
||||
LIBS=libs)
|
||||
inst = localenv.Install('$ct_bindir', prog)
|
||||
buildTargets.extend(prog)
|
||||
installTargets.extend(inst)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue