From: stevenknight Date: Tue, 16 Apr 2002 03:24:39 +0000 (+0000) Subject: Shared library test fixes. (Charles Crain) X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=2074c3ad6032a72c0ff4d775fa74a45efebf2a7a;p=scons.git Shared library test fixes. (Charles Crain) git-svn-id: http://scons.tigris.org/svn/scons/trunk@332 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/doc/man/scons.1 b/doc/man/scons.1 index ec2fbddc..5fdc1aa9 100644 --- a/doc/man/scons.1 +++ b/doc/man/scons.1 @@ -1281,6 +1281,7 @@ When this is set to true, a library build of a WIN32 shared library (.dll file) will also build a corresponding .def file at the same time, if a .def file is not already listed as a build target. +The default is 0 (do not build a .def file). .IP WIN32DEFPREFIX The prefix used to build WIN32 .def files. diff --git a/src/engine/SCons/Defaults.py b/src/engine/SCons/Defaults.py index 4fc745b2..18233cf0 100644 --- a/src/engine/SCons/Defaults.py +++ b/src/engine/SCons/Defaults.py @@ -441,7 +441,7 @@ def make_win32_env_from_paths(include, lib, path): 'WIN32DEFSUFFIX' : '.def', 'WIN32DLLPREFIX' : '/out:', 'WIN32IMPLIBPREFIX' : '/implib:', - 'WIN32_INSERT_DEF' : 1, + 'WIN32_INSERT_DEF' : 0, 'ENV' : { 'INCLUDE' : include, 'LIB' : lib, diff --git a/test/SHCXX.py b/test/SHCXX.py index 0c3e2f28..5825491b 100644 --- a/test/SHCXX.py +++ b/test/SHCXX.py @@ -50,11 +50,11 @@ test.write('SConstruct', """ foo = Environment() shcxx = foo.Dictionary('SHCXX') bar = Environment(SHCXX = r'%s wrapper.py ' + shcxx) -foo.Program(target = 'foo', source = 'foo.cc', shared = 1) -bar.Program(target = 'bar', source = 'bar.cc', shared = 1) +foo.Program(target = 'foo', source = 'foo.cpp', shared = 1) +bar.Program(target = 'bar', source = 'bar.cpp', shared = 1) """ % python) -test.write('foo.cc', r""" +test.write('foo.cpp', r""" #include #include int @@ -66,7 +66,7 @@ main(int argc, char *argv[]) } """) -test.write('bar.cc', r""" +test.write('bar.cpp', r""" #include #include int diff --git a/test/SHCXXFLAGS.py b/test/SHCXXFLAGS.py index af980fec..5623795b 100644 --- a/test/SHCXXFLAGS.py +++ b/test/SHCXXFLAGS.py @@ -42,13 +42,13 @@ test = TestSCons.TestSCons() test.write('SConstruct', """ foo = Environment(SHCXXFLAGS = '%s') bar = Environment(SHCXXFLAGS = '%s') -foo.Object(target = 'foo%s', source = 'prog.cc', shared = 1) -bar.Object(target = 'bar%s', source = 'prog.cc', shared = 1) +foo.Object(target = 'foo%s', source = 'prog.cpp', shared = 1) +bar.Object(target = 'bar%s', source = 'prog.cpp', shared = 1) foo.Program(target = 'foo', source = 'foo%s', shared = 1) bar.Program(target = 'bar', source = 'bar%s', shared = 1) """ % (fooflags, barflags, _obj, _obj, _obj, _obj)) -test.write('prog.cc', r""" +test.write('prog.cpp', r""" #include #include int @@ -73,8 +73,8 @@ test.run(program = test.workpath('bar'), stdout = "prog.c: BAR\n") test.write('SConstruct', """ bar = Environment(SHCXXFLAGS = '%s') -bar.Object(target = 'foo%s', source = 'prog.cc', shared = 1) -bar.Object(target = 'bar%s', source = 'prog.cc', shared = 1) +bar.Object(target = 'foo%s', source = 'prog.cpp', shared = 1) +bar.Object(target = 'bar%s', source = 'prog.cpp', shared = 1) bar.Program(target = 'foo', source = 'foo%s', shared = 1) bar.Program(target = 'bar', source = 'bar%s', shared = 1) """ % (barflags, _obj, _obj, _obj, _obj)) diff --git a/test/SHLINK.py b/test/SHLINK.py index 61060ee4..4d28e042 100644 --- a/test/SHLINK.py +++ b/test/SHLINK.py @@ -32,14 +32,14 @@ import TestSCons python = sys.executable if sys.platform == 'win32': - _exe = '.exe' + lib_ = '' + _shlib='.dll' else: - _exe = '' - + lib_ = 'lib' + _shlib='.so' + test = TestSCons.TestSCons() -test.pass_test() #XXX Until someone can take a look and fix this. - test.write("wrapper.py", """import os import string @@ -52,36 +52,37 @@ test.write('SConstruct', """ foo = Environment() shlink = foo.Dictionary('SHLINK') bar = Environment(SHLINK = r'%s wrapper.py ' + shlink) -foo.Program(target = 'foo', source = 'foo.c', shared = 1) -bar.Program(target = 'bar', source = 'bar.c', shared = 1) +foo.Library(target = 'foo', source = 'foo.c', shared = 1) +bar.Library(target = 'bar', source = 'bar.c', shared = 1) """ % python) test.write('foo.c', r""" -int -main(int argc, char *argv[]) +#include + +void +test() { - argv[argc++] = "--"; printf("foo.c\n"); - exit (0); + fflush(stdout); } """) test.write('bar.c', r""" -int -main(int argc, char *argv[]) +#include + +void +test() { - argv[argc++] = "--"; printf("foo.c\n"); - exit (0); + fflush(stdout); } """) - -test.run(arguments = 'foo' + _exe) +test.run(arguments = lib_ + 'foo' + _shlib) test.fail_test(os.path.exists(test.workpath('wrapper.out'))) -test.run(arguments = 'bar' + _exe) +test.run(arguments = lib_ + 'bar' + _shlib) test.fail_test(test.read('wrapper.out') != "wrapper.py\n") diff --git a/test/SHLINKFLAGS.py b/test/SHLINKFLAGS.py index a885d84c..6494ad5c 100644 --- a/test/SHLINKFLAGS.py +++ b/test/SHLINKFLAGS.py @@ -32,14 +32,14 @@ import TestSCons python = sys.executable if sys.platform == 'win32': - _exe = '.exe' + lib_ = '' + _shlib = '.dll' else: - _exe = '' + lib_ = 'lib' + _shlib = '.so' test = TestSCons.TestSCons() -test.pass_test() #XXX Until someone can take a look and fix this. - test.write("wrapper.py", """import os import string @@ -51,38 +51,42 @@ os.system(string.join(sys.argv[1:], " ")) test.write('SConstruct', """ foo = Environment() shlink = foo.Dictionary('SHLINK') -bar = Environment(SHLINK = '', SHLINKFLAGS = r'%s wrapper.py ' + shlink) -foo.Program(target = 'foo', source = 'foo.c', shared = 1) -bar.Program(target = 'bar', source = 'bar.c', shared = 1) +shlinkflags = foo.Dictionary('SHLINKFLAGS') +bar = Environment(SHLINK = '', + SHLINKFLAGS = r'%s wrapper.py ' + shlink + ' ' + shlinkflags) +foo.Library(target = 'foo', source = 'foo.c', shared = 1) +bar.Library(target = 'bar', source = 'bar.c', shared = 1) """ % python) test.write('foo.c', r""" -int -main(int argc, char *argv[]) +#include + +void +test() { - argv[argc++] = "--"; printf("foo.c\n"); - exit (0); + fflush(stdout); } """) test.write('bar.c', r""" -int -main(int argc, char *argv[]) +#include + +void +test() { - argv[argc++] = "--"; printf("foo.c\n"); - exit (0); + fflush(stdout); } """) - -test.run(arguments = 'foo' + _exe) +test.run(arguments = lib_ + 'foo' + _shlib) test.fail_test(os.path.exists(test.workpath('wrapper.out'))) -test.run(arguments = 'bar' + _exe) +test.run(arguments = lib_ + 'bar' + _shlib) test.fail_test(test.read('wrapper.out') != "wrapper.py\n") test.pass_test() + diff --git a/test/SharedLibrary.py b/test/SharedLibrary.py index 038370b4..d00f5951 100644 --- a/test/SharedLibrary.py +++ b/test/SharedLibrary.py @@ -30,7 +30,7 @@ import os test = TestSCons.TestSCons() test.write('SConstruct', """ -env=Environment() +env=Environment(WIN32_INSERT_DEF=1) env2 = Environment(LIBS = [ 'foo1', 'foo2', 'foo3' ], LIBPATH = [ '.' ]) env.Library(target = 'foo1', source = 'f1.c', shared=1)