OLD | NEW |
(Empty) | |
| 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 import os |
| 6 |
| 7 Help("""\ |
| 8 Type: 'scons' to build and 'scons -c' to clean\ |
| 9 """) |
| 10 |
| 11 # Create a base environment including things that are likely to be common |
| 12 # to all of the objects in this directory. We pull in overrides from the |
| 13 # environment to enable cross-compile. |
| 14 base_env = Environment() |
| 15 for key in Split('CC CXX AR RANLIB LD NM PKG_CONFIG'): |
| 16 value = os.environ.get(key) |
| 17 if value is not None: |
| 18 base_env[key] = value |
| 19 for key in Split('CFLAGS CPPFLAGS CXXFLAGS CCFLAGS CPPPATH LIBPATH'): |
| 20 value = os.environ.get(key, '') |
| 21 base_env[key] = Split(value) |
| 22 |
| 23 extra_flags = '-fno-strict-aliasing -Wall -Wextra -Werror -Wuninitialized' |
| 24 extra_cppflags = '-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS' |
| 25 base_env['CFLAGS'].extend(Split(extra_flags)) |
| 26 base_env['CXXFLAGS'].extend(Split(extra_flags)) |
| 27 base_env['CPPFLAGS'].extend(Split(extra_cppflags)) |
| 28 |
| 29 # Fix issue with scons not passing some vars through the environment. |
| 30 for key in Split('SYSROOT'): |
| 31 if key in os.environ: |
| 32 base_env['ENV'][key] = os.environ[key] |
| 33 base_env.Append(CPPPATH=['..']) |
| 34 |
| 35 shill_env = base_env.Clone() |
| 36 shill_env.ParseConfig( |
| 37 os.environ['PKG_CONFIG'] + ' --cflags --libs dbus-1 dbus-glib-1' |
| 38 ) |
| 39 shill_env.Append(LIBS=['base', 'glog']) |
| 40 |
| 41 shill_sources = Split('''\ |
| 42 shill_logging.cc shill_daemon.cc shill_config.cc shill_event.cc |
| 43 resource.cc manager.cc service.cc device.cc |
| 44 dbus_control.cc |
| 45 ''') |
| 46 shill_lib = shill_env.Library('shill_lib', shill_sources) |
| 47 shill = shill_env.Program('shill', ['shill_main.cc', shill_lib]) |
| 48 Default(shill) |
| 49 |
| 50 # Build unit tests |
| 51 tests = [] |
| 52 testrunner = base_env.Library('testrunner', ['testrunner.cc']) |
| 53 shill_unittest_env = shill_env.Clone() |
| 54 shill_unittest_env.Append(LIBS=['gtest', 'gmock']) |
| 55 deps = [testrunner, 'shill_unittest.cc'] |
| 56 deps.append(shill_lib) |
| 57 tests.append(shill_unittest_env.Program('shill_unittest', deps)) |
| 58 AlwaysBuild(base_env.Alias('tests', tests)) |
OLD | NEW |