summaryrefslogtreecommitdiffstats
path: root/native_client_sdk/src/libraries
diff options
context:
space:
mode:
Diffstat (limited to 'native_client_sdk/src/libraries')
-rw-r--r--native_client_sdk/src/libraries/gtest/build.scons112
-rw-r--r--native_client_sdk/src/libraries/gtest/library.dsc77
2 files changed, 77 insertions, 112 deletions
diff --git a/native_client_sdk/src/libraries/gtest/build.scons b/native_client_sdk/src/libraries/gtest/build.scons
deleted file mode 100644
index dd3b788..0000000
--- a/native_client_sdk/src/libraries/gtest/build.scons
+++ /dev/null
@@ -1,112 +0,0 @@
-# -*- python -*-
-# Copyright (c) 2011 The Chromium 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 build_utils
-import glob
-import os
-import shutil
-import subprocess
-import sys
-
-from SCons import Script
-
-# Directories used throughout this script.
-script_dir = os.path.abspath(os.getcwd())
-sdk_root_dir = os.getenv('NACL_SDK_ROOT')
-build_tools_dir = os.path.join(sdk_root_dir, 'build_tools')
-libraries_dir = os.path.join(sdk_root_dir, 'libraries')
-
-# Add the path to build_tools to the shell's python path.
-shell_env = os.environ.copy()
-python_paths = [build_tools_dir]
-python_paths += [shell_env.get('PYTHONPATH', '')]
-shell_env['PYTHONPATH'] = os.pathsep.join(python_paths)
-
-# Argv for the install-gtest python script.
-script_argv = [
- '--toolchain=%s' % (
- build_utils.NormalizeToolchain(base_dir=sdk_root_dir,
- arch='x86',
- variant='glibc')),
- '--toolchain=%s' % (
- build_utils.NormalizeToolchain(base_dir=sdk_root_dir,
- arch='x86',
- variant='newlib')),
- '--working_dir=%s' % script_dir
- ]
-
-# The scons build env.
-build_env = Script.Environment().Clone()
-
-# Where the src for gtest and gmock will be found after running the install
-# script. We keep them around as a sentinel, to indicate they they have been
-# installed. (See BuildGTestLibs below.)
-gtest_src = os.path.join(script_dir, 'gtest-1.5.0')
-gmock_src = os.path.join(script_dir, 'gmock-1.5.0')
-
-
-def BuildGTestLibs(env, target, source):
- '''Build and install the gtest/gmock libraries.
-
- This invokes the gtest_install.py script in the build_tools directory. In turn
- that scripts downloads, untar, patches and build the gtest/gmock libraries.
- Finally, the libraries and related include files are copied to the toolchain.
-
- Args:
- env: The construction Environment() that is building the examples.
- target: The target that triggered this build. Not used.
- source: The sources used for this build. Not used.
- '''
- # If our sentinel, the gtest source is present, do not build.
- if os.path.exists(gtest_src):
- return
- # Remove any old gmock source if still present.
- shutil.rmtree(gmock_src, ignore_errors=True)
- # Invoke the gtest install script.
- script = os.path.join(build_tools_dir, 'install_gtest', 'install_gtest.py')
- py_command = [sys.executable, script]
- subprocess.check_call(py_command + script_argv, env=shell_env)
-
- # Clean up: remove left-over tgz files.
- for f in glob.iglob(os.path.join(script_dir, '*.tgz')):
- os.remove(f)
-
-
-def CleanGTestLibs(env, target, suite_name):
- '''Clean the gtest/gmock libraries sources.
-
- This does a partial clean up of the gtest/gmock projects. It removes the src
- directories. However, the actual libraries and related includes in the
- toolchains are not removed. It is however sufficient to trigger a full
- rebuild of gtest/gmock.
-
- Args:
- env: The construction Environment() that is building the examples.
- target: The target that triggered this build.
- suite_name: A suite name that should cause this target to be cleaned.
- '''
- # Only do this in 'clean' mode.
- if not build_env.GetOption('clean'):
- return
- # Only clean target if it's on the cmd line or it's a clean all.
- clean_this = True
- if len(COMMAND_LINE_TARGETS) > 0:
- clean_this = False
- for cl_target in COMMAND_LINE_TARGETS:
- if cl_target == suite_name or cl_target == target:
- clean_this = True
- break
- # Delete the src trees for gtest and gmock.
- if clean_this:
- shutil.rmtree(gmock_src, ignore_errors=True)
- shutil.rmtree(gtest_src, ignore_errors=True)
-
-
-gtest_libs_builder = build_env.Alias('gtest_libs', [], BuildGTestLibs)
-build_env.AlwaysBuild(gtest_libs_builder)
-CleanGTestLibs(build_env, 'gtest_libs', 'bot')
-
-# ----------------------------------------------------------------------------
-build_env.Default('gtest_libs')
diff --git a/native_client_sdk/src/libraries/gtest/library.dsc b/native_client_sdk/src/libraries/gtest/library.dsc
new file mode 100644
index 0000000..a7405a8
--- /dev/null
+++ b/native_client_sdk/src/libraries/gtest/library.dsc
@@ -0,0 +1,77 @@
+{
+ 'TOOLS': ['newlib', 'glibc', 'pnacl', 'win'],
+ 'SEARCH': [
+ '../../../../testing/gtest/include/gtest',
+ '../../../../testing/gtest/include/gtest/internal',
+ '../../../../testing/gtest/src',
+ ],
+ 'TARGETS': [
+ {
+ 'NAME' : 'gtest',
+ 'TYPE' : 'lib',
+ 'SOURCES' : [
+ 'gtest.cc',
+ 'gtest-death-test.cc',
+ 'gtest-filepath.cc',
+ 'gtest_main.cc',
+ 'gtest-port.cc',
+ 'gtest-printers.cc',
+ 'gtest-test-part.cc',
+ 'gtest-typed-test.cc',
+ ],
+ # Ignore warning:
+ # gtest.cc:2555: error: enumeration value ‘COLOR_DEFAULT’ not handled in switch
+ 'CXXFLAGS': ['-Wno-switch-enum'],
+ 'INCLUDES': [
+ # See comment below about gtest-internal-inl.h
+ '$(NACL_SDK_ROOT)/include/gtest/internal',
+ ],
+ }
+ ],
+ 'HEADERS': [
+ {
+ 'FILES': [
+ 'gtest-death-test.h',
+ 'gtest.h',
+ 'gtest-message.h',
+ 'gtest-param-test.h',
+ 'gtest_pred_impl.h',
+ 'gtest-printers.h',
+ 'gtest_prod.h',
+ 'gtest-spi.h',
+ 'gtest-test-part.h',
+ 'gtest-typed-test.h',
+ ],
+ 'DEST': 'include/gtest',
+ },
+ {
+ 'FILES': [
+ 'gtest-death-test-internal.h',
+ 'gtest-filepath.h',
+ 'gtest-internal.h',
+ 'gtest-linked_ptr.h',
+ 'gtest-param-util-generated.h',
+ 'gtest-param-util.h',
+ 'gtest-port.h',
+ 'gtest-string.h',
+ 'gtest-tuple.h',
+ 'gtest-type-util.h',
+ ],
+ 'DEST': 'include/gtest/internal',
+ },
+ {
+ # This is cheesy, but gtest.cc includes "src/gtest-internal-inl.h". Since
+ # gtest is not installed in the SDK, I don't really care about the
+ # directory layout.
+ # TODO(binji): If we decide to include gtest, put this file in a better
+ # spot.
+ 'FILES': [
+ 'gtest-internal-inl.h',
+ ],
+ 'DEST': 'include/gtest/internal/src',
+ },
+ ],
+ 'DEST': 'testing',
+ 'NAME': 'gtest',
+ 'EXPERIMENTAL': True,
+}