From d7819af947c45a7c2ec2cfb23e546f0324cdb6bf Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Thu, 17 Nov 2016 17:55:42 -0500 Subject: [PATCH] [SCons] Make versioning of cantera_shared optional Also, disable by default on MinGW to work around a SCons bug --- SConstruct | 16 ++++++++++++++++ src/SConscript | 3 +-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/SConstruct b/SConstruct index 8367f268f7..3af7e91647 100644 --- a/SConstruct +++ b/SConstruct @@ -290,6 +290,14 @@ if env['OS'] in ('Windows', 'Darwin'): else: defaults.threadFlags = '-pthread' +# InstallVersionedLib only fully functional in SCons >= 2.4.0 +# SHLIBVERSION fails with MinGW: http://scons.tigris.org/issues/show_bug.cgi?id=3035 +if (env['toolchain'] == 'mingw' + or StrictVersion(SCons.__version__) < StrictVersion('2.4.0')): + defaults.versionedSharedLibrary = False +else: + defaults.versionedSharedLibrary = True + defaults.fsLayout = 'compact' if env['OS'] == 'Windows' else 'standard' defaults.env_vars = 'LD_LIBRARY_PATH,PYTHONPATH' @@ -557,6 +565,14 @@ config_options = [ static libraries and avoids a bug with using valgrind with the -static linking flag.""", True), + BoolVariable( + 'versioned_shared_library', + """If enabled, create a versioned shared library, with symlinks to the + more generic library name, e.g. libcantera_shared.so.2.3.0 as the + actual library and libcantera_shared.so and libcantera_shared.so.2 + as symlinks. + """, + defaults.versionedSharedLibrary), EnumVariable( 'layout', """The layout of the directory structure. 'standard' installs files to diff --git a/src/SConscript b/src/SConscript index 3d82e6b3fd..4b33f55d8c 100644 --- a/src/SConscript +++ b/src/SConscript @@ -81,8 +81,7 @@ if localenv['layout'] != 'debian': else: sharedName = '../lib/cantera' - if StrictVersion(SCons.__version__) >= StrictVersion('2.4.0'): - # InstallVersionedLib only fully functional in SCons >= 2.4.0 + if localenv['versioned_shared_library']: lib = build(localenv.SharedLibrary(sharedName, libraryTargets, SPAWN=getSpawn(localenv), SHLIBVERSION=localenv['cantera_pure_version']))