]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/python/SConstruct
3 # Copyright (c) 2016 Stefan Seefeld
6 # Distributed under the Boost Software License, Version 1.0.
7 # (See accompanying file LICENSE_1_0.txt or copy at
8 # http://www.boost.org/LICENSE_1_0.txt)
10 import SCons
.Script
.Main
19 # We try to mimic the typical autotools-workflow.
21 # * In a 'configure' step all the essential build parameters are established
22 # (either by explicit command-line arguments or from configure checks)
23 # * A subsequent build step can then simply read the cached variables, so
24 # users don't have to memorize and re-issue the arguments on each subsequent
25 # invocation, and neither do the config checks need to be re-run.
27 # The essential part here is to define a 'config' target, which removes any
28 # caches that may still be lingering around, then runs the checks.
30 if 'config' in COMMAND_LINE_TARGETS
:
32 try: os
.remove('bin.SCons/config.py')
34 if not os
.path
.exists('bin.SCons/'):
35 os
.mkdir('bin.SCons/')
36 vars = Variables('bin.SCons/config.py', ARGUMENTS
)
37 config
.add_options(vars)
38 arch
= ARGUMENTS
.get('arch', platform
.machine())
40 if 'CXX' in os
.environ
: env_vars
['CXX'] = os
.environ
['CXX']
41 if 'CXXFLAGS' in os
.environ
: env_vars
['CXXFLAGS'] = os
.environ
['CXXFLAGS'].split()
42 env_vars
['ENV'] = os
.environ
#{'PATH': os.environ['PATH'], 'TMP' : os.environ['TMP']}
43 env
= Environment(toolpath
=['config/tools'],
44 tools
=['default', 'libs', 'tests', 'doc', 'sphinx4scons'],
48 if 'gcc' in env
['TOOLS']:
49 # Earlier SCons versions (~ 2.3.0) can't handle CXX=clang++.
50 version
= subprocess
.check_output([env
['CXX'], '--version'])
51 match
= re
.search(r
'[0-9]+(\.[0-9]+)+', version
)
53 version
= match
.group(0)
56 env
['CXXVERSION'] = version
58 Help(config
.ui
.help(vars, env
) + """
59 Variables are saved in bin.SCons/config.py and persist between scons invocations.
65 build_dir
= config
.prepare_build_dir(env
)
66 config_log
= '{}/config.log'.format(build_dir
)
69 SConsignFile('{}/.sconsign'.format(build_dir
))
70 #env.Decider('MD5-timestamp')
71 env
.Decider('timestamp-newer')
72 checks
= config
.get_checks(env
)
73 if 'config' in COMMAND_LINE_TARGETS
:
74 conf
=env
.Configure(custom_tests
=checks
, log_file
=config_log
, conf_dir
=build_dir
)
75 if False in (getattr(conf
, c
)() for c
in checks
):
78 vars.Save('bin.SCons/config.py', env
)
80 if not os
.path
.exists(config_log
):
81 print('Please run `scons config` first. (See `scons -h` for available options.)')
84 if not GetOption('verbose'):
85 config
.ui
.pretty_output(env
)
88 env
['BPL_VERSION'] = '1.65'
89 for e
in config
.variants(env
):
90 variant_dir
=e
.subst("$BOOST_CURRENT_VARIANT_DIR")
91 e
.SConscript('src/SConscript', variant_dir
=variant_dir
+ '/src',
92 exports
= { 'env' : e
.Clone(BOOST_LIB
= 'python') })
93 if 'test' in COMMAND_LINE_TARGETS
:
94 test_env
= e
.Clone(BOOST_LIB
= 'python', BOOST_TEST
= True)
95 test_env
.BoostUseLib('python')
96 e
.SConscript('test/SConscript', variant_dir
=variant_dir
+ '/test',
97 exports
= { 'env' : test_env
})
99 if 'doc' in COMMAND_LINE_TARGETS
:
100 env
.SConscript('doc/SConscript', variant_dir
='bin.SCons/doc',
101 exports
= { 'env' : e
.Clone(BOOST_LIB
= 'python') })