diff options
author | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2009-04-02 00:31:38 (GMT) |
---|---|---|
committer | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2009-04-02 00:31:38 (GMT) |
commit | 5f7c33d39cf2bc73559e1f33e5907dab41faa3a2 (patch) | |
tree | e0b677c50ef2bfd27a20f4e5c2e3b58eda5cb3aa /scons/SConscript | |
parent | 6a26383e31cf79dd0acf89bf3a53c7a805decf1d (diff) | |
download | googletest-5f7c33d39cf2bc73559e1f33e5907dab41faa3a2.zip googletest-5f7c33d39cf2bc73559e1f33e5907dab41faa3a2.tar.gz googletest-5f7c33d39cf2bc73559e1f33e5907dab41faa3a2.tar.bz2 |
Fixes the scons script to build gtest-death-test_test on Linux.
Diffstat (limited to 'scons/SConscript')
-rw-r--r-- | scons/SConscript | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/scons/SConscript b/scons/SConscript index 88357ca..91bf985 100644 --- a/scons/SConscript +++ b/scons/SConscript @@ -99,8 +99,8 @@ env = env.Clone() # 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']) +env.Prepend(CPPPATH = ['#/..', + '#/../include']) # Sources used by base library and library that includes main. gtest_source = '../src/gtest-all.cc' @@ -117,8 +117,7 @@ gtest_main = env.StaticLibrary(target='gtest_main', source=[gtest_source, gtest_main_source]) env_with_exceptions = env.Clone() -platform = env_with_exceptions['PLATFORM'] -if platform == 'win32': +if env_with_exceptions['PLATFORM'] == 'win32': env_with_exceptions.Append(CCFLAGS = ['/EHsc']) env_with_exceptions.Append(CPPDEFINES = '_HAS_EXCEPTIONS=1') # Undoes the _TYPEINFO_ hack, which is unnecessary and only creates @@ -205,7 +204,14 @@ GtestUnitTest(env, 'gtest_output_test_', gtest) GtestUnitTest(env, 'gtest_color_test_', gtest) GtestUnitTest(env, 'gtest-linked_ptr_test', gtest_main) GtestUnitTest(env, 'gtest-port_test', gtest_main) -GtestUnitTest(env, 'gtest-death-test_test', gtest_main) + +env_with_pthread = env.Clone() +if env_with_pthread['PLATFORM'] not in ['win32', 'darwin']: + # Assuming POSIX-like environment with GCC. + env_with_pthread.Append(CCFLAGS = ['-pthread']) + env_with_pthread.Append(LINKFLAGS = ['-pthread']) + +GtestUnitTest(env_with_pthread, 'gtest-death-test_test', gtest_main) gtest_unittest_ex_obj = env_with_exceptions.Object( target='gtest_unittest_ex', @@ -226,16 +232,17 @@ GtestBinary(env_with_exceptions, # - gtest_xml_outfile2_test_ # - gtest_xml_output_unittest_ -# We need to disable some optimization flags for a couple of tests, -# otherwise the redirection of stdout does not work (apparently -# because of a compiler bug). -special_env = env.Clone() -linker_flags = special_env['LINKFLAGS'] -for flag in ["/O1", "/Os", "/Og", "/Oy"]: - if flag in linker_flags: - linker_flags.remove(flag) -GtestUnitTest(special_env, 'gtest_env_var_test_', gtest) -GtestUnitTest(special_env, 'gtest_uninitialized_test_', gtest) +# We need to disable some optimization flags for some tests on +# Windows; otherwise the redirection of stdout does not work +# (apparently because of a compiler bug). +env_with_less_optimization = env.Clone() +if env_with_less_optimization['PLATFORM'] == 'win32': + linker_flags = env_with_less_optimization['LINKFLAGS'] + for flag in ["/O1", "/Os", "/Og", "/Oy"]: + if flag in linker_flags: + linker_flags.remove(flag) +GtestUnitTest(env_with_less_optimization, 'gtest_env_var_test_', gtest) +GtestUnitTest(env_with_less_optimization, 'gtest_uninitialized_test_', gtest) def GtestSample(env, target, gtest_lib, additional_sources=None): """Helper to create gtest samples. |