Added legacy_headers option to SCons
This will create symlinks (on posix systems) or copies (on Windows) of the Cantera headers in the 'canterna/kernel' directory, corresponding to the behavior of older versions of Cantera.
This commit is contained in:
parent
6195b488c2
commit
31c7c36921
2 changed files with 39 additions and 0 deletions
37
SConstruct
37
SConstruct
|
|
@ -500,6 +500,11 @@ opts.AddVariables(
|
|||
local filesystem.""",
|
||||
'',
|
||||
PathVariable.PathAccept),
|
||||
BoolVariable(
|
||||
'legacy_headers',
|
||||
"""Create symbolic links for headers that were installed to the
|
||||
'kernel' subdirectory in previous versions of Cantera.""",
|
||||
False),
|
||||
PathVariable(
|
||||
'graphvisdir',
|
||||
"""The directory location of the graphviz program, dot. dot is
|
||||
|
|
@ -897,6 +902,38 @@ if env['addInstallTargets']:
|
|||
inst = env.RecursiveInstall('$inst_incdir', 'include/cantera')
|
||||
installTargets.extend(inst)
|
||||
|
||||
# Make symlinks to replicate old header directory structure
|
||||
if env['legacy_headers']:
|
||||
inst = env.Command(pjoin(instRoot, 'include', 'cantera', 'kernel'), [],
|
||||
Mkdir("$TARGET"))
|
||||
installTargets.extend(inst)
|
||||
|
||||
if env['OS'] == 'Windows':
|
||||
cmd = Copy("$TARGET", "$SOURCE")
|
||||
else:
|
||||
def RelativeSymlink(target, source, env):
|
||||
if os.path.exists(target[0].path):
|
||||
os.remove(target[0].path)
|
||||
srcpath = psplit(source[0].abspath)
|
||||
tgtpath = psplit(target[0].abspath)
|
||||
nCommon = max(i for i,(dir1,dir2) in enumerate(zip(srcpath, tgtpath))
|
||||
if dir1 == dir2)
|
||||
relsrc = os.sep.join(['..'] + srcpath[nCommon-1:])
|
||||
os.symlink(relsrc, target[0].abspath)
|
||||
|
||||
cmd = RelativeSymlink
|
||||
|
||||
for name in os.listdir('include/cantera'):
|
||||
if not os.path.isdir(pjoin('include/cantera', name)):
|
||||
continue
|
||||
for filename in os.listdir(pjoin('include/cantera', name)):
|
||||
if not filename.endswith('.h'):
|
||||
continue
|
||||
headerdir = pjoin(instRoot, 'include', 'cantera')
|
||||
inst = env.Command(pjoin(headerdir, 'kernel', filename),
|
||||
pjoin(headerdir, name, filename), cmd)
|
||||
installTargets.extend(inst)
|
||||
|
||||
# Install C++ samples
|
||||
inst = env.RecursiveInstall(pjoin('$inst_sampledir', 'cxx'),
|
||||
'samples/cxx')
|
||||
|
|
|
|||
|
|
@ -350,6 +350,7 @@ def psplit(s):
|
|||
Split a path given as a string into a list.
|
||||
This is the inverse of os.path.join.
|
||||
"""
|
||||
s = s.strip('/\\')
|
||||
head, tail = os.path.split(s)
|
||||
path = [tail]
|
||||
while head:
|
||||
|
|
@ -394,6 +395,7 @@ optionWrapper = textwrap.TextWrapper(initial_indent=' ',
|
|||
subsequent_indent=' ',
|
||||
width=72)
|
||||
|
||||
|
||||
def formatOption(env, opt):
|
||||
"""
|
||||
Print a nicely formatted description of a SCons configuration
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue