diff options
author | armvixl <vixl@arm.com> | 2015-03-31 11:04:14 +0100 |
---|---|---|
committer | armvixl <vixl@arm.com> | 2015-03-31 11:04:14 +0100 |
commit | 6e2c8275d5f34a531fe1eef7a7aa877601be8558 (patch) | |
tree | 9ed00f5c8e9c9c55b9f2820f85d0ae0f4dc9871f /SConstruct | |
parent | 5289c5900fb214f2f6aa61e2a9263730dcf4cc17 (diff) | |
download | vixl-6e2c8275d5f34a531fe1eef7a7aa877601be8558.tar.gz |
VIXL Release 1.9
Refer to the README.md and LICENCE files for details.
Diffstat (limited to 'SConstruct')
-rw-r--r-- | SConstruct | 63 |
1 files changed, 40 insertions, 23 deletions
@@ -49,18 +49,19 @@ Some common build targets are: # Global configuration. PROJ_SRC_DIR = 'src' PROJ_SRC_FILES = ''' -src/a64/assembler-a64.cc -src/a64/cpu-a64.cc -src/a64/debugger-a64.cc -src/a64/decoder-a64.cc -src/a64/disasm-a64.cc -src/a64/instructions-a64.cc -src/a64/instrument-a64.cc -src/a64/logic-a64.cc -src/a64/macro-assembler-a64.cc -src/a64/simulator-a64.cc -src/code-buffer.cc -src/utils.cc +src/vixl/a64/assembler-a64.cc +src/vixl/a64/cpu-a64.cc +src/vixl/a64/debugger-a64.cc +src/vixl/a64/decoder-a64.cc +src/vixl/a64/disasm-a64.cc +src/vixl/a64/instructions-a64.cc +src/vixl/a64/instrument-a64.cc +src/vixl/a64/logic-a64.cc +src/vixl/a64/macro-assembler-a64.cc +src/vixl/a64/simulator-a64.cc +src/vixl/code-buffer.cc +src/vixl/compiler-intrinsics.cc +src/vixl/utils.cc '''.split() PROJ_EXAMPLES_DIR = 'examples' PROJ_EXAMPLES_SRC_FILES = ''' @@ -119,9 +120,7 @@ TARGET_SRC_FILES = { benchmarks/bench-branch-link-masm.cc '''.split() } -RELEASE_OBJ_DIR = 'obj/release' -DEBUG_OBJ_DIR = 'obj/debug' - +OBJ_DIR = 'obj' # Helper functions. def abort(message): @@ -133,6 +132,10 @@ def list_target(obj_dir, src_files): return map(lambda x: os.path.join(obj_dir, x), src_files) +def is_compiler(compiler): + return env['CXX'].find(compiler) == 0 + + def create_variant(obj_dir, targets_dir): VariantDir(os.path.join(obj_dir, PROJ_SRC_DIR), PROJ_SRC_DIR) for directory in targets_dir.itervalues(): @@ -146,10 +149,9 @@ args.Add(EnumVariable('mode', 'Build mode', 'release', sim_default = 'off' if platform.machine() == 'aarch64' else 'on' args.Add(EnumVariable('simulator', 'build for the simulator', sim_default, allowed_values = ['on', 'off'])) +args.Add('std', 'c++ standard') # Configure the environment. -create_variant(RELEASE_OBJ_DIR, TARGET_SRC_DIR) -create_variant(DEBUG_OBJ_DIR, TARGET_SRC_DIR) env = Environment(variables=args) # Commandline help. @@ -175,18 +177,32 @@ if os.environ.get('LINKFLAGS'): env.Append(LINKFLAGS = os.environ.get('LINKFLAGS').split()) # Always look in 'src' for include files. +# TODO: Restore the '-Wunreachable-code' flag. This flag breaks builds for clang +# 3.4 with std=c++98. So we need to re-enable this conditionally when clang is at +# version 3.5 or later. env.Append(CPPPATH = [PROJ_SRC_DIR]) env.Append(CPPFLAGS = ['-Wall', '-Werror', '-fdiagnostics-show-option', '-Wextra', + '-Wredundant-decls', '-pedantic', # Explicitly enable the write-strings warning. VIXL uses # const correctly when handling string constants. '-Wwrite-strings']) build_suffix = '' +std_path = 'default-std' + +if 'std' in env: + env.Append(CPPFLAGS = ['-std=' + env['std']]) + std_path = env['std'] +if is_compiler('clang++'): + # This warning only works for Clang, when compiling the code base as C++11 + # or newer. The compiler does not complain if the option is passed when + # compiling earlier C++ standards. + env.Append(CPPFLAGS = ['-Wimplicit-fallthrough']) if env['simulator'] == 'on': env.Append(CPPFLAGS = ['-DUSE_SIMULATOR']) @@ -196,11 +212,9 @@ if env['mode'] == 'debug': env.Append(CPPFLAGS = ['-g', '-DVIXL_DEBUG']) # Append the debug mode suffix to the executable name. build_suffix += '_g' - build_dir = DEBUG_OBJ_DIR else: # Release mode. env.Append(CPPFLAGS = ['-O3']) - build_dir = RELEASE_OBJ_DIR process = subprocess.Popen(env['CXX'] + ' --version | grep "gnu.*4\.8"', shell = True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) @@ -214,6 +228,9 @@ else: # GCC 4.8. env.Append(CPPFLAGS = ['-Wno-maybe-uninitialized']) +# Configure build directory +build_dir = os.path.join(OBJ_DIR, env['mode'], env['CXX'], std_path, '') +create_variant(build_dir, TARGET_SRC_DIR) # The lists of available targets and target names. targets = [] @@ -226,7 +243,7 @@ def create_alias(name, target): # The vixl library. -libvixl = env.Library('vixl' + build_suffix, +libvixl = env.Library(build_dir + 'vixl' + build_suffix, list_target(build_dir, PROJ_SRC_FILES)) create_alias('libvixl', libvixl) @@ -238,7 +255,7 @@ test_ex_vdir = os.path.join(build_dir, 'test_examples') VariantDir(test_ex_vdir, '.') test_ex_obj = env.Object(list_target(test_ex_vdir, PROJ_EXAMPLES_SRC_FILES), CPPFLAGS = env['CPPFLAGS'] + ['-DTEST_EXAMPLES']) -test = env.Program('test-runner' + build_suffix, +test = env.Program(build_dir + 'test-runner' + build_suffix, list_target(build_dir, TARGET_SRC_FILES['test']) + test_ex_obj + libvixl, CPPPATH = env['CPPPATH'] + [PROJ_EXAMPLES_DIR]) @@ -248,7 +265,7 @@ create_alias('test', test) benchmarks = ['bench-dataop', 'bench-branch', 'bench-branch-link', 'bench-branch-masm', 'bench-branch-link-masm'] for bench in benchmarks: - prog = env.Program(bench + build_suffix, + prog = env.Program(build_dir + bench + build_suffix, list_target(build_dir, TARGET_SRC_FILES[bench]) + libvixl) create_alias(bench, prog) # Alias to build all benchmarks. @@ -258,7 +275,7 @@ create_alias('benchmarks', benchmarks) examples = [] for example in PROJ_EXAMPLES_SRC_FILES: example_name = "example-" + os.path.splitext(os.path.basename(example))[0] - prog = env.Program(example_name, + prog = env.Program(build_dir + example_name, [os.path.join(build_dir, example)] + libvixl, CPPPATH = env['CPPPATH'] + [PROJ_EXAMPLES_DIR]) create_alias(example_name, prog) |