summaryrefslogtreecommitdiffstats
path: root/scons
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2009-11-13 02:54:23 (GMT)
committerzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2009-11-13 02:54:23 (GMT)
commitbcf926ec656688d7eb03159faaddbf56bd4ec8e2 (patch)
treecec29bb0b412c73dd0d5c192e9f2357e70493f02 /scons
parent7e13e0f5dd2f9458e0a613e0a91c894eb80126fc (diff)
downloadgoogletest-bcf926ec656688d7eb03159faaddbf56bd4ec8e2.zip
googletest-bcf926ec656688d7eb03159faaddbf56bd4ec8e2.tar.gz
googletest-bcf926ec656688d7eb03159faaddbf56bd4ec8e2.tar.bz2
Improves the scons scripts and run_tests.py (by Vlad Losev); uses typed tests in gtest-port_test.cc only when typed tests are available (by Zhanyong Wan); makes gtest-param-util-generated.h conform to the C++ standard (by Zhanyong Wan).
Diffstat (limited to 'scons')
-rw-r--r--scons/SConscript57
-rw-r--r--scons/SConstruct.common6
2 files changed, 30 insertions, 33 deletions
diff --git a/scons/SConscript b/scons/SConscript
index e1ccb7e..25220ee 100644
--- a/scons/SConscript
+++ b/scons/SConscript
@@ -99,34 +99,34 @@ Import('env')
env = env.Clone()
BUILD_TESTS = env.get('GTEST_BUILD_TESTS', False)
-if BUILD_TESTS:
- common_exports = SConscript('SConscript.common')
- EnvCreator = common_exports['EnvCreator']
+common_exports = SConscript('SConscript.common')
+EnvCreator = common_exports['EnvCreator']
# Note: The relative paths in SConscript files are relative to the location
# of the SConscript file itself. To make a path relative to the location of
# the main SConstruct file, prepend the path with the # sign.
#
-# But if a project uses variant builds without source duplication, the above
-# rule gets muddied a bit. In that case the paths must be counted from the
-# location of the copy of the SConscript file in scons/build/<config>/scons.
+# But if a project uses variant builds without source duplication (see
+# http://www.scons.org/wiki/VariantDir%28%29 for more information), the
+# above rule gets muddied a bit. In that case the paths must be counted from
+# the location of the copy of the SConscript file in
+# scons/build/<config>/gtest/scons.
#
# Include paths to gtest headers are relative to either the gtest
# directory or the 'include' subdirectory of it, and this SConscript
# file is one directory deeper than the gtest directory.
env.Prepend(CPPPATH = ['..', '../include'])
-if BUILD_TESTS:
- env_use_own_tuple = EnvCreator.Create(env, EnvCreator.UseOwnTuple)
- env_less_optimized = EnvCreator.Create(env, EnvCreator.LessOptimized)
- env_with_threads = EnvCreator.Create(env, EnvCreator.WithThreads)
- # The following environments are used to compile gtest_unittest.cc, which
- # triggers a warning in all but the most recent GCC versions when compiling
- # the EXPECT_EQ(NULL, ptr) statement.
- env_warning_ok = EnvCreator.Create(env, EnvCreator.WarningOk)
- env_with_exceptions = EnvCreator.Create(env_warning_ok,
- EnvCreator.WithExceptions)
- env_without_rtti = EnvCreator.Create(env_warning_ok, EnvCreator.NoRtti)
+env_use_own_tuple = EnvCreator.Create(env, EnvCreator.UseOwnTuple)
+env_less_optimized = EnvCreator.Create(env, EnvCreator.LessOptimized)
+env_with_threads = EnvCreator.Create(env, EnvCreator.WithThreads)
+# The following environments are used to compile gtest_unittest.cc, which
+# triggers a warning in all but the most recent GCC versions when compiling
+# the EXPECT_EQ(NULL, ptr) statement.
+env_warning_ok = EnvCreator.Create(env, EnvCreator.WarningOk)
+env_with_exceptions = EnvCreator.Create(env_warning_ok,
+ EnvCreator.WithExceptions)
+env_without_rtti = EnvCreator.Create(env_warning_ok, EnvCreator.NoRtti)
############################################################
# Helpers for creating build targets.
@@ -229,10 +229,9 @@ def GtestSample(build_env, target, additional_sources=None):
# gtest_main.lib can be used if you just want a basic main function; it is also
# used by some tests for Google Test itself.
gtest, gtest_main = GtestStaticLibraries(env)
-if BUILD_TESTS:
- gtest_ex, gtest_main_ex = GtestStaticLibraries(env_with_exceptions)
- gtest_no_rtti, gtest_main_no_rtti = GtestStaticLibraries(env_without_rtti)
- gtest_use_own_tuple, gtest_use_own_tuple_main = GtestStaticLibraries(
+gtest_ex, gtest_main_ex = GtestStaticLibraries(env_with_exceptions)
+gtest_no_rtti, gtest_main_no_rtti = GtestStaticLibraries(env_without_rtti)
+gtest_use_own_tuple, gtest_main_use_own_tuple = GtestStaticLibraries(
env_use_own_tuple)
# Install the libraries if needed.
@@ -282,10 +281,10 @@ if BUILD_TESTS:
GtestTest(env_with_threads, 'gtest_stress_test', gtest)
GtestTest(env_less_optimized, 'gtest_env_var_test_', gtest)
GtestTest(env_less_optimized, 'gtest_uninitialized_test_', gtest)
- GtestTest(env_use_own_tuple, 'gtest-tuple_test', gtest_use_own_tuple_main)
+ GtestTest(env_use_own_tuple, 'gtest-tuple_test', gtest_main_use_own_tuple)
GtestBinary(env_use_own_tuple,
'gtest_use_own_tuple_test',
- gtest_use_own_tuple_main,
+ gtest_main_use_own_tuple,
['../test/gtest-param-test_test.cc',
'../test/gtest-param-test2_test.cc'])
GtestBinary(env_with_exceptions, 'gtest_ex_unittest', gtest_main_ex,
@@ -320,16 +319,16 @@ if env.get('GTEST_BUILD_SAMPLES', False):
gtest_exports = {'gtest': gtest,
'gtest_main': gtest_main,
+ 'gtest_ex': gtest_ex,
+ 'gtest_main_ex': gtest_main_ex,
+ 'gtest_no_rtti': gtest_no_rtti,
+ 'gtest_main_no_rtti': gtest_main_no_rtti,
+ 'gtest_use_own_tuple': gtest_use_own_tuple,
+ 'gtest_main_use_own_tuple': gtest_main_use_own_tuple,
# These exports are used by Google Mock.
'GtestObject': GtestObject,
'GtestBinary': GtestBinary,
'GtestTest': GtestTest}
-if BUILD_TESTS:
- # These environments are needed for tests only.
- gtest_exports.update({'gtest_ex': gtest_ex,
- 'gtest_no_rtti': gtest_no_rtti,
- 'gtest_use_own_tuple': gtest_use_own_tuple})
-
# Makes the gtest_exports dictionary available to the invoking SConstruct.
Return('gtest_exports')
diff --git a/scons/SConstruct.common b/scons/SConstruct.common
index d9915b9..ed896d0 100644
--- a/scons/SConstruct.common
+++ b/scons/SConstruct.common
@@ -243,10 +243,8 @@ class SConstructHelper:
# Invokes SConscript with variant_dir being build/<config name>.
# Counter-intuitively, src_dir is relative to the build dir and has
# to be '..' to point to the scons directory.
- SConscript('SConscript',
- src_dir='..',
- variant_dir=env['BUILD_DIR'],
- duplicate=0)
+ VariantDir(env['BUILD_DIR'], src_dir='../..', duplicate=0);
+ SConscript(env['BUILD_DIR'] + '/gtest/scons/SConscript')
sconstruct_helper = SConstructHelper()