[SCons] Made installation of gtest optional

The default is to not install it, since most users do not need it.
This commit is contained in:
Ray Speth 2013-02-15 17:32:31 +00:00
parent 1bd83d80f4
commit 1856a060c9
2 changed files with 18 additions and 24 deletions

View file

@ -554,6 +554,11 @@ config_options = [
static libaries and avoids a bug with using valgrind with
the -static linking flag.""",
True),
BoolVariable(
'install_gtest',
"""Determines whether to install the Google Test library and headers
alongside Cantera's libraries. Not recommended.""",
False),
BoolVariable(
'single_library',
"""If set, include code from the 'ext' folder in the cantera library

View file

@ -151,32 +151,21 @@ for subdir, extensions, prepFunction in libs:
# Build the shared library
liby = build(localenv.SharedLibrary(pjoin('..', 'lib', sharedLibName), objects))
install('$inst_libdir', liby)
# ---------------------------------------------------
# GTEST
# ---------------------------------------------------
# OK, handle the construction of the gtest library. Gtest applications require the construction of
# a library object that will get linked in at link time and a set of include files that will available
# at compile time.
#
# Create a local environment for creating the libgtest.a static library
# -> we need to the gtest include files
# -> I don't know about pthreads within gtest.
# Google Test: Used internally for Cantera unit tests. Optionally, the headers
# and compiled library can be installed alongside Cantera using the scons
# option 'install_gtest=y'.
localenv = env.Clone()
localenv.Prepend(CPPPATH=[Dir('#ext/gtest'),
Dir('#ext/gtest/include')],
CPPDEFINES={'GTEST_HAS_PTHREAD': 0})
#
# Create a build object for libgtest.a and a source file, gtest-all.cc that includes all of the gtest sources
#
llib = build(localenv.Library(pjoin('../lib', 'gtest'),
source=['gtest/src/gtest-all.cc']))
#
# Add libgtest.a to the install directions
#
install('$inst_libdir', llib)
#
# Add all of the gtest include files to the install directions
#
install(localenv.RecursiveInstall, '$inst_incroot', '#/ext/gtest/include')
# ---------------------------------------------------
gtest = build(localenv.Library(pjoin('../lib', 'gtest'),
source=['gtest/src/gtest-all.cc']))
if localenv['install_gtest']:
# install the static library
install('$inst_libdir', gtest)
# install the header files
install(localenv.RecursiveInstall, '$inst_incroot', '#/ext/gtest/include')