| # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import os |
| import sys |
| |
| SOURCES=['chromeos/dbus/abstract_dbus_service.cc', |
| 'chromeos/dbus/dbus.cc', |
| 'chromeos/dbus/service_constants.cc', |
| 'chromeos/process.cc', |
| 'chromeos/string.cc', |
| 'chromeos/syslog_logging.cc', |
| 'chromeos/utility.cc'] |
| |
| env = Environment( |
| CPPPATH=[ '.', '../third_party/chrome/files' ], |
| CCFLAGS=[ '-g' ], |
| ) |
| for key in Split('CC CXX AR RANLIB LD NM CFLAGS CCFLAGS'): |
| value = os.environ.get(key) |
| if value != None: |
| env[key] = Split(value) |
| env['CCFLAGS'] += ['-fPIC', '-fno-exceptions'] |
| |
| # Fix issue with scons not passing some vars through the environment. |
| for key in Split('PKG_CONFIG_LIBDIR PKG_CONFIG_PATH SYSROOT'): |
| if os.environ.has_key(key): |
| env['ENV'][key] = os.environ[key] |
| |
| # glib and dbug environment |
| env.ParseConfig('pkg-config --cflags --libs dbus-1 glib-2.0 dbus-glib-1') |
| env.StaticLibrary('chromeos', SOURCES) |
| |
| # Unit test |
| if ARGUMENTS.get('debug', 0): |
| env.Append( |
| CCFLAGS = ['-fprofile-arcs', '-ftest-coverage', '-fno-inline'], |
| LIBS = ['gcov'], |
| ) |
| |
| env_test = env.Clone() |
| |
| env_test.Append( |
| LIBS = ['gtest', 'base', 'rt'], |
| LIBPATH = ['.', '../third_party/chrome'], |
| ) |
| for key in Split('CC CXX AR RANLIB LD NM CFLAGS CCFLAGS'): |
| value = os.environ.get(key) |
| if value: |
| env_test[key] = Split(value) |
| |
| # Use libchromeos instead of passing in LIBS in order to always |
| # get the version we just built, not what was previously installed. |
| unittest_sources =['chromeos/glib/object_unittest.cc', |
| 'chromeos/process_test.cc', |
| 'libchromeos.a'] |
| unittest_main = ['testrunner.cc'] |
| unittest_cmd = env_test.Program('unittests', |
| unittest_sources + unittest_main) |
| |
| Clean(unittest_cmd, Glob('*.gcda') + Glob('*.gcno') + Glob('*.gcov') + |
| Split('html app.info')) |