Supress warnings in externally-supplied code (f2c, cvode)
This commit is contained in:
parent
d4b4cec673
commit
310dec47f0
1 changed files with 46 additions and 18 deletions
|
|
@ -3,11 +3,11 @@ from buildutils import *
|
||||||
Import('env', 'buildDir', 'buildTargets', 'installTargets')
|
Import('env', 'buildDir', 'buildTargets', 'installTargets')
|
||||||
localenv = env.Clone()
|
localenv = env.Clone()
|
||||||
|
|
||||||
# (subdir, library name, (file extensions))
|
def prep_default(env):
|
||||||
libs = [('tpx','tpx',['cpp'])]
|
return env.Clone()
|
||||||
|
|
||||||
if env['build_with_f2c']:
|
def prep_f2c(env):
|
||||||
libs.append(('f2c_math', 'ctmath', ['cpp','c']))
|
localenv = env.Clone()
|
||||||
|
|
||||||
localenv.Append(CPPPATH=Dir('#ext/f2c_libs'))
|
localenv.Append(CPPPATH=Dir('#ext/f2c_libs'))
|
||||||
if not localenv['HAS_TIMES_H']:
|
if not localenv['HAS_TIMES_H']:
|
||||||
|
|
@ -15,9 +15,35 @@ if env['build_with_f2c']:
|
||||||
if not localenv['HAS_UNISTD_H']:
|
if not localenv['HAS_UNISTD_H']:
|
||||||
localenv.Append(CPPDEFINES=['MSDOS'])
|
localenv.Append(CPPDEFINES=['MSDOS'])
|
||||||
|
|
||||||
|
# The F2C code generates a lot of warnings designed to catch
|
||||||
|
# programmer errors, but since this is autogenerated code, those
|
||||||
|
# warnings are irrelevant.
|
||||||
|
if '-Wall' in localenv['CCFLAGS']:
|
||||||
|
localenv['CCFLAGS'].remove('-Wall')
|
||||||
|
localenv['CCFLAGS'].append('-Wno-format-security')
|
||||||
|
|
||||||
|
return localenv
|
||||||
|
|
||||||
|
def prep_sundials(env):
|
||||||
|
localenv = env.Clone()
|
||||||
|
localenv.Append(CPPPATH=Dir('#ext/cvode/include'))
|
||||||
|
|
||||||
|
# Suppress warnings from external code
|
||||||
|
if '-Wall' in localenv['CCFLAGS']:
|
||||||
|
localenv['CCFLAGS'].append('-Wno-format')
|
||||||
|
|
||||||
|
return localenv
|
||||||
|
|
||||||
|
# (subdir, library name, (file extensions), prepfunction)
|
||||||
|
libs = [('tpx','tpx',['cpp'],prep_default)]
|
||||||
|
|
||||||
|
if env['build_with_f2c']:
|
||||||
|
libs.append(('f2c_math', 'ctmath', ['cpp','c'], prep_f2c))
|
||||||
|
|
||||||
# Create arith.h using the arithchk program
|
# Create arith.h using the arithchk program
|
||||||
if not os.path.exists('arith.h'):
|
if not os.path.exists('arith.h'):
|
||||||
arithenv = env.Clone()
|
arithenv = prep_f2c(env)
|
||||||
|
|
||||||
# TODO: make link flag more general
|
# TODO: make link flag more general
|
||||||
arithenv.Append(CPPFLAGS='-DNO_FPINIT')
|
arithenv.Append(CPPFLAGS='-DNO_FPINIT')
|
||||||
arithenv.Program('f2c_libs/arithchk/arithchk', source='f2c_libs/arithchk/arithchk.c',
|
arithenv.Program('f2c_libs/arithchk/arithchk', source='f2c_libs/arithchk/arithchk.c',
|
||||||
|
|
@ -25,31 +51,33 @@ if env['build_with_f2c']:
|
||||||
arithenv.Command('#ext/f2c_libs/arith.h', 'f2c_libs/arithchk/arithchk$PROGSUFFIX',
|
arithenv.Command('#ext/f2c_libs/arith.h', 'f2c_libs/arithchk/arithchk$PROGSUFFIX',
|
||||||
'$SOURCE > $TARGET')
|
'$SOURCE > $TARGET')
|
||||||
|
|
||||||
|
headerenv = prep_f2c(env)
|
||||||
# Possibly system-depenent headers
|
# Possibly system-depenent headers
|
||||||
localenv.Command('#ext/f2c_libs/signal1.h', 'f2c_libs/signal1.h0',
|
headerenv.Command('#ext/f2c_libs/signal1.h', 'f2c_libs/signal1.h0',
|
||||||
Copy('$TARGET', '$SOURCE'))
|
Copy('$TARGET', '$SOURCE'))
|
||||||
|
|
||||||
localenv.Command('#ext/f2c_libs/sysdep1.h', 'f2c_libs/sysdep1.h0',
|
headerenv.Command('#ext/f2c_libs/sysdep1.h', 'f2c_libs/sysdep1.h0',
|
||||||
Copy('$TARGET', '$SOURCE'))
|
Copy('$TARGET', '$SOURCE'))
|
||||||
|
|
||||||
libs.append(('f2c_libs', 'ctf2c', 'c'))
|
libs.append(('f2c_libs', 'ctf2c', 'c', prep_f2c))
|
||||||
|
|
||||||
if env['BUILD_BLAS_LAPACK']:
|
if env['BUILD_BLAS_LAPACK']:
|
||||||
libs.append(('f2c_blas', 'ctblas', ['c']))
|
libs.append(('f2c_blas', 'ctblas', ['c'], prep_f2c))
|
||||||
libs.append(('f2c_lapack', 'ctlapack', ['c']))
|
libs.append(('f2c_lapack', 'ctlapack', ['c'], prep_f2c))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
libs.append(('math', 'ctmath', ['cpp','c','f']))
|
libs.append(('math', 'ctmath', ['cpp','c','f'], prep_default))
|
||||||
|
|
||||||
if env['BUILD_BLAS_LAPACK']:
|
if env['BUILD_BLAS_LAPACK']:
|
||||||
libs.append(('blas', 'ctblas', ['f']))
|
libs.append(('blas', 'ctblas', ['f'], prep_default))
|
||||||
libs.append(('lapack', 'ctlapack', ['f']))
|
libs.append(('lapack', 'ctlapack', ['f'], prep_default))
|
||||||
|
|
||||||
if env['use_sundials'] == 'n':
|
if env['use_sundials'] == 'n':
|
||||||
libs.append(('cvode/source', 'cvode', ['c']))
|
libs.append(('cvode/source', 'cvode', ['c'], prep_sundials))
|
||||||
localenv.Append(CPPPATH=Dir('#ext/cvode/include'))
|
|
||||||
|
|
||||||
for subdir, libname, extensions in libs:
|
|
||||||
|
for subdir, libname, extensions, prepFunction in libs:
|
||||||
|
localenv = prepFunction(env)
|
||||||
lib = localenv.Library(pjoin('../lib', libname),
|
lib = localenv.Library(pjoin('../lib', libname),
|
||||||
source=mglob(localenv, subdir, *extensions))
|
source=mglob(localenv, subdir, *extensions))
|
||||||
inst = localenv.Install('$inst_libdir', lib)
|
inst = localenv.Install('$inst_libdir', lib)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue