mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
* Common code extracted to Python directories. * Read ~/.scons file for scons environment defaults. * Override scons settings with shell environment variables. * New "tags" for debug, nodebug, optimize, nooptimize builds. * Universal platform detection. * Default value of environment variables set through prefix dictionaries. * Check for correct Boost value and fail otherwise. * Extract git describe --tags into a preprocesor variable, -DTIP_BRANCH * More colors - blue for unchanged defaults, green for changed defaults, red for error. * Contain unit tests for non-obvious stuff. * Check to see that boost libraries have been built. * Right now, we accept both .dylib and .a versions but it'd be easy to enforce .a only.
60 lines
1.3 KiB
Python
60 lines
1.3 KiB
Python
from __future__ import absolute_import, division, print_function, unicode_literals
|
|
|
|
from beast.platform import Platform
|
|
from beast.util import Dict
|
|
from beast.env import Tags
|
|
|
|
_DEFAULTS = {
|
|
'': {
|
|
'BOOST_HOME': None,
|
|
'CC': 'gcc',
|
|
'CCFLAGS': None,
|
|
'CFLAGS': None,
|
|
'CXX': 'g++',
|
|
'CPPFLAGS': '-std=c++11 -frtti -fno-strict-aliasing',
|
|
'CPPPATH': [],
|
|
'LIBPATH': [],
|
|
'LIBS': [],
|
|
'LINKFLAGS': '',
|
|
},
|
|
|
|
'Darwin': {
|
|
'CC': 'clang',
|
|
'CXX': 'clang++',
|
|
'CPPFLAGS': '-x c++ -stdlib=libc++ -std=c++11 -frtti',
|
|
'LINKFLAGS': '-stdlib=libc++',
|
|
},
|
|
|
|
'FreeBSD': {
|
|
'CC': 'gcc46',
|
|
'CXX': 'g++46',
|
|
'CCFLAGS': '-Wl,-rpath=/usr/local/lib/gcc46',
|
|
'LINKFLAGS': '-Wl,-rpath=/usr/local/lib/gcc46',
|
|
'LIBS': ['kvm'],
|
|
},
|
|
|
|
# TODO: specific flags for Windows, Linux platforms.
|
|
}
|
|
|
|
TAGS = {
|
|
'debug': {
|
|
'CPPFLAGS': '-g -DDEBUG'
|
|
},
|
|
|
|
'optimize': {
|
|
'CPPFLAGS': '-O3',
|
|
},
|
|
|
|
'nooptimize': {
|
|
'CPPFLAGS': '-O0',
|
|
}
|
|
}
|
|
|
|
def get_environment(arguments):
|
|
tags = Tags.get_tags(arguments)
|
|
env = Dict.compose_prefix_dicts(Platform.PLATFORM, _DEFAULTS)
|
|
for tag in tags or []:
|
|
for k, v in TAGS.get(tag, {}).items():
|
|
env[k] = '%s %s' % (env[k], v)
|
|
return env
|