Updated sample build scripts to include pthread where necessary
This commit is contained in:
parent
82d467944f
commit
3be53356a2
9 changed files with 28 additions and 11 deletions
13
SConstruct
13
SConstruct
|
|
@ -112,6 +112,9 @@ env = Environment(tools=toolchain+['textfile', 'subst', 'recursiveInstall', 'wix
|
|||
toolchain=toolchain,
|
||||
**extraEnvArgs)
|
||||
|
||||
env['OS'] = platform.system()
|
||||
env['OS_BITS'] = int(platform.architecture()[0][:2])
|
||||
|
||||
# Fixes a linker error in Windows
|
||||
if os.name == 'nt' and 'TMP' in os.environ:
|
||||
env['ENV']['TMP'] = os.environ['TMP']
|
||||
|
|
@ -196,11 +199,14 @@ elif env['CC'] == 'clang':
|
|||
else:
|
||||
print "WARNING: Unrecognized C compiler '%s'" % env['CC']
|
||||
|
||||
defaults.threadFlags = '-pthread' if os.name != 'nt' else ''
|
||||
|
||||
# TODO: Once deprecated functions have been removed, remove the
|
||||
# compiler options: -Wno-deprecated-declarations and /wd4996
|
||||
|
||||
if env['OS'] in ('Windows', 'Darwin'):
|
||||
defaults.threadFlags = ''
|
||||
else:
|
||||
defaults.threadFlags = '-pthread'
|
||||
|
||||
# **************************************
|
||||
# *** Read user-configurable options ***
|
||||
# **************************************
|
||||
|
|
@ -602,9 +608,6 @@ of this file is:
|
|||
# ********************************************
|
||||
# *** Configure system-specific properties ***
|
||||
# ********************************************
|
||||
env['OS'] = platform.system()
|
||||
|
||||
env['OS_BITS'] = int(platform.architecture()[0][:2])
|
||||
|
||||
# Copy in external environment variables
|
||||
if env['env_vars'] == 'all':
|
||||
|
|
|
|||
|
|
@ -28,12 +28,14 @@ CANTERA_VERSION=@cantera_version@
|
|||
CANTERA_CORE_INCLUDES=-I@ct_incroot@
|
||||
|
||||
# Required Cantera libraries
|
||||
CANTERA_CORE_LIBS=-L@ct_libdir@ -lcantera
|
||||
CANTERA_CORE_LIBS=@mak_threadflags@ -L@ct_libdir@ -lcantera
|
||||
|
||||
CANTERA_CORE_FTN=-L@ct_libdir@ -lcantera_fortran -lcantera
|
||||
|
||||
CANTERA_FORTRAN_MODS=@ct_incroot@/cantera
|
||||
|
||||
CANTERA_FORTRAN_SYSLIBS=@mak_fort_threadflags@ -lstdc++
|
||||
|
||||
###############################################################################
|
||||
# BOOST
|
||||
###############################################################################
|
||||
|
|
@ -75,7 +77,7 @@ CANTERA_LIBS=$(CANTERA_CORE_LIBS) $(CANTERA_SUNDIALS_LIBS) \
|
|||
|
||||
CANTERA_FORTRAN_LIBS=$(CANTERA_CORE_FTN) $(CANTERA_SUNDIALS_LIBS) \
|
||||
$(CANTERA_BLAS_LAPACK_LIBS) $(CANTERA_BOOST_LIBS) \
|
||||
-lstdc++
|
||||
$(CANTERA_FORTRAN_SYSLIBS)
|
||||
|
||||
###############################################################################
|
||||
# END
|
||||
|
|
|
|||
|
|
@ -36,9 +36,13 @@ localenv['mak_boost_libdir'] = ('-L' + localenv['boost_lib_dir']
|
|||
localenv['mak_boost_libs'] = ' '.join('-l%s' % s
|
||||
for s in localenv['boost_libs'])
|
||||
|
||||
|
||||
localenv['mak_have_blas_lapack_dir'] = '1' if localenv['blas_lapack_dir'] else '0'
|
||||
localenv['mak_blas_lapack_libs'] = ' '.join('-l%s' % s
|
||||
for s in localenv['blas_lapack_libs'])
|
||||
localenv['mak_threadflags'] = localenv['thread_flags']
|
||||
if '-pthread' in localenv['thread_flags']:
|
||||
localenv['mak_fort_threadflags'] = '-lpthread'
|
||||
|
||||
mak = build(localenv.SubstFile('Cantera.mak', 'Cantera.mak.in'))
|
||||
install('$inst_sampledir', mak)
|
||||
|
|
|
|||
|
|
@ -32,9 +32,11 @@ for subdir, name, extensions in samples:
|
|||
localenv['boost_libs'] + localenv['blas_lapack_libs'])
|
||||
libdirs = (localenv['ct_libdir'], localenv['sundials_libdir'],
|
||||
localenv['blas_lapack_dir'], localenv['boost_lib_dir'])
|
||||
linkflags = ('-g', localenv['thread_flags'])
|
||||
localenv['tmpl_cantera_incdirs'] = repr([x for x in incdirs if x])
|
||||
localenv['tmpl_cantera_libs'] = repr([x for x in libs if x])
|
||||
localenv['tmpl_cantera_libdirs'] = repr([x for x in libdirs if x])
|
||||
localenv['tmpl_cantera_linkflags'] = repr([x for x in linkflags if x])
|
||||
localenv['tmpl_progname'] = name
|
||||
localenv['tmpl_sourcename'] = name + '.cpp'
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@ env = Environment()
|
|||
env.Append(CCFLAGS='-g',
|
||||
CPPPATH=@tmpl_cantera_incdirs@,
|
||||
LIBS=@tmpl_cantera_libs@,
|
||||
LIBPATH=@tmpl_cantera_libdirs@)
|
||||
LIBPATH=@tmpl_cantera_libdirs@,
|
||||
LINKFLAGS=@tmpl_cantera_linkflags@)
|
||||
|
||||
program = env.Program('@tmpl_progname@', '@tmpl_sourcename@')
|
||||
Default(program)
|
||||
|
|
|
|||
|
|
@ -24,10 +24,11 @@ libs = (['cantera_fortran', 'cantera'] + localenv['sundials_libs'] +
|
|||
localenv['boost_libs'] + localenv['blas_lapack_libs'] + ['stdc++'])
|
||||
libdirs = (localenv['ct_libdir'], localenv['sundials_libdir'],
|
||||
localenv['blas_lapack_dir'], localenv['boost_lib_dir'])
|
||||
linkflags = ('-g', localenv['thread_flags'])
|
||||
localenv['tmpl_cantera_incdirs'] = repr([x for x in incdirs if x])
|
||||
localenv['tmpl_cantera_libs'] = repr([x for x in libs if x])
|
||||
localenv['tmpl_cantera_libdirs'] = repr([x for x in libdirs if x])
|
||||
|
||||
localenv['tmpl_cantera_linkflags'] = repr([x for x in linkflags if x])
|
||||
sconstruct = localenv.SubstFile('SConstruct', 'SConstruct.in')
|
||||
|
||||
# Generate Makefile to be installed
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@ env.Append(FFLAGS='-g',
|
|||
CCFLAGS='-g',
|
||||
CPPPATH=@tmpl_cantera_incdirs@,
|
||||
LIBS=@tmpl_cantera_libs@,
|
||||
LIBPATH=@tmpl_cantera_libdirs@)
|
||||
LIBPATH=@tmpl_cantera_libdirs@,
|
||||
LINKFLAGS=@tmpl_cantera_linkflags@)
|
||||
|
||||
ctlib = env.Object('demo_ftnlib.cpp')
|
||||
|
||||
|
|
|
|||
|
|
@ -18,9 +18,11 @@ for programName, sources in samples:
|
|||
localenv['boost_libs'] + localenv['blas_lapack_libs'] + ['stdc++'])
|
||||
libdirs = (localenv['ct_libdir'], localenv['sundials_libdir'],
|
||||
localenv['blas_lapack_dir'], localenv['boost_lib_dir'])
|
||||
linkflags = ('-g', localenv['thread_flags'])
|
||||
localenv['tmpl_cantera_incdirs'] = repr([x for x in incdirs if x])
|
||||
localenv['tmpl_cantera_libs'] = repr([x for x in libs if x])
|
||||
localenv['tmpl_cantera_libdirs'] = repr([x for x in libdirs if x])
|
||||
localenv['tmpl_cantera_linkflags'] = repr([x for x in linkflags if x])
|
||||
localenv['tmpl_progname'] = programName
|
||||
localenv['tmpl_sourcename'] = programName + '.f90'
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@ env['F90'] = '@F90@'
|
|||
env.Append(FFLAGS='-g',
|
||||
F90PATH=@tmpl_cantera_incdirs@,
|
||||
LIBS=@tmpl_cantera_libs@,
|
||||
LIBPATH=@tmpl_cantera_libdirs@)
|
||||
LIBPATH=@tmpl_cantera_libdirs@,
|
||||
LINKFLAGS=@tmpl_cantera_linkflags@)
|
||||
|
||||
program = env.Program('@tmpl_progname@', '@tmpl_sourcename@')
|
||||
Default(program)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue