summaryrefslogtreecommitdiffstats
path: root/test/Libs
diff options
context:
space:
mode:
authorDirk Baechle <dl9obn@darc.de>2012-12-18 20:27:01 (GMT)
committerDirk Baechle <dl9obn@darc.de>2012-12-18 20:27:01 (GMT)
commit66e6ceeca3bfa6af0a367bf57dccb8a591e2a82f (patch)
tree572754fc81a9a5239eee054407aa455ca8de5af4 /test/Libs
parent02cae725ed116ae6cd996fe3bf5888f7f8f61b97 (diff)
downloadSCons-66e6ceeca3bfa6af0a367bf57dccb8a591e2a82f.zip
SCons-66e6ceeca3bfa6af0a367bf57dccb8a591e2a82f.tar.gz
SCons-66e6ceeca3bfa6af0a367bf57dccb8a591e2a82f.tar.bz2
- fixes for MinGW under Windows, mainly skipping MSVS-specific tests
Diffstat (limited to 'test/Libs')
-rw-r--r--test/Libs/LIBPREFIXES.py3
-rw-r--r--test/Libs/LIBS.py3
-rw-r--r--test/Libs/LIBSUFFIXES.py3
-rw-r--r--test/Libs/SharedLibraryIxes.py36
4 files changed, 37 insertions, 8 deletions
diff --git a/test/Libs/LIBPREFIXES.py b/test/Libs/LIBPREFIXES.py
index 1b28458..aed451e 100644
--- a/test/Libs/LIBPREFIXES.py
+++ b/test/Libs/LIBPREFIXES.py
@@ -30,6 +30,9 @@ import TestSCons
if sys.platform == 'win32':
_lib = '.lib'
+ import SCons.Tool.MSCommon as msc
+ if not msc.msvc_exists():
+ _lib = '.a'
else:
_lib = '.a'
diff --git a/test/Libs/LIBS.py b/test/Libs/LIBS.py
index 3d00a8a..5639228 100644
--- a/test/Libs/LIBS.py
+++ b/test/Libs/LIBS.py
@@ -30,6 +30,9 @@ import sys
if sys.platform == 'win32':
_exe = '.exe'
bar_lib = 'bar.lib'
+ import SCons.Tool.MSCommon as msc
+ if not msc.msvc_exists():
+ bar_lib = 'libbar.a'
else:
_exe = ''
bar_lib = 'libbar.a'
diff --git a/test/Libs/LIBSUFFIXES.py b/test/Libs/LIBSUFFIXES.py
index 4426e60..13baeab 100644
--- a/test/Libs/LIBSUFFIXES.py
+++ b/test/Libs/LIBSUFFIXES.py
@@ -30,6 +30,9 @@ import TestSCons
if sys.platform == 'win32':
lib_ = ''
+ import SCons.Tool.MSCommon as msc
+ if not msc.msvc_exists():
+ lib_ = 'lib'
else:
lib_ = 'lib'
diff --git a/test/Libs/SharedLibraryIxes.py b/test/Libs/SharedLibraryIxes.py
index 4e8dbdb..4804f5f 100644
--- a/test/Libs/SharedLibraryIxes.py
+++ b/test/Libs/SharedLibraryIxes.py
@@ -37,6 +37,16 @@ test = TestSCons.TestSCons()
test.write('SConstruct', """
import sys
isWindows = sys.platform == 'win32'
+isMingw = False
+if isWindows:
+ import SCons.Tool.MSCommon as msc
+ if not msc.msvc_exists():
+ # We can't seem to find any MSVC version, so we assume
+ # that MinGW is installed instead. Accordingly, we use the
+ # standard gcc/g++ conventions for lib prefixes and suffixes
+ # in the following...
+ isWindows = False
+ isMingw = True
env = Environment()
@@ -69,8 +79,8 @@ foo_obj = env.SharedObject(source='foo.c')
prog_obj = env.SharedObject(source='prog.c')
#
-# The following functions define all the different way that one can
-# use link againt a shared library.
+# The following functions define all the different ways that one can
+# use to link against a shared library.
#
def nodeInSrc(source, lib, libname):
return (source+lib, '')
@@ -91,17 +101,19 @@ def nameInLib(source, lib, libname):
# provide the full name of the library since scons can not know
# which of the non-standard extension to use.
#
- # Note that this is not necessarally SHLIBPREFIX and
+ # Note that this is not necessarily SHLIBPREFIX and
# SHLIBSUFFIX. These are the ixes of the target library, not the
- # ixes of the library that we are linking againt.
+ # ixes of the library that we are linking against.
return (source, libname)
-libmethods = [
- nodeInSrc, pathInSrc, nodeInLib, pathInLib,
- nameInLib ]
+libmethods = [nodeInSrc, pathInSrc, nodeInLib, pathInLib]
+# We skip the nameInLib test for MinGW...it would fail, due to
+# the Tool's internal naming conventions
+if not isMingw:
+ libmethods.extend([nameInLib])
def buildAndlinkAgainst(builder, target, source, method, lib, libname, **kw):
- '''Build a target using a given builder while linking againt a given
+ '''Build a target using a given builder while linking against a given
library using a specified method for linking against the library.'''
# On Windows, we have to link against the .lib file.
@@ -110,6 +122,14 @@ def buildAndlinkAgainst(builder, target, source, method, lib, libname, **kw):
if str(l)[-4:] == '.lib':
lib = [l]
break
+ # If we use MinGW and create a SharedLibrary, we get two targets: a DLL,
+ # and the import lib created by the "--out-implib" parameter. We always
+ # want to link against the second one, in order to prevent naming issues
+ # for the linker command line...
+ if isMingw and len(lib) > 1:
+ lib = lib[1:]
+
+ # Apply the naming method to be tested and call the specified Builder.
(source, LIBS) = method(source, lib, libname)
#build = builder(target=target, source=source, LIBS=LIBS, **kw)
kw = kw.copy()