# This file is generated; do not edit.

import os

Import("env")

env = env.Clone(COMPONENT_NAME='base',
                TARGET_NAME='base_unittests')

configurations = {
    'Debug' : {
        'Append' : dict(
            CCFLAGS = [
                '-Werror',
                '-pthread',
                '-fno-exceptions',
                '-fno-asynchronous-unwind-tables',
                '-fvisibility=hidden',
                '-Wall',
                '-D_FILE_OFFSET_BITS=64',
                '-DPNG_NO_MMX_CODE',
                '-pthread',
                '-I/usr/include/gtk-2.0',
                '-I/usr/lib/gtk-2.0/include',
                '-I/usr/include/atk-1.0',
                '-I/usr/include/cairo',
                '-I/usr/include/pango-1.0',
                '-I/usr/include/glib-2.0',
                '-I/usr/lib/glib-2.0/include',
                '-I/usr/include/freetype2',
                '-I/usr/include/libpng12',
                '-I/usr/include/pixman-1',
                '-I/usr/include/nss',
                '-I/usr/include/nspr',
                '-O0',
                '-g'
            ],
            CPPDEFINES = [
                '__STDC_FORMAT_MACROS',
                'CHROMIUM_BUILD',
                'UNIT_TEST',
                'GTEST_HAS_RTTI=0',
                '_DEBUG'
            ],
            CPPPATH = [
                env.Dir('$SRC_DIR/base/../third_party/icu/public/common'),
                env.Dir('$SRC_DIR/base/..'),
                env.Dir('$SRC_DIR/base/../testing/gmock/include'),
                env.Dir('$SRC_DIR/base/../testing/gtest/include')
            ],
            CXXFLAGS = [
                '-fno-rtti',
                '-fno-threadsafe-statics',
                '-fvisibility-inlines-hidden'
            ],
            LINKFLAGS = [
                '-pthread',
                '-rdynamic'
            ],
            LIBS = [
                '-lrt',
                '-lgtk-x11-2.0',
                '-lgdk-x11-2.0',
                '-latk-1.0',
                '-lgdk_pixbuf-2.0',
                '-lm',
                '-lpangocairo-1.0',
                '-lpango-1.0',
                '-lcairo',
                '-lgobject-2.0',
                '-lgmodule-2.0',
                '-ldl',
                '-lgthread-2.0',
                '-lrt',
                '-lglib-2.0',
                '-lnss3',
                '-lnssutil3',
                '-lsmime3',
                '-lssl3',
                '-lplds4',
                '-lplc4',
                '-lnspr4',
                '-lpthread',
                '-ldl',
                '-lrt',
                'base',
                'base_i18n',
                'gmock',
                'gtest',
                'event',
                'icui18n',
                'icuuc',
                'icudata'
            ],
        ),
        'FilterOut' : dict(
        ),
        'Replace' : dict(
             FLOCK_LDMODULE = ['flock', '$TOP_BUILDDIR/linker.lock', '$LDMODULE'],
             FLOCK_LINK = ['flock', '$TOP_BUILDDIR/linker.lock', '$LINK'],
             FLOCK_SHLINK = ['flock', '$TOP_BUILDDIR/linker.lock', '$SHLINK'],
             IMPLICIT_COMMAND_DEPENDENCIES = '0',
             LDMODULECOM = [['$FLOCK_LDMODULE',
  '-o',
  '$TARGET',
  '$_LIBDIRFLAGS',
  '$LDMODULEFLAGS',
  '$SOURCES',
  '-Wl,--start-group',
  '$_LIBFLAGS',
  '-Wl,--end-group']],
             LIBPATH = ['$LIB_DIR'],
             LINKCOM = [['$FLOCK_LINK',
  '-o',
  '$TARGET',
  '$_LIBDIRFLAGS',
  '$LINKFLAGS',
  '$SOURCES',
  '-Wl,--start-group',
  '$_LIBFLAGS',
  '-Wl,--end-group']],
             SHLINKCOM = [['$FLOCK_SHLINK',
  '-o',
  '$TARGET',
  '$_LIBDIRFLAGS',
  '$SHLINKFLAGS',
  '$SOURCES',
  '-Wl,--start-group',
  '$_LIBFLAGS',
  '-Wl,--end-group']],
        ),
        'ImportExternal' : [
             'AS',
             'CC',
             'CXX',
             'LINK',
        ],
        'PropagateExternal' : [
             'AS',
             'CC',
             'CCACHE_DIR',
             'CXX',
             'DISTCC_DIR',
             'DISTCC_HOSTS',
             'HOME',
             'INCLUDE_SERVER_ARGS',
             'INCLUDE_SERVER_PORT',
             'LINK',
             'CHROME_BUILD_TYPE',
             'CHROMIUM_BUILD',
             'OFFICIAL_BUILD',
        ],
    },
    'Release' : {
        'Append' : dict(
            CCFLAGS = [
                '-Werror',
                '-pthread',
                '-fno-exceptions',
                '-fno-asynchronous-unwind-tables',
                '-fvisibility=hidden',
                '-Wall',
                '-D_FILE_OFFSET_BITS=64',
                '-DPNG_NO_MMX_CODE',
                '-pthread',
                '-I/usr/include/gtk-2.0',
                '-I/usr/lib/gtk-2.0/include',
                '-I/usr/include/atk-1.0',
                '-I/usr/include/cairo',
                '-I/usr/include/pango-1.0',
                '-I/usr/include/glib-2.0',
                '-I/usr/lib/glib-2.0/include',
                '-I/usr/include/freetype2',
                '-I/usr/include/libpng12',
                '-I/usr/include/pixman-1',
                '-I/usr/include/nss',
                '-I/usr/include/nspr',
                '-O2',
                '-fno-ident',
                '-fdata-sections',
                '-ffunction-sections'
            ],
            CPPDEFINES = [
                '__STDC_FORMAT_MACROS',
                'CHROMIUM_BUILD',
                'UNIT_TEST',
                'GTEST_HAS_RTTI=0',
                'NDEBUG',
                'NVALGRIND'
            ],
            CPPPATH = [
                env.Dir('$SRC_DIR/base/../third_party/icu/public/common'),
                env.Dir('$SRC_DIR/base/..'),
                env.Dir('$SRC_DIR/base/../testing/gmock/include'),
                env.Dir('$SRC_DIR/base/../testing/gtest/include')
            ],
            CXXFLAGS = [
                '-fno-rtti',
                '-fno-threadsafe-statics',
                '-fvisibility-inlines-hidden'
            ],
            LINKFLAGS = [
                '-pthread',
                '-Wl,--gc-sections'
            ],
            LIBS = [
                '-lrt',
                '-lgtk-x11-2.0',
                '-lgdk-x11-2.0',
                '-latk-1.0',
                '-lgdk_pixbuf-2.0',
                '-lm',
                '-lpangocairo-1.0',
                '-lpango-1.0',
                '-lcairo',
                '-lgobject-2.0',
                '-lgmodule-2.0',
                '-ldl',
                '-lgthread-2.0',
                '-lrt',
                '-lglib-2.0',
                '-lnss3',
                '-lnssutil3',
                '-lsmime3',
                '-lssl3',
                '-lplds4',
                '-lplc4',
                '-lnspr4',
                '-lpthread',
                '-ldl',
                '-lrt',
                'base',
                'base_i18n',
                'gmock',
                'gtest',
                'event',
                'icui18n',
                'icuuc',
                'icudata'
            ],
        ),
        'FilterOut' : dict(
        ),
        'Replace' : dict(
             FLOCK_LDMODULE = ['flock', '$TOP_BUILDDIR/linker.lock', '$LDMODULE'],
             FLOCK_LINK = ['flock', '$TOP_BUILDDIR/linker.lock', '$LINK'],
             FLOCK_SHLINK = ['flock', '$TOP_BUILDDIR/linker.lock', '$SHLINK'],
             IMPLICIT_COMMAND_DEPENDENCIES = '0',
             LDMODULECOM = [['$FLOCK_LDMODULE',
  '-o',
  '$TARGET',
  '$_LIBDIRFLAGS',
  '$LDMODULEFLAGS',
  '$SOURCES',
  '-Wl,--start-group',
  '$_LIBFLAGS',
  '-Wl,--end-group']],
             LIBPATH = ['$LIB_DIR'],
             LINKCOM = [['$FLOCK_LINK',
  '-o',
  '$TARGET',
  '$_LIBDIRFLAGS',
  '$LINKFLAGS',
  '$SOURCES',
  '-Wl,--start-group',
  '$_LIBFLAGS',
  '-Wl,--end-group']],
             SHLINKCOM = [['$FLOCK_SHLINK',
  '-o',
  '$TARGET',
  '$_LIBDIRFLAGS',
  '$SHLINKFLAGS',
  '$SOURCES',
  '-Wl,--start-group',
  '$_LIBFLAGS',
  '-Wl,--end-group']],
        ),
        'ImportExternal' : [
             'AS',
             'CC',
             'CXX',
             'LINK',
        ],
        'PropagateExternal' : [
             'AS',
             'CC',
             'CCACHE_DIR',
             'CXX',
             'DISTCC_DIR',
             'DISTCC_HOSTS',
             'HOME',
             'INCLUDE_SERVER_ARGS',
             'INCLUDE_SERVER_PORT',
             'LINK',
             'CHROME_BUILD_TYPE',
             'CHROMIUM_BUILD',
             'OFFICIAL_BUILD',
        ],
    },
}

config = configurations[env['CONFIG_NAME']]
env.Append(**config['Append'])
env.FilterOut(**config['FilterOut'])
env.Replace(**config['Replace'])

# Scons forces -fPIC for SHCCFLAGS on some platforms.
# Disable that so we can control it from cflags in gyp.
# Note that Scons itself is inconsistent with its -fPIC
# setting. SHCCFLAGS forces -fPIC, and SHCFLAGS does not.
# This will make SHCCFLAGS consistent with SHCFLAGS.
env['SHCCFLAGS'] = ['$CCFLAGS']

for _var in config['ImportExternal']:
  if _var in ARGUMENTS:
    env[_var] = ARGUMENTS[_var]
  elif _var in os.environ:
    env[_var] = os.environ[_var]
for _var in config['PropagateExternal']:
  if _var in ARGUMENTS:
    env[_var] = ARGUMENTS[_var]
  elif _var in os.environ:
    env['ENV'][_var] = os.environ[_var]

env['ENV']['LD_LIBRARY_PATH'] = env.subst('$LIB_DIR')

if ARGUMENTS.get('COVERAGE') not in (None, '0'):
  env.AppendUnique(
            CCFLAGS = [
                '-fprofile-arcs',
                '-ftest-coverage'
            ],
            LINKFLAGS = [
                '-fprofile-arcs'
            ],
  )

if ARGUMENTS.get('PROFILE') not in (None, '0'):
  env.AppendUnique(
            CCFLAGS = [
                '-pg',
                '-g'
            ],
            LINKFLAGS = [
                '-pg'
            ],
  )

if ARGUMENTS.get('SYMBOLS') not in (None, '0'):
  env.AppendUnique(
            CCFLAGS = [
                '-g'
            ],
  )

input_files = [
    'multiprocess_test.h',
    'test/run_all_unittests.cc',
    'test/test_suite.h',
    'at_exit_unittest.cc',
    'atomic_flag_unittest.cc',
    'atomicops_unittest.cc',
    'bits_unittest.cc',
    'command_line_unittest.cc',
    'condition_variable_unittest.cc',
    'crypto/rsa_private_key_unittest.cc',
    'crypto/signature_creator_unittest.cc',
    'crypto/signature_verifier_unittest.cc',
    'data_pack_unittest.cc',
    'debug_util_unittest.cc',
    'directory_watcher_unittest.cc',
    'field_trial_unittest.cc',
    'file_descriptor_shuffle_unittest.cc',
    'file_path_unittest.cc',
    'file_util_unittest.cc',
    'gfx/rect_unittest.cc',
    'gmock_unittest.cc',
    'histogram_unittest.cc',
    'hmac_unittest.cc',
    'id_map_unittest.cc',
    'i18n/file_util_icu_unittest.cc',
    'i18n/icu_string_conversions_unittest.cc',
    'i18n/word_iterator_unittest.cc',
    'json/json_reader_unittest.cc',
    'json/json_writer_unittest.cc',
    'json/string_escape_unittest.cc',
    'lazy_instance_unittest.cc',
    'leak_tracker_unittest.cc',
    'linked_list_unittest.cc',
    'linked_ptr_unittest.cc',
    'message_loop_unittest.cc',
    'message_pump_glib_unittest.cc',
    'observer_list_unittest.cc',
    'path_service_unittest.cc',
    'pickle_unittest.cc',
    'pr_time_unittest.cc',
    'process_util_unittest.cc',
    'rand_util_unittest.cc',
    'ref_counted_unittest.cc',
    'scoped_ptr_unittest.cc',
    'scoped_temp_dir_unittest.cc',
    'sha1_unittest.cc',
    'sha2_unittest.cc',
    'shared_memory_unittest.cc',
    'simple_thread_unittest.cc',
    'singleton_unittest.cc',
    'stack_container_unittest.cc',
    'stats_table_unittest.cc',
    'string_piece_unittest.cc',
    'string_tokenizer_unittest.cc',
    'string_util_unittest.cc',
    'sys_info_unittest.cc',
    'sys_string_conversions_unittest.cc',
    'task_unittest.cc',
    'thread_collision_warner_unittest.cc',
    'thread_local_storage_unittest.cc',
    'thread_local_unittest.cc',
    'thread_unittest.cc',
    'time_unittest.cc',
    'timer_unittest.cc',
    'tracked_objects_unittest.cc',
    'tuple_unittest.cc',
    'utf_offset_string_conversions_unittest.cc',
    'utf_string_conversions_unittest.cc',
    'values_unittest.cc',
    'version_unittest.cc',
    'waitable_event_unittest.cc',
    'waitable_event_watcher_unittest.cc',
    'watchdog_unittest.cc',
    'weak_ptr_unittest.cc',
    'worker_pool_unittest.cc',
]

target_files = []
prerequisites = []

_program = env.File('${PROGPREFIX}base_unittests${PROGSUFFIX}')
_result = []
for infile in input_files:
  if env.compilable(infile):
    if (type(infile) == type('')
        and (infile.startswith('$SRC_DIR/base/')
             or not os.path.isabs(env.subst(infile)))):
      # Force files below the build directory by replacing all '..'
      # elements in the path with '__':
      base, ext = os.path.splitext(os.path.normpath(infile))
      base = [d == '..' and '__' or d for d in base.split('/')]
      base = os.path.join(*base)
      object = '${OBJ_DIR}/${COMPONENT_NAME}/${TARGET_NAME}/' + base
      if not infile.startswith('$SRC_DIR/base/'):
        infile = '$SRC_DIR/base/' + infile
      infile = env.StaticObject(object, infile)[0]
    else:
      infile = env.StaticObject(infile)[0]
  _result.append(infile)
input_files = _result

_outputs = env.GypProgram(_program, input_files)
target_files.extend(_outputs)

if GetOption('verbose'):
  _action = Action([['cd',
 '"/usr/local/google/chromium/src/base"',
 '&&',
 '$TARGET_NAME',
 '--gtest_print_time']])
else:
  _action = Action([['cd',
 '"/usr/local/google/chromium/src/base"',
 '&&',
 '$TARGET_NAME',
 '--gtest_print_time']], )

gyp_target = env.Alias('base_unittests', target_files)
dependencies = [
    Alias('base'),
    Alias('base_i18n'),
    Alias('gmock'),
    Alias('gtest'),
    Alias('gtk'),
    Alias('nss'),
    Alias('xdisplaycheck'),
    Alias('libevent'),
    Alias('icui18n'),
    Alias('icuuc'),
    Alias('icudata')
]
env.Requires(target_files, dependencies)
env.Requires(gyp_target, dependencies)
for prerequisite in prerequisites:
  env.Requires(prerequisite, dependencies)
env.Requires(gyp_target, prerequisites)

_run_as_target = env.Alias('run_base_unittests', target_files, _action)
env.Requires(_run_as_target, [
    Alias('base_unittests'),
])
env.AlwaysBuild(_run_as_target)
Return("gyp_target")