Fixed the order of include and library directories when compiling
Include directories in the Cantera source tree should be listed first so that they take precedence over headers from other installed copies of Cantera that might end up on the include search path. This was potentially a problem when Cantera was installed in the same location (e.g. /usr/local) as one of its dependencies (e.g. Sundials). The same logic applies to directories on the library link path.
This commit is contained in:
parent
1c5f7c3ed7
commit
c092bbaede
9 changed files with 19 additions and 19 deletions
|
|
@ -1007,7 +1007,7 @@ def install(*args, **kwargs):
|
|||
|
||||
env.SConsignFile()
|
||||
|
||||
env.Append(CPPPATH=[],
|
||||
env.Prepend(CPPPATH=[],
|
||||
LIBPATH=[Dir('build/lib')])
|
||||
|
||||
if addInstallActions:
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@ def prep_default(env):
|
|||
|
||||
def prep_fortran(env):
|
||||
localenv = env.Clone()
|
||||
localenv.Append(CPPPATH='#include/cantera/base') # for config.h
|
||||
localenv.Prepend(CPPPATH='#include/cantera/base') # for config.h
|
||||
return localenv
|
||||
|
||||
def prep_f2c(env):
|
||||
localenv = env.Clone()
|
||||
|
||||
localenv.Append(CPPPATH=Dir('#ext/f2c_libs'))
|
||||
localenv.Prepend(CPPPATH=Dir('#ext/f2c_libs'))
|
||||
if not localenv['HAS_TIMES_H']:
|
||||
localenv.Append(CPPDEFINES=['USE_CLOCK'])
|
||||
if not localenv['HAS_UNISTD_H']:
|
||||
|
|
@ -37,7 +37,7 @@ def prep_f2c(env):
|
|||
|
||||
def prep_sundials(env):
|
||||
localenv = env.Clone()
|
||||
localenv.Append(CPPPATH=Dir('#ext/cvode/include'))
|
||||
localenv.Prepend(CPPPATH=Dir('#ext/cvode/include'))
|
||||
|
||||
# Suppress warnings from external code
|
||||
if '-Wall' in localenv['CCFLAGS']:
|
||||
|
|
@ -47,8 +47,8 @@ def prep_sundials(env):
|
|||
|
||||
def prep_gtest(env):
|
||||
localenv = env.Clone()
|
||||
localenv.Append(CPPPATH=[Dir('#ext/gtest'),
|
||||
Dir('#ext/gtest/include')],
|
||||
localenv.Prepend(CPPPATH=[Dir('#ext/gtest'),
|
||||
Dir('#ext/gtest/include')],
|
||||
CPPDEFINES={'GTEST_HAS_PTHREAD': 0})
|
||||
return localenv
|
||||
|
||||
|
|
@ -132,8 +132,8 @@ for subdir, extensions, prepFunction in libs:
|
|||
|
||||
|
||||
localenv = env.Clone()
|
||||
localenv.Append(CPPPATH=[Dir('#ext/gtest'),
|
||||
Dir('#ext/gtest/include')],
|
||||
localenv.Prepend(CPPPATH=[Dir('#ext/gtest'),
|
||||
Dir('#ext/gtest/include')],
|
||||
CPPDEFINES={'GTEST_HAS_PTHREAD': 0})
|
||||
build(localenv.Library(pjoin('../lib', 'gtest'),
|
||||
source=['gtest/src/gtest-all.cc']))
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ libs = [('base', ['cpp'], baseSetup),
|
|||
|
||||
for subdir, extensions, setup in libs:
|
||||
localenv = env.Clone()
|
||||
localenv.Append(CPPPATH=Dir('#include'))
|
||||
localenv.Append(CPPPATH=Dir('#src')) # todo: remove when not needed
|
||||
localenv.Prepend(CPPPATH=Dir('#include'))
|
||||
localenv.Prepend(CPPPATH=Dir('#src')) # todo: remove when not needed
|
||||
source = setup(localenv, subdir, extensions)
|
||||
objects = localenv.SharedObject(source)
|
||||
localenv.Depends(objects, localenv['config_h_target'])
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ from buildutils import *
|
|||
|
||||
Import('env', 'build', 'install')
|
||||
localenv = env.Clone()
|
||||
localenv.Append(CPPPATH=['#src', '#include', '#src/apps'])
|
||||
localenv.Prepend(CPPPATH=['#src', '#include', '#src/apps'])
|
||||
|
||||
def buildProgram(name, src):
|
||||
prog = build(localenv.Program(target=pjoin('#build/bin', name),
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from buildutils import *
|
|||
Import('env', 'build', 'install')
|
||||
|
||||
localenv = env.Clone()
|
||||
localenv.Append(CPPPATH=['#include', '#src'])
|
||||
localenv.Prepend(CPPPATH=['#include', '#src'])
|
||||
|
||||
f90_src = mglob(localenv, '.', 'f90', 'cpp')
|
||||
|
||||
|
|
|
|||
|
|
@ -53,8 +53,8 @@ elif os.name == 'posix':
|
|||
linkflags.extend(['-Wl,--no-undefined',
|
||||
'-Wl,--version-script,src/matlab/mexFunction.map'])
|
||||
|
||||
localenv.Append(CPPPATH=['#include', '#src', matlab_include],
|
||||
CPPDEFINES=['MATLAB_MEX_FILE'],
|
||||
localenv.Prepend(CPPPATH=['#include', '#src', matlab_include])
|
||||
localenv.Append(CPPDEFINES=['MATLAB_MEX_FILE'],
|
||||
LIBPATH=[matlab_libs],
|
||||
LINKFLAGS=linkflags)
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ make_setup = localenv.SubstFile('#interfaces/python/setup.py',
|
|||
|
||||
extraArgs = ''
|
||||
if localenv['python_package'] == 'full':
|
||||
localenv.Append(CPPPATH=['#src', '#include'])
|
||||
localenv.Prepend(CPPPATH=['#src', '#include'])
|
||||
|
||||
cantera_libname = 'cantera_shared' if os.name=='nt' else 'cantera'
|
||||
#pylinklibs = [cantera_libname, 'cvode', 'ctmath', 'ctlapack', 'ctblas', 'ctf2c', 'execstream']
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@ import subprocess
|
|||
Import('env','build','install')
|
||||
localenv = env.Clone()
|
||||
|
||||
localenv.Append(CPPPATH=['#ext/gtest/include', '#include'],
|
||||
LIBPATH='#build/lib',
|
||||
LIBS=['gtest'] + localenv['cantera_libs'])
|
||||
localenv.Prepend(CPPPATH=['#ext/gtest/include', '#include'],
|
||||
LIBPATH='#build/lib')
|
||||
localenv.Append(LIBS=['gtest'] + localenv['cantera_libs'])
|
||||
|
||||
localenv['ENV']['PYTHONPATH'] = Dir('#interfaces/python').abspath
|
||||
localenv['ENV']['CANTERA_DATA'] = Dir('#data/inputs').abspath
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ from buildutils import *
|
|||
|
||||
Import('env','build','install')
|
||||
localenv = env.Clone()
|
||||
localenv.Append(CPPPATH=['#include', '#src', 'shared'])
|
||||
localenv.Prepend(CPPPATH=['#include', '#src', 'shared'])
|
||||
|
||||
os.environ['PYTHONPATH'] = pjoin(os.getcwd(), '..', 'interfaces', 'python')
|
||||
os.environ['CANTERA_DATA'] = pjoin(os.getcwd(), '..', 'data', 'inputs')
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue