diff --git a/SConstruct b/SConstruct index c1290dfff..0231208ff 100644 --- a/SConstruct +++ b/SConstruct @@ -540,14 +540,14 @@ config_options = [ installation ('y'), from a Git submodule ('n'), or to decide automatically ('default'). Deprecated option, please use 'googletest' instead. This option is supressed by 'googltest' option.""", - 'default', ('default', 'y', 'n')), + 'unspecified', ('unspecified','default', 'y', 'n')), EnumVariable( 'googletest', """Select whether to use gtest/gmock from system installation ('system'), from a Git submodule ('submodule'), to decide automatically ('default') or don't look for gtest/gmock ('none') - and don't run tests that depend on gtest/gmock. - If this option is set then it suppress the deprecated 'system_googletest' option.""", + and don't run tests that depend on gtest/gmock. If this option is + set then it suppresses the deprecated 'system_googletest' option.""", 'default', ('default', 'system', 'submodule', 'none')), ( 'env_vars', @@ -916,19 +916,29 @@ except ValueError: env['FMT_VERSION'] = '0.0.0' print('INFO: Could not find version of fmt') +# Convert setting of the deprecated system_googletest option +if env['system_googletest'] != 'unspecified': + print("WARNING: The 'system_googletest' option is deprecated. " + "Use the 'googletest' option instead.") +if env['system_googletest'] == 'default': + env['googletest'] = 'default' +elif env['system_googletest'] == 'y': + env['googletest'] = 'system' +elif env['system_googletest'] == 'n': + env['googletest'] = 'submodule' + # Check for googletest and checkout submodule if needed if env['googletest'] in ('system', 'default'): has_gtest = conf.CheckCXXHeader('gtest/gtest.h', '""') has_gmock = conf.CheckCXXHeader('gmock/gmock.h', '""') if has_gtest and has_gmock: - env['system_googletest'] = True env['googletest'] = 'system' - elif env['system_googletest'] == 'y' or env['googletest'] == 'system': + print("""INFO: Using system installation of Googletest""") + elif env['googletest'] == 'system': config_error('Expected system installation of Googletest-1.8.0, but it ' 'could not be found.') if env['googletest'] in ('submodule', 'default'): - env['system_googletest'] = False env['googletest'] = 'submodule' has_gtest = os.path.exists('ext/googletest/googletest/include/gtest/gtest.h') has_gmock = os.path.exists('ext/googletest/googlemock/include/gmock/gmock.h') @@ -945,9 +955,10 @@ if env['googletest'] in ('submodule', 'default'): config_error('Googletest not found and submodule checkout failed.\n' 'Try manually checking out the submodule with:\n\n' ' git submodule update --init --recursive ext/googletest\n') + print("""INFO: Using Googletest from Git submodule""") -#do nothing "if env['googletest'] in ('none'):" -# i.e. don't run tests that use 'googletest' module +if env['googletest'] == 'none': + print("""INFO: Not using Googletest -- unable to run complete test suite""") # Check for Eigen and checkout submodule if needed if env['system_eigen'] in ('y', 'default'): diff --git a/ext/SConscript b/ext/SConscript index 11554be70..75dbe9d3e 100644 --- a/ext/SConscript +++ b/ext/SConscript @@ -88,7 +88,7 @@ if not env['system_eigen']: Copy('$TARGET', '$SOURCE'))) # Google Test: Used internally for Cantera unit tests. -if not env['system_googletest']: +if env['googletest'] == 'submodule': localenv = prep_gtest(env) gtest = build(localenv.Library('../lib/gtest', source=['googletest/googletest/src/gtest-all.cc'])) diff --git a/test/SConscript b/test/SConscript index fff745e0e..036a89f09 100644 --- a/test/SConscript +++ b/test/SConscript @@ -15,15 +15,14 @@ else: localenv.Prepend(CPPPATH=['#include'], LIBPATH='#build/lib') -if env['googletest'] in ('system', 'submodule'): - if not env['system_googletest']: - localenv.Prepend(CPPPATH=['#ext/googletest/googletest/include', +localenv.Append(LIBS=cantera_libs, + CCFLAGS=env['warning_flags']) + +if env['googletest'] == 'submodule': + localenv.Prepend(CPPPATH=['#ext/googletest/googletest/include', '#ext/googletest/googlemock/include']) - localenv.Append(LIBS=['gtest', 'gmock'] + cantera_libs, - CCFLAGS=env['warning_flags']) -else: - localenv.Append(LIBS=cantera_libs, - CCFLAGS=env['warning_flags']) +if env['googletest'] != 'none': + localenv.Append(LIBS=['gtest', 'gmock']) # Turn of optimization to speed up compilation ccflags = localenv['CCFLAGS']