Merge pull request #1 from cubicdaiya/gtest-update

test: changed the way to embed googletest.
This commit is contained in:
Tatsuhiko Kubo 2016-08-28 20:44:00 +09:00 committed by GitHub
commit 424ab0dbb7
2 changed files with 21 additions and 31 deletions

View File

@ -3,14 +3,16 @@ compiler:
- gcc - gcc
- clang - clang
before_script: before_script:
- wget http://googletest.googlecode.com/files/gtest-1.7.0.zip - sudo apt-get install -y cmake
- unzip -q gtest-1.7.0.zip - wget https://github.com/google/googletest/archive/release-1.8.0.zip
- cd gtest-1.7.0 - unzip -q release-1.8.0.zip
- ./configure - cd googletest-release-1.8.0
- cmake .
- make - make
- sudo make install
- cd .. - cd ..
script: script:
- cd examples - cd examples
- scons - scons
- cd ../test - cd ../test
- GTEST_ROOT=$PWD/../gtest-1.7.0 scons check - scons check

View File

@ -8,26 +8,10 @@ def path_chomp(path):
return path[:-1] return path[:-1]
return path return path
if not 'GTEST_ROOT' in os.environ: env = Environment(
print "set environment variable 'GTEST_ROOT'" CPPFLAGS=['-Wall', '-O2'],
Exit(1) CPPPATH=['..'],
)
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],
)
conf = Configure(env); conf = Configure(env);
@ -35,6 +19,7 @@ if not conf.CheckCXX():
print "c++ compiler is not installed!" print "c++ compiler is not installed!"
Exit(1) Exit(1)
libs = ['stdc++', 'pthread', 'gtest']
for lib in libs: for lib in libs:
if not conf.CheckLib(lib): if not conf.CheckLib(lib):
print "library " + lib + " not installed!" print "library " + lib + " not installed!"
@ -42,12 +27,15 @@ for lib in libs:
conf.Finish() conf.Finish()
test = env.Program(target, test = env.Program(
[Glob('*.cpp'), gtest_libs + '/libgtest.a'] 'dtl_test',
) [Glob('*.cpp')],
)
test_alias = env.Alias('check', test_alias = env.Alias(
test, 'check',
test[0].abspath) test,
test[0].abspath
)
env.AlwaysBuild(test_alias) env.AlwaysBuild(test_alias)