From 04ef73b13a0ee8ee95331c6f2af7cbfaeadb5937 Mon Sep 17 00:00:00 2001 From: Tatsuhiko Kubo Date: Tue, 3 May 2016 22:29:50 +0900 Subject: [PATCH] test: changed the way to embed googletest. Before googletest was not supported `make install`. But not anymore. --- test/SConstruct | 40 ++++++++++++++-------------------------- 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/test/SConstruct b/test/SConstruct index d5ced04..1e86496 100644 --- a/test/SConstruct +++ b/test/SConstruct @@ -8,26 +8,10 @@ def path_chomp(path): return path[:-1] return path -if not 'GTEST_ROOT' in os.environ: - print "set environment variable 'GTEST_ROOT'" - Exit(1) - -gtest_root = path_chomp(os.environ['GTEST_ROOT']) -if gtest_root[-1] == '/': - gtest_root = gtest_root[:-1] - -gtest_includes = gtest_root + '/include' -gtest_libs = gtest_root + '/lib/.libs' - -flags = ['-Wall', '-O2'] -libs = ['stdc++', 'pthread'] -includes = ['..', gtest_includes] -target = 'dtl_test' - -env = Environment(CPPFLAGS=flags, - CPPPATH=includes, - LIBPATH=[gtest_libs], - ) +env = Environment( + CPPFLAGS=['-Wall', '-O2'], + CPPPATH=['..'], +) conf = Configure(env); @@ -35,6 +19,7 @@ if not conf.CheckCXX(): print "c++ compiler is not installed!" Exit(1) +libs = ['stdc++', 'pthread', 'libgtest'] for lib in libs: if not conf.CheckLib(lib): print "library " + lib + " not installed!" @@ -42,12 +27,15 @@ for lib in libs: conf.Finish() -test = env.Program(target, - [Glob('*.cpp'), gtest_libs + '/libgtest.a'] - ) +test = env.Program( + 'dtl_test', + [Glob('*.cpp')], +) -test_alias = env.Alias('check', - test, - test[0].abspath) +test_alias = env.Alias( + 'check', + test, + test[0].abspath +) env.AlwaysBuild(test_alias)