1. SCons
  2. Core
  3. SCons

Commits

Steven Knight  committed fa65d43

Finish the display-customization variables: , , , , , and .

  • Participants
  • Parent commits ca0c467
  • Branches default

Comments (0)

Files changed (28)

File doc/man/scons.1

View file
 env['PCH'] = 'StdAfx.pch'
 .EE
 
+.IP PCHCOM
+The command line used by the
+.B PCH
+builder to generated a precompiled header.
+
+.IP PCHCOMSTR
+The string displayed when generating a precompiled header.
+If this is not set, then $PCHCOM (the command line) is displayed.
+
 .IP PCHSTOP
 This variable specifies how much of a source file is precompiled. This
 variable is ignored by tools other than Microsoft Visual C++, or when
 .IP QT_MOCFROMCXXCOM
 Command to generate a moc file from a cpp file.
 
+.IP QT_MOCFROMCXXCOMSTR
+The string displayed when generating a moc file from a cpp file.
+If this is not set, then $QT_MOCFROMCXXCOM (the command line) is displayed.
+
 .IP QT_MOCFROMHCOM
 Command to generate a moc file from a header.
 
+.IP QT_MOCFROMHCOMSTR
+The string displayed when generating a moc file from a cpp file.
+If this is not set, then $QT_MOCFROMHCOM (the command line) is displayed.
+
 .IP QT_MOCFROMHFLAGS
 Default value is ''. These flags are passed to moc, when moccing a header
 file.
 .IP QT_UIC
 Default value is '$QT_BINPATH/uic'.
 
-.IP QT_UICDECLCOM
+.IP QT_UICCOM
 Command to generate header files from .ui files.
 
+.IP QT_UICCOMSTR
+The string displayed when generating header files from .ui files.
+If this is not set, then $QT_UICCOM (the command line) is displayed.
+
 .IP QT_UICDECLFLAGS
 Default value is ''. These flags are passed to uic, when creating a a h
 file from a .ui file.
 .IP QT_UICDECLSUFFIX
 Default value is '.h'. Suffix for uic generated header files.
 
-.IP QT_UICIMPLCOM
-Command to generate cxx files from .ui files.
-
 .IP QT_UICIMPLFLAGS
 Default value is ''. These flags are passed to uic, when creating a cxx
 file from a .ui file.
 .IP RCCOM
 The command line used by the RES builder.
 
+.IP RCCOMSTR
+The string displayed when invoking the resource compiler.
+If this is not set, then $RCCOM (the command line) is displayed.
+
 .IP RCFLAGS
 The flags passed to the resource compiler by the RES builder.
 
 .IP RCS_COFLAGS
 Options that are passed to the $RCS_CO command.
 
+.IP REGSVR
+The program used to register DLLs on Windows systems.
+
+.IP REGSVRCOM
+The command line used to register a newly-built DLL file
+on Windows systems.
+Invoked when the "register=1"
+keyword argument is passed to the
+.B SharedLibrary
+Builder.
+
+.IP REGSVRCOMSTR
+The string displayed when registering a newly-built DLL file.
+If this is not set, then $REGSVRCOM (the command line) is displayed.
+
 .IP RDirs
 A function that converts a file name into a list of Dir instances by
 searching the repositories. 

File src/CHANGES.txt

View file
     $CVSCOMSTR, $CXXCOMSTR, $DCOMSTR, $DVIPDFCOMSTR, $F77COMSTR,
     $F90COMSTR, $F95COMSTR, $FORTRANCOMSTR, $GSCOMSTR, $JARCOMSTR,
     $JAVACCOMSTR, $JAVAHCOMSTR, $LATEXCOMSTR, $LEXCOMSTR, $LINKCOMSTR,
-    $M4COMSTR, $P4COMSTR, $PDFLATEXCOMSTR, $PDFTEXCOMSTR, $PSCOMSTR,
-    $RCSCOMSTR, $RMICCOMSTR, $SCCSCOMSTR, $SHCCCOMSTR, $SHCXXCOMSTR,
-    $SHF77COMSTR, $SHF90COMSTR, $SHF95COMSTR, $SHFORTRANCOMSTR,
-    $SHLINKCOMSTR, $SWIGCOMSTR, $TARCOMSTR, $TEXCOMSTR, $YACCCOMSTR
-    and $ZIPCOMSTR.
+    $M4COMSTR, $MIDLCOMSTR, $P4COMSTR, $PCHCOMSTR, $PDFLATEXCOMSTR,
+    $PDFTEXCOMSTR, $PSCOMSTR, $QT_MOCFROMCXXCOMSTR, $QT_MOCFROMHCOMSTR,
+    $QT_UICCOMSTR, $RCCOMSTR, $REGSVRCOMSTR, $RCS_COCOMSTR, $RMICCOMSTR,
+    $SCCSCOMSTR, $SHCCCOMSTR, $SHCXXCOMSTR, $SHF77COMSTR, $SHF90COMSTR,
+    $SHF95COMSTR, $SHFORTRANCOMSTR, $SHLINKCOMSTR, $SWIGCOMSTR,
+    $TARCOMSTR, $TEXCOMSTR, $YACCCOMSTR and $ZIPCOMSTR.
 
   - Add an optional "map" keyword argument to ListOption() that takes a
     dictionary to map user-specified values to legal values from the list

File src/engine/SCons/Tool/midl.py

View file
 
 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
 
+import SCons.Action
+import SCons.Builder
 import SCons.Defaults
 import SCons.Scanner.IDL
 import SCons.Util
 
 idl_scanner = SCons.Scanner.IDL.IDLScan()
 
-midl_builder = SCons.Builder.Builder(action='$MIDLCOM',
+midl_action = SCons.Action.Action('$MIDLCOM', '$MIDLCOMSTR')
+
+midl_builder = SCons.Builder.Builder(action = midl_action,
                                      src_suffix = '.idl',
                                      suffix='.tlb',
                                      emitter = midl_emitter,
         return 1
     else:
         return env.Detect('midl')
-
-

File src/engine/SCons/Tool/mingw.py

View file
 import os.path
 import string
 
+import SCons.Action
+import SCons.Builder
 import SCons.Tool
 import SCons.Util
 
 
 shlib_action = SCons.Action.CommandGenerator(shlib_generator)
 
-res_builder = SCons.Builder.Builder(action='$RCCOM', suffix='.o',
+res_action = SCons.Action.Action('$RCCOM', '$RCCOMSTR')
+
+res_builder = SCons.Builder.Builder(action=res_action, suffix='.o',
                                     source_scanner=SCons.Defaults.ObjSourceScan)
 SCons.Defaults.ObjSourceScan.add_scanner('.rc', SCons.Defaults.CScan)
 

File src/engine/SCons/Tool/mslink.py

View file
         return ret
     return 0
 
-regServerAction = SCons.Action.Action("$REGSVRCOM")
+regServerAction = SCons.Action.Action("$REGSVRCOM", "$REGSVRCOMSTR")
 regServerCheck = SCons.Action.Action(RegServerFunc, None)
 shlibLinkAction = SCons.Action.Action('${TEMPFILE("$SHLINK $SHLINKFLAGS $_SHLINK_TARGETS $( $_LIBDIRFLAGS $) $_LIBFLAGS $_PDB $_SHLINK_SOURCES")}')
 compositeLinkAction = shlibLinkAction + regServerCheck

File src/engine/SCons/Tool/msvc.py

View file
     return object_emitter(target, source, env,
                           SCons.Defaults.SharedObjectEmitter)
 
-pch_builder = SCons.Builder.Builder(action='$PCHCOM', suffix='.pch', emitter=pch_emitter,
+pch_action = SCons.Action.Action('$PCHCOM', '$PCHCOMSTR')
+pch_builder = SCons.Builder.Builder(action=pch_action, suffix='.pch',
+                                    emitter=pch_emitter,
                                     source_scanner=SCons.Defaults.ObjSourceScan)
-res_builder = SCons.Builder.Builder(action='$RCCOM', suffix='.res',
+res_action = SCons.Action.Action('$RCCOM', '$RCCOMSTR')
+res_builder = SCons.Builder.Builder(action=res_action, suffix='.res',
                                     source_scanner=SCons.Defaults.ObjSourceScan)
 SCons.Defaults.ObjSourceScan.add_scanner('.rc', SCons.Defaults.CScan)
 

File src/engine/SCons/Tool/qt.py

View file
 
 """SCons.Tool.qt
 
-Tool-specific initialization for qt.
+Tool-specific initialization for Qt.
 
 There normally shouldn't be any need to import this module directly.
 It will usually be imported through the generic SCons.Tool.Tool()
 import os.path
 import re
 
+import SCons.Action
+import SCons.Builder
 import SCons.Defaults
 import SCons.Scanner
 import SCons.Tool
                     Action(checkMocIncluded,None)])
 
     # ... and the corresponding builders
-    uicBld = Builder(action='$QT_UICCOM',
+    uicBld = Builder(action=SCons.Action.Action('$QT_UICCOM', '$QT_UICCOMSTR'),
                      emitter=uicEmitter,
                      src_suffix='$QT_UISUFFIX',
                      suffix='$QT_UICDECLSUFFIX',
                      source_scanner=uicScanner)
     mocBld = Builder(action={}, prefix={}, suffix={})
     for h in header_extensions:
-        mocBld.add_action(h, '$QT_MOCFROMHCOM')
+        act = SCons.Action.Action('$QT_MOCFROMHCOM', '$QT_MOCFROMHCOMSTR')
+        mocBld.add_action(h, act)
         mocBld.prefix[h] = '$QT_MOCHPREFIX'
         mocBld.suffix[h] = '$QT_MOCHSUFFIX'
     for cxx in cxx_suffixes:
-        mocBld.add_action(cxx, '$QT_MOCFROMCXXCOM')
+        act = SCons.Action.Action('$QT_MOCFROMCXXCOM', '$QT_MOCFROMCXXCOMSTR')
+        mocBld.add_action(cxx, act)
         mocBld.prefix[cxx] = '$QT_MOCCXXPREFIX'
         mocBld.suffix[cxx] = '$QT_MOCCXXSUFFIX'
 

File test/GSFLAGS.py

-#!/usr/bin/env python
-#
-# __COPYRIGHT__
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
-# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-
-import os
-import os.path
-import string
-import sys
-import TestSCons
-
-python = TestSCons.python
-
-test = TestSCons.TestSCons()
-
-
-
-test.write('mygs.py', r"""
-import getopt
-import os
-import sys
-cmd_opts, args = getopt.getopt(sys.argv[1:], 's:x', [])
-opt_string = ''
-for opt, arg in cmd_opts:
-    if opt == '-s':
-        if arg[:11] == 'OutputFile=':
-            out_file = open(arg[11:], 'wb')
-    else:
-        opt_string = opt_string + ' ' + opt
-infile = open(args[0], 'rb')
-out_file.write(opt_string + "\n")
-for l in infile.readlines():
-    if l[:3] != '#ps':
-        out_file.write(l)
-sys.exit(0)
-""")
-
-test.write('SConstruct', """
-env = Environment(GS = r'%s mygs.py', GSFLAGS = '-x',
-                  tools = ['gs'])
-env.PDF(target = 'test1.pdf', source = 'test1.ps')
-""" % (python))
-
-test.write('test1.ps', """\
-This is a .ps test.
-#ps
-""")
-
-test.run(arguments = '.', stderr = None)
-
-test.fail_test(test.read('test1.pdf') != " -x\nThis is a .ps test.\n")
-
-
-
-if sys.platform == 'win32':
-    gs_executable = 'gswin32c'
-elif sys.platform == 'os2':
-    gs_executable = 'gsos2'
-else:
-    gs_executable = 'gs'
-gs = test.where_is(gs_executable)
-
-if gs:
-
-    test.write("wrapper.py", """import os
-import string
-import sys
-cmd = string.join(sys.argv[1:], " ")
-open('%s', 'ab').write("%%s\\n" %% cmd)
-os.system(cmd)
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
-
-    test.write('SConstruct', """\
-import os
-ENV = { 'PATH' : os.environ['PATH'] }
-foo = Environment(ENV = ENV)
-foo.Append(GSFLAGS = '-q')
-foo.PDF(target = 'foo.pdf', source = 'foo.ps')
-""")
-
-    input = """\
-%!PS-Adobe
-100 100 moveto /Times-Roman findfont 24 scalefont (Hello, world!) show showpage
-"""
-
-    test.write('foo.ps', input)
-
-    test.run(arguments = 'foo.pdf', stderr = None)
-
-    test.fail_test(not os.path.exists(test.workpath('foo.pdf')))
-
-test.pass_test()

File test/Ghostscript/GSFLAGS.py

View file
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import os
+import os.path
+import string
+import sys
+import TestSCons
+
+python = TestSCons.python
+
+test = TestSCons.TestSCons()
+
+
+
+test.write('mygs.py', r"""
+import getopt
+import os
+import sys
+cmd_opts, args = getopt.getopt(sys.argv[1:], 's:x', [])
+opt_string = ''
+for opt, arg in cmd_opts:
+    if opt == '-s':
+        if arg[:11] == 'OutputFile=':
+            out_file = open(arg[11:], 'wb')
+    else:
+        opt_string = opt_string + ' ' + opt
+infile = open(args[0], 'rb')
+out_file.write(opt_string + "\n")
+for l in infile.readlines():
+    if l[:3] != '#ps':
+        out_file.write(l)
+sys.exit(0)
+""")
+
+test.write('SConstruct', """
+env = Environment(GS = r'%s mygs.py', GSFLAGS = '-x',
+                  tools = ['gs'])
+env.PDF(target = 'test1.pdf', source = 'test1.ps')
+""" % (python))
+
+test.write('test1.ps', """\
+This is a .ps test.
+#ps
+""")
+
+test.run(arguments = '.', stderr = None)
+
+test.fail_test(test.read('test1.pdf') != " -x\nThis is a .ps test.\n")
+
+
+
+if sys.platform == 'win32':
+    gs_executable = 'gswin32c'
+elif sys.platform == 'os2':
+    gs_executable = 'gsos2'
+else:
+    gs_executable = 'gs'
+gs = test.where_is(gs_executable)
+
+if gs:
+
+    test.write("wrapper.py", """import os
+import string
+import sys
+cmd = string.join(sys.argv[1:], " ")
+open('%s', 'ab').write("%%s\\n" %% cmd)
+os.system(cmd)
+""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+
+    test.write('SConstruct', """\
+import os
+ENV = { 'PATH' : os.environ['PATH'] }
+foo = Environment(ENV = ENV)
+foo.Append(GSFLAGS = '-q')
+foo.PDF(target = 'foo.pdf', source = 'foo.ps')
+""")
+
+    input = """\
+%!PS-Adobe
+100 100 moveto /Times-Roman findfont 24 scalefont (Hello, world!) show showpage
+"""
+
+    test.write('foo.ps', input)
+
+    test.run(arguments = 'foo.pdf', stderr = None)
+
+    test.fail_test(not os.path.exists(test.workpath('foo.pdf')))
+
+test.pass_test()

File test/IDL/IDLSUFFIXES.py

View file
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Test that we can add filesuffixes to $IDLSUFFIXES.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """
+import SCons.Scanner.IDL
+env = Environment(CPPPATH=['.'])
+env.Append(SCANNERS = [ SCons.Scanner.IDL.IDLScan() ],
+           IDLSUFFIXES = ['.x'])
+env.InstallAs('foo_idl', 'foo.idl')
+env.InstallAs('foo_x', 'foo.x')
+""")
+
+test.write('foo.idl', """\
+import <foo.h>
+""")
+
+test.write('foo.x', """\
+#include <foo.h>
+""")
+
+test.write('foo.h', "foo.h 1\n")
+
+test.run(arguments='.', stdout=test.wrap_stdout("""\
+Install file: "foo.idl" as "foo_idl"
+Install file: "foo.x" as "foo_x"
+"""))
+
+test.up_to_date(arguments='.')
+
+test.write('foo.h', "foo.h 2\n")
+
+test.run(arguments='.', stdout=test.wrap_stdout("""\
+Install file: "foo.idl" as "foo_idl"
+Install file: "foo.x" as "foo_x"
+"""))
+
+test.up_to_date(arguments='.')
+
+test.pass_test()

File test/IDL/MIDLCOM.py

View file
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Test the ability to configure the $MIDLCOM construction variable.
+"""
+
+import TestSCons
+
+python = TestSCons.python
+
+test = TestSCons.TestSCons()
+
+
+
+test.write('mymidl.py', """
+import sys
+outfile = open(sys.argv[1], 'wb')
+for f in sys.argv[2:]:
+    infile = open(f, 'rb')
+    for l in filter(lambda l: l != '/*midl*/\\n', infile.readlines()):
+        outfile.write(l)
+sys.exit(0)
+""")
+
+test.write('SConstruct', """
+env = Environment(tools=['default', 'midl'],
+                  MIDLCOM = r'%s mymidl.py $TARGET $SOURCES')
+env.TypeLibrary(target = 'aaa', source = 'aaa.idl')
+""" % python)
+
+test.write('aaa.idl', "aaa.idl\n/*midl*/\n")
+
+test.run(arguments = '.')
+
+test.must_match('aaa.tlb', "aaa.idl\n")
+
+
+
+test.pass_test()

File test/IDL/MIDLCOMSTR.py

View file
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Test that the $MIDLCOMSTR construction variable allows you to customize
+the displayed string when midl is called.
+"""
+
+import TestSCons
+
+python = TestSCons.python
+
+test = TestSCons.TestSCons()
+
+
+
+test.write('mymidl.py', """
+import sys
+outfile = open(sys.argv[1], 'wb')
+for f in sys.argv[2:]:
+    infile = open(f, 'rb')
+    for l in filter(lambda l: l != '/*midl*/\\n', infile.readlines()):
+        outfile.write(l)
+sys.exit(0)
+""")
+
+test.write('SConstruct', """
+env = Environment(tools=['default', 'midl'],
+                  MIDLCOM = r'%s mymidl.py $TARGET $SOURCES',
+                  MIDLCOMSTR = 'MIDLing $TARGET from $SOURCE')
+env.TypeLibrary(target = 'aaa', source = 'aaa.idl')
+""" % python)
+
+test.write('aaa.idl', "aaa.idl\n/*midl*/\n")
+
+test.run(stdout = test.wrap_stdout("""\
+MIDLing aaa.tlb from aaa.idl
+"""))
+
+test.must_match('aaa.tlb', "aaa.idl\n")
+
+
+
+test.pass_test()

File test/IDL/midl.py

View file
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import TestSCons
+import sys
+import os.path
+import os
+import TestCmd
+import time
+
+test = TestSCons.TestSCons(match = TestCmd.match_re)
+
+if sys.platform != 'win32':
+    test.pass_test()
+
+#####
+# Test the basics
+
+test.write('SConstruct',"""
+import os.path
+import os
+
+env = Environment(CCFLAGS = ' -nologo ',
+                  CPPPATH = '${TARGET.dir}',
+                  MSVS_USE_MFC_DIRS = 1)
+Export('env')
+
+BuildDir('build', 'src')
+SConscript(os.path.join('build','SConscript'))
+
+BuildDir('build2', 'src', duplicate=0)
+SConscript(os.path.join('build2','SConscript'))
+""")
+
+test.subdir('src','build')
+
+test.write('src/SConscript',"""
+import os.path
+
+Import('env')
+
+local = env.Copy(WIN32_INSERT_DEF = 1)
+
+barsrc = [
+    'BarObject.cpp',
+    'bar.cpp',
+    local.RES('bar.rc', RCFLAGS= '/I${SOURCE.srcdir}'),
+    ]
+
+local.TypeLibrary('bar.idl')
+
+local.SharedLibrary(target = 'bar.dll',
+                    source = barsrc,
+                    PCH=local.PCH('BarPCH.cpp')[0],
+                    PCHSTOP = 'BarPCH.h',
+                    register=1)
+""")
+
+test.write('src/BarObject.cpp','''
+#include "BarPCH.h"
+#include "Bar.h"
+#include "BarObject.h"
+''')
+
+test.write('src/BarObject.h','''
+#ifndef __BAROBJECT_H_
+#define __BAROBJECT_H_
+
+#include "resource.h"
+
+class ATL_NO_VTABLE CBarObject : 
+	public CComObjectRootEx<CComSingleThreadModel>,
+	public CComCoClass<CBarObject, &CLSID_BarObject>,
+	public IDispatchImpl<IBarObject, &IID_IBarObject, &LIBID_BARLib>
+{
+public:
+	CBarObject()
+	{
+	}
+
+DECLARE_REGISTRY_RESOURCEID(IDR_BAROBJECT)
+
+DECLARE_PROTECT_FINAL_CONSTRUCT()
+
+BEGIN_COM_MAP(CBarObject)
+	COM_INTERFACE_ENTRY(IBarObject)
+	COM_INTERFACE_ENTRY(IDispatch)
+END_COM_MAP()
+
+public:
+};
+
+#endif
+''')
+
+test.write('src/BarObject.rgs',"""
+HKCR
+{
+	Bar.BarObject.1 = s 'BarObject Class'
+	{
+		CLSID = s '{640BE9EC-B79D-4C9E-BB64-95D24854A303}'
+	}
+	Bar.BarObject = s 'BarObject Class'
+	{
+		CLSID = s '{640BE9EC-B79D-4C9E-BB64-95D24854A303}'
+		CurVer = s 'Bar.BarObject.1'
+	}
+	NoRemove CLSID
+	{
+		ForceRemove {640BE9EC-B79D-4C9E-BB64-95D24854A303} = s 'BarObject Class'
+		{
+			ProgID = s 'Bar.BarObject.1'
+			VersionIndependentProgID = s 'Bar.BarObject'
+			ForceRemove 'Programmable'
+			InprocServer32 = s '%MODULE%'
+			{
+				val ThreadingModel = s 'Apartment'
+			}
+			'TypeLib' = s '{73E5EA5F-9D45-463F-AA33-9F376AF7B643}'
+		}
+	}
+}
+""")
+
+test.write('src/BarPCH.cpp','''
+#include "BarPCH.h"
+
+#ifdef _ATL_STATIC_REGISTRY
+#include <statreg.h>
+#include <statreg.cpp>
+#endif
+
+#include <atlimpl.cpp>
+''')
+
+test.write('src/BarPCH.h','''
+#ifndef BarPCH_h
+#define BarPCH_h
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#define STRICT
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT 0x0400
+#endif
+#define _ATL_APARTMENT_THREADED
+
+#include <atlbase.h>
+extern CComModule _Module;
+#include <atlcom.h>
+
+#endif
+''')
+
+test.write('src/bar.cpp','''
+#include "BarPCH.h"
+#include "resource.h"
+#include <initguid.h>
+#include "bar.h"
+
+#include "bar_i.c"
+#include "BarObject.h"
+
+CComModule _Module;
+
+BEGIN_OBJECT_MAP(ObjectMap)
+OBJECT_ENTRY(CLSID_BarObject, CBarObject)
+END_OBJECT_MAP()
+
+extern "C"
+BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
+{
+    lpReserved;
+    if (dwReason == DLL_PROCESS_ATTACH)
+    {
+        _Module.Init(ObjectMap, hInstance, &LIBID_BARLib);
+        DisableThreadLibraryCalls(hInstance);
+    }
+    else if (dwReason == DLL_PROCESS_DETACH)
+        _Module.Term();
+    return TRUE;    // ok
+}
+
+STDAPI DllCanUnloadNow(void)
+{
+    return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
+}
+
+STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
+{
+    return _Module.GetClassObject(rclsid, riid, ppv);
+}
+
+STDAPI DllRegisterServer(void)
+{
+    return _Module.RegisterServer(TRUE);
+}
+
+STDAPI DllUnregisterServer(void)
+{
+    return _Module.UnregisterServer(TRUE);
+}
+''')
+
+test.write('src/bar.def','''
+; bar.def : Declares the module parameters.
+
+LIBRARY      "bar.DLL"
+
+EXPORTS
+	DllCanUnloadNow     @1 PRIVATE
+	DllGetClassObject   @2 PRIVATE
+	DllRegisterServer   @3 PRIVATE
+	DllUnregisterServer	@4 PRIVATE
+''')
+
+test.write('src/bar.idl','''
+import "oaidl.idl";
+import "ocidl.idl";
+	[
+		object,
+		uuid(22995106-CE26-4561-AF1B-C71C6934B840),
+		dual,
+		helpstring("IBarObject Interface"),
+		pointer_default(unique)
+	]
+	interface IBarObject : IDispatch
+	{
+	};
+
+[
+	uuid(73E5EA5F-9D45-463F-AA33-9F376AF7B643),
+	version(1.0),
+	helpstring("bar 1.0 Type Library")
+]
+library BARLib
+{
+	importlib("stdole32.tlb");
+	importlib("stdole2.tlb");
+
+	[
+		uuid(640BE9EC-B79D-4C9E-BB64-95D24854A303),
+		helpstring("BarObject Class")
+	]
+	coclass BarObject
+	{
+		[default] interface IBarObject;
+	};
+};
+''')
+
+test.write('src/bar.rc','''
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+
+#include "winres.h"
+
+#undef APSTUDIO_READONLY_SYMBOLS
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+
+1 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "resource.h\\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "#include ""winres.h""\\r\\n"
+    "\\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "1 TYPELIB ""bar.tlb""\\r\\n"
+    "\\0"
+END
+
+#endif    // APSTUDIO_INVOKED
+
+
+#ifndef _MAC
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040904B0"
+        BEGIN
+            VALUE "CompanyName", "\\0"
+            VALUE "FileDescription", "bar Module\\0"
+            VALUE "FileVersion", "1, 0, 0, 1\\0"
+            VALUE "InternalName", "bar\\0"
+            VALUE "LegalCopyright", "Copyright 2003\\0"
+            VALUE "OriginalFilename", "bar.DLL\\0"
+            VALUE "ProductName", "bar Module\\0"
+            VALUE "ProductVersion", "1, 0, 0, 1\\0"
+            VALUE "OLESelfRegister", "\\0"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x409, 1200
+    END
+END
+
+#endif    // !_MAC
+
+IDR_BAROBJECT           REGISTRY DISCARDABLE    "BarObject.rgs"
+
+STRINGTABLE DISCARDABLE 
+BEGIN
+    IDS_PROJNAME            "bar"
+END
+
+#endif    // English (U.S.) resources
+
+#ifndef APSTUDIO_INVOKED
+
+1 TYPELIB "bar.tlb"
+
+#endif    // not APSTUDIO_INVOKED
+''')
+
+test.write('src/resource.h','''
+#define IDS_PROJNAME                    100
+#define IDR_BAROBJECT                   101
+
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE        201
+#define _APS_NEXT_COMMAND_VALUE         32768
+#define _APS_NEXT_CONTROL_VALUE         201
+#define _APS_NEXT_SYMED_VALUE           102
+#endif
+#endif
+''')
+
+test.run(arguments=os.path.join('build','bar.dll'))
+
+test.must_exist(['build','BarPCH.pch'])
+test.must_exist(['build','BarPCH.obj'])
+test.must_exist(['build','bar.tlb'])
+test.must_exist(['build','bar.h'])
+test.must_exist(['build','bar_i.c'])
+test.must_exist(['build','bar_p.c'])
+test.must_exist(['build','bar_data.c'])
+test.must_exist(['build','BarObject.obj'])
+test.must_exist(['build','bar.obj'])
+test.must_exist(['build','bar.res'])
+test.must_exist(['build','bar.dll'])
+test.must_exist(['build','bar.lib'])
+test.must_exist(['build','bar.exp'])
+
+test.run(arguments='-c .')
+
+test.must_not_exist(['build','BarPCH.pch'])
+test.must_not_exist(['build','BarPCH.obj'])
+test.must_not_exist(['build','bar.tlb'])
+test.must_not_exist(['build','bar.h'])
+test.must_not_exist(['build','bar_i.c'])
+test.must_not_exist(['build','bar_p.c'])
+test.must_not_exist(['build','bar_data.c'])
+test.must_not_exist(['build','BarObject.obj'])
+test.must_not_exist(['build','bar.obj'])
+test.must_not_exist(['build','bar.res'])
+test.must_not_exist(['build','bar.dll'])
+test.must_not_exist(['build','bar.lib'])
+test.must_not_exist(['build','bar.exp'])
+
+test.run(arguments=os.path.join('build2','bar.dll'))
+
+test.must_exist(['build2','BarPCH.pch'])
+test.must_exist(['build2','BarPCH.obj'])
+test.must_exist(['build2','bar.tlb'])
+test.must_exist(['build2','bar.h'])
+test.must_exist(['build2','bar_i.c'])
+test.must_exist(['build2','bar_p.c'])
+test.must_exist(['build2','bar_data.c'])
+test.must_exist(['build2','BarObject.obj'])
+test.must_exist(['build2','bar.obj'])
+test.must_exist(['build2','bar.res'])
+test.must_exist(['build2','bar.dll'])
+test.must_exist(['build2','bar.lib'])
+test.must_exist(['build2','bar.exp'])
+
+test.run(arguments='-c .')
+
+test.must_not_exist(['build2','BarPCH.pch'])
+test.must_not_exist(['build2','BarPCH.obj'])
+test.must_not_exist(['build2','bar.tlb'])
+test.must_not_exist(['build2','bar.h'])
+test.must_not_exist(['build2','bar_i.c'])
+test.must_not_exist(['build2','bar_p.c'])
+test.must_not_exist(['build2','bar_data.c'])
+test.must_not_exist(['build2','BarObject.obj'])
+test.must_not_exist(['build2','bar.obj'])
+test.must_not_exist(['build2','bar.res'])
+test.must_not_exist(['build2','bar.dll'])
+test.must_not_exist(['build2','bar.lib'])
+test.must_not_exist(['build2','bar.exp'])
+
+test.pass_test()

File test/IDLSUFFIXES.py

-#!/usr/bin/env python
-#
-# __COPYRIGHT__
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
-# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-
-"""
-Test that we can add filesuffixes to $IDLSUFFIXES.
-"""
-
-import TestSCons
-
-test = TestSCons.TestSCons()
-
-test.write('SConstruct', """
-import SCons.Scanner.IDL
-env = Environment(CPPPATH=['.'])
-env.Append(SCANNERS = [ SCons.Scanner.IDL.IDLScan() ],
-           IDLSUFFIXES = ['.x'])
-env.InstallAs('foo_idl', 'foo.idl')
-env.InstallAs('foo_x', 'foo.x')
-""")
-
-test.write('foo.idl', """\
-import <foo.h>
-""")
-
-test.write('foo.x', """\
-#include <foo.h>
-""")
-
-test.write('foo.h', "foo.h 1\n")
-
-test.run(arguments='.', stdout=test.wrap_stdout("""\
-Install file: "foo.idl" as "foo_idl"
-Install file: "foo.x" as "foo_x"
-"""))
-
-test.up_to_date(arguments='.')
-
-test.write('foo.h', "foo.h 2\n")
-
-test.run(arguments='.', stdout=test.wrap_stdout("""\
-Install file: "foo.idl" as "foo_idl"
-Install file: "foo.x" as "foo_x"
-"""))
-
-test.up_to_date(arguments='.')
-
-test.pass_test()

File test/MSVC/PCHCOM.py

View file
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Test the ability to configure the $MIDLCOM construction variable.
+"""
+
+import TestSCons
+
+python = TestSCons.python
+
+test = TestSCons.TestSCons()
+
+
+
+test.write('mypch.py', """
+import sys
+outfile = open(sys.argv[1], 'wb')
+for f in sys.argv[2:]:
+    infile = open(f, 'rb')
+    for l in filter(lambda l: l != '/*pch*/\\n', infile.readlines()):
+        outfile.write(l)
+sys.exit(0)
+""")
+
+test.write('SConstruct', """
+env = Environment(tools=['default', 'msvc'],
+                  PCHCOM = r'%s mypch.py $TARGET $SOURCES')
+env.PCH(target = 'aaa', source = 'aaa.h')
+""" % python)
+
+test.write('aaa.h', "aaa.h\n/*pch*/\n")
+
+test.run(arguments = ".")
+
+test.must_match('aaa.pch', "aaa.h\n")
+
+
+
+test.pass_test()

File test/MSVC/PCHCOMSTR.py

View file
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Test that the $PCHCOMSTR construction variable allows you to customize
+the displayed string when pch is called.
+"""
+
+import TestSCons
+
+python = TestSCons.python
+
+test = TestSCons.TestSCons()
+
+
+
+test.write('mypch.py', """
+import sys
+outfile = open(sys.argv[1], 'wb')
+for f in sys.argv[2:]:
+    infile = open(f, 'rb')
+    for l in filter(lambda l: l != '/*pch*/\\n', infile.readlines()):
+        outfile.write(l)
+sys.exit(0)
+""")
+
+test.write('SConstruct', """
+env = Environment(tools=['default', 'msvc'],
+                  PCHCOM = r'%s mypch.py $TARGET $SOURCES',
+                  PCHCOMSTR = 'PCHing $TARGET from $SOURCE')
+env.PCH(target = 'aaa', source = 'aaa.h')
+""" % python)
+
+test.write('aaa.h', "aaa.h\n/*pch*/\n")
+
+test.run(stdout = test.wrap_stdout("""\
+PCHing aaa.pch from aaa.h
+"""))
+
+test.must_match('aaa.pch', "aaa.h\n")
+
+
+
+test.pass_test()

File test/MSVC/RCCOM.py

View file
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Test the ability to configure the $RCCOM construction variable
+when using MSVC.
+"""
+
+import TestSCons
+
+python = TestSCons.python
+
+test = TestSCons.TestSCons()
+
+
+
+test.write('myrc.py', """
+import sys
+outfile = open(sys.argv[1], 'wb')
+for f in sys.argv[2:]:
+    infile = open(f, 'rb')
+    for l in filter(lambda l: l != '/*rc*/\\n', infile.readlines()):
+        outfile.write(l)
+sys.exit(0)
+""")
+
+test.write('SConstruct', """
+env = Environment(tools=['default', 'msvc'],
+                  RCCOM = r'%(python)s myrc.py $TARGET $SOURCES')
+env.RES(target = 'aaa', source = 'aaa.rc')
+""" % locals())
+
+test.write('aaa.rc', "aaa.rc\n/*rc*/\n")
+
+test.run(arguments = ".")
+
+test.must_match('aaa.res', "aaa.rc\n")
+
+
+
+test.pass_test()

File test/MSVC/RCCOMSTR.py

View file
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Test that the $RCCOMSTR construction variable allows you to customize
+the displayed string when rc is called.
+"""
+
+import TestSCons
+
+python = TestSCons.python
+
+test = TestSCons.TestSCons()
+
+
+
+test.write('myrc.py', """
+import sys
+outfile = open(sys.argv[1], 'wb')
+for f in sys.argv[2:]:
+    infile = open(f, 'rb')
+    for l in filter(lambda l: l != '/*rc*/\\n', infile.readlines()):
+        outfile.write(l)
+sys.exit(0)
+""")
+
+test.write('SConstruct', """
+env = Environment(tools=['default', 'msvc'],
+                  RCCOM = r'%(python)s myrc.py $TARGET $SOURCES',
+                  RCCOMSTR = 'RCing $TARGET from $SOURCE')
+env.RES(target = 'aaa', source = 'aaa.rc')
+""" % locals())
+
+test.write('aaa.rc', "aaa.rc\n/*rc*/\n")
+
+test.run(stdout = test.wrap_stdout("""\
+RCing aaa.res from aaa.rc
+"""))
+
+test.must_match('aaa.res', "aaa.rc\n")
+
+
+
+test.pass_test()

File test/MSVC/msvc.py

View file
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import TestSCons
+import sys
+import os.path
+import os
+import TestCmd
+import time
+
+test = TestSCons.TestSCons(match = TestCmd.match_re)
+
+if sys.platform != 'win32':
+    test.pass_test()
+
+#####
+# Test the basics
+
+test.write('SConstruct',"""
+env=Environment()
+env['PDB'] = File('test.pdb')
+env['PCHSTOP'] = 'StdAfx.h'
+env['PCH'] = env.PCH('StdAfx.cpp')[0]
+env.Program('test', ['test.cpp', env.RES('test.rc')], LIBS=['user32'])
+
+env.Object('fast', 'foo.cpp')
+env.Object('slow', 'foo.cpp', PCH=0)
+""")
+
+test.write('test.cpp', '''
+#include "StdAfx.h"
+#include "resource.h"
+
+int main(void) 
+{ 
+    char test[1024];
+    LoadString(GetModuleHandle(NULL), IDS_TEST, test, sizeof(test));
+    printf("%d %s\\n", IDS_TEST, test);
+    return 0;
+}
+''')
+
+test.write('test.rc', '''
+#include "resource.h"
+
+STRINGTABLE DISCARDABLE 
+BEGIN
+    IDS_TEST "test 1"
+END
+''')
+
+test.write('resource.h', '''
+#define IDS_TEST 2001
+''')
+
+
+test.write('foo.cpp', '''
+#include "StdAfx.h"
+''')
+
+test.write('StdAfx.h', '''
+#include <windows.h>
+#include <stdio.h>
+#include "resource.h"
+''')
+
+test.write('StdAfx.cpp', '''
+#include "StdAfx.h"
+''')
+
+test.run(arguments='test.exe')
+
+test.fail_test(not os.path.exists(test.workpath('test.exe')))
+test.fail_test(not os.path.exists(test.workpath('test.res')))
+test.fail_test(not os.path.exists(test.workpath('test.pdb')))
+test.fail_test(not os.path.exists(test.workpath('StdAfx.pch')))
+test.fail_test(not os.path.exists(test.workpath('StdAfx.obj')))
+
+test.run(program=test.workpath('test.exe'), stdout='2001 test 1\n')
+
+test.write('resource.h', '''
+#define IDS_TEST 2002
+''')
+test.run(arguments='test.exe')
+test.run(program=test.workpath('test.exe'), stdout='2002 test 1\n')
+
+test.write('test.rc', '''
+#include "resource.h"
+
+STRINGTABLE DISCARDABLE 
+BEGIN
+    IDS_TEST "test 2"
+END
+''')
+test.run(arguments='test.exe')
+test.run(program=test.workpath('test.exe'), stdout='2002 test 2\n')
+
+test.run(arguments='-c .')
+
+test.fail_test(os.path.exists(test.workpath('test.exe')))
+test.fail_test(os.path.exists(test.workpath('test.pdb')))
+test.fail_test(os.path.exists(test.workpath('test.res')))
+test.fail_test(os.path.exists(test.workpath('StdAfx.pch')))
+test.fail_test(os.path.exists(test.workpath('StdAfx.obj')))
+
+test.run(arguments='test.exe')
+
+test.fail_test(not os.path.exists(test.workpath('test.pdb')))
+test.fail_test(not os.path.exists(test.workpath('StdAfx.pch')))
+test.fail_test(not os.path.exists(test.workpath('StdAfx.obj')))
+
+test.run(arguments='-c test.pdb')
+test.fail_test(os.path.exists(test.workpath('test.exe')))
+test.fail_test(os.path.exists(test.workpath('test.obj')))
+test.fail_test(os.path.exists(test.workpath('test.pdb')))
+test.fail_test(os.path.exists(test.workpath('StdAfx.pch')))
+test.fail_test(os.path.exists(test.workpath('StdAfx.obj')))
+
+test.run(arguments='StdAfx.pch')
+
+test.fail_test(os.path.exists(test.workpath('test.pdb')))
+test.fail_test(not os.path.exists(test.workpath('StdAfx.pch')))
+test.fail_test(not os.path.exists(test.workpath('StdAfx.obj')))
+
+test.run(arguments='-c test.exe')
+test.fail_test(os.path.exists(test.workpath('test.exe')))
+test.fail_test(os.path.exists(test.workpath('test.obj')))
+test.fail_test(os.path.exists(test.workpath('test.pdb')))
+test.fail_test(os.path.exists(test.workpath('StdAfx.pch')))
+test.fail_test(os.path.exists(test.workpath('StdAfx.obj')))
+
+test.run(arguments='test.obj')
+test.fail_test(os.path.exists(test.workpath('test.pdb')))
+test.fail_test(not os.path.exists(test.workpath('test.obj')))
+
+
+start = time.time()
+test.run(arguments='fast.obj')
+fast = time.time() - start
+
+start = time.time()
+test.run(arguments='slow.obj')
+slow = time.time() - start
+
+# using precompiled headers should be significantly faster
+assert fast < slow*0.8
+
+# Modifying resource.h should cause both the resource and precompiled header to be rebuilt:
+test.write('resource.h', '''
+#define IDS_TEST 2003
+''')
+
+test.not_up_to_date(arguments='test.res')
+test.not_up_to_date(arguments='StdAfx.pch')
+test.not_up_to_date(arguments='test.exe')
+test.run(program=test.workpath('test.exe'), stdout='2003 test 2\n')
+
+
+##########
+# Test a hierarchical build
+
+test.subdir('src', 'build', 'out')
+
+test.write('SConstruct',"""
+BuildDir('build', 'src', duplicate=0)
+SConscript('build/SConscript')
+""")
+
+test.write('src/SConscript',"""
+env=Environment()
+env['PCH'] = 'StdAfx.pch'
+env['PDB'] = '#out/test.pdb'
+env['PCHSTOP'] = 'StdAfx.h'
+env.PCH('StdAfx.cpp')
+env.Program('#out/test.exe', 'test.cpp')
+""")
+
+test.write('src/test.cpp', '''
+#include "StdAfx.h"
+
+int main(void) 
+{ 
+    return 1;
+}
+''')
+
+test.write('src/StdAfx.h', '''
+#include <windows.h>
+''')
+
+test.write('src/StdAfx.cpp', '''
+#include "StdAfx.h"
+''')
+
+test.run(arguments='out')
+
+test.fail_test(not os.path.exists(test.workpath('out/test.pdb')))
+test.fail_test(not os.path.exists(test.workpath('build/StdAfx.pch')))
+test.fail_test(not os.path.exists(test.workpath('build/StdAfx.obj')))
+
+test.run(arguments='-c out')
+
+test.fail_test(os.path.exists(test.workpath('out/test.pdb')))
+test.fail_test(os.path.exists(test.workpath('build/StdAfx.pch')))
+test.fail_test(os.path.exists(test.workpath('build/StdAfx.obj'))) 
+
+#####
+# Test error reporting
+
+test.write('SConstruct',"""
+env=Environment()
+env['PDB'] = File('test.pdb')
+env['PCH'] = env.PCH('StdAfx.cpp')[0]
+env.Program('test', 'test.cpp')
+""")
+
+test.run(status=2, stderr='''
+scons: \*\*\* The PCHSTOP construction must be defined if PCH is defined.
+File "SConstruct", line 5, in \?
+''')
+
+test.write('SConstruct',"""
+env=Environment()
+env['PDB'] = File('test.pdb')
+env['PCHSTOP'] = File('StdAfx.h')
+env['PCH'] = env.PCH('StdAfx.cpp')[0]
+env.Program('test', 'test.cpp')
+""")
+
+test.run(status=2, stderr='''
+scons: \*\*\* The PCHSTOP construction variable must be a string: .+
+File "SConstruct", line 6, in \?
+''')
+
+test.pass_test()
+
+
+
+
+

File test/MinGW/RCCOM.py

View file
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Test the ability to configure the $RCCOM construction variable
+when using MinGW.
+"""
+
+import TestSCons
+
+python = TestSCons.python
+
+test = TestSCons.TestSCons()
+
+
+
+test.write('myrc.py', """
+import sys
+outfile = open(sys.argv[1], 'wb')
+for f in sys.argv[2:]:
+    infile = open(f, 'rb')
+    for l in filter(lambda l: l != '/*rc*/\\n', infile.readlines()):
+        outfile.write(l)
+sys.exit(0)
+""")
+
+test.write('SConstruct', """
+env = Environment(tools=['default', 'mingw'],
+                  RCCOM = r'%(python)s myrc.py $TARGET $SOURCES')
+env.RES(target = 'aaa', source = 'aaa.rc')
+""" % locals())
+
+test.write('aaa.rc', "aaa.rc\n/*rc*/\n")
+
+test.run(arguments = ".")
+
+test.must_match('aaa.o', "aaa.rc\n")
+
+
+
+test.pass_test()

File test/MinGW/RCCOMSTR.py

View file
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Test that the $RCCOMSTR construction variable allows you to customize
+the displayed string when rc is called.
+"""
+
+import TestSCons
+
+python = TestSCons.python
+
+test = TestSCons.TestSCons()
+
+
+
+test.write('myrc.py', """
+import sys
+outfile = open(sys.argv[1], 'wb')
+for f in sys.argv[2:]:
+    infile = open(f, 'rb')
+    for l in filter(lambda l: l != '/*rc*/\\n', infile.readlines()):
+        outfile.write(l)
+sys.exit(0)
+""")
+
+test.write('SConstruct', """
+env = Environment(tools=['default', 'mingw'],
+                  RCCOM = r'%(python)s myrc.py $TARGET $SOURCES',
+                  RCCOMSTR = 'RCing $TARGET from $SOURCE')
+env.RES(target = 'aaa', source = 'aaa.rc')
+""" % locals())
+
+test.write('aaa.rc', "aaa.rc\n/*rc*/\n")
+
+test.run(stdout = test.wrap_stdout("""\
+RCing aaa.o from aaa.rc
+"""))
+
+test.must_match('aaa.o', "aaa.rc\n")
+
+
+
+test.pass_test()

File test/QT.py

-#!/usr/bin/env python
-#
-# __COPYRIGHT__
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
-# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-
-"""
-Testing the 'qt' tool, i.e. support for .ui files and automatic
-generation of qt's moc files.
-"""
-
-import os.path
-import re
-import string
-
-import TestSCons
-
-python = TestSCons.python
-_exe = TestSCons._exe
-lib_ = TestSCons.lib_
-_lib = TestSCons._lib
-dll_ = TestSCons.dll_
-_dll = TestSCons._dll
-_shobj = TestSCons._shobj
-
-test = TestSCons.TestSCons()
-
-test.subdir( 'qt', ['qt', 'bin'], ['qt', 'include'], ['qt', 'lib'] )
-
-# create a dummy qt installation
-
-test.write(['qt', 'bin', 'mymoc.py'], """
-import getopt
-import sys
-import string
-import re
-cmd_opts, args = getopt.getopt(sys.argv[1:], 'io:', [])
-output = None
-impl = 0
-opt_string = ''
-for opt, arg in cmd_opts:
-    if opt == '-o': output = open(arg, 'wb')
-    elif opt == '-i': impl = 1
-    else: opt_string = opt_string + ' ' + opt
-for a in args:
-    contents = open(a, 'rb').read()
-    subst = r'{ my_qt_symbol( "' + a + '\\\\n" ); }'
-    if impl:
-        contents = re.sub( r'#include.*', '', contents )
-    output.write(string.replace(contents, 'Q_OBJECT', subst))
-output.close()
-sys.exit(0)
-""" )
-
-test.write(['qt', 'bin', 'myuic.py'], """
-import os.path
-import re
-import sys
-import string
-output_arg = 0
-impl_arg = 0
-impl = None
-source = None
-for arg in sys.argv[1:]:
-    if output_arg:
-        output = open(arg, 'wb')
-        output_arg = 0
-    elif impl_arg:
-        impl = arg
-        impl_arg = 0
-    elif arg == "-o":
-        output_arg = 1
-    elif arg == "-impl":
-        impl_arg = 1
-    else:
-        if source:
-            sys.exit(1)
-        source = open(arg, 'rb')
-        sourceFile = arg
-if impl:
-    output.write( '#include "' + impl + '"\\n' )
-    includes = re.findall('<include.*?>(.*?)</include>', source.read())
-    for incFile in includes:
-        # this is valid for ui.h files, at least
-        if os.path.exists(incFile):
-            output.write('#include "' + incFile + '"\\n')
-else:
-    output.write( '#include "my_qobject.h"\\n' + source.read() + " Q_OBJECT \\n" )
-output.close()
-sys.exit(0)
-""" )
-
-test.write(['qt', 'include', 'my_qobject.h'], r"""
-#define Q_OBJECT ;
-void my_qt_symbol(const char *arg);
-""")
-
-test.write(['qt', 'lib', 'my_qobject.cpp'], r"""
-#include "../include/my_qobject.h"
-#include <stdio.h>
-void my_qt_symbol(const char *arg) {
-  printf( arg );
-}
-""")
-
-test.write(['qt', 'lib', 'SConstruct'], r"""
-env = Environment()
-env.StaticLibrary( 'myqt', 'my_qobject.cpp' )
-""")
-
-test.run(chdir=test.workpath('qt','lib'), arguments = '.',
-         stderr=TestSCons.noisy_ar,
-         match=TestSCons.match_re_dotall)
-
-QT = test.workpath('qt')
-QT_LIB = 'myqt'
-QT_MOC = '%s %s' % (python, test.workpath('qt','bin','mymoc.py'))
-QT_UIC = '%s %s' % (python, test.workpath('qt','bin','myuic.py'))
-
-##############################################################################
-# Test cases with different operation modes
-
-def createSConstruct(test,place):
-    test.write(place, """
-if ARGUMENTS.get('noqtdir', 0): QTDIR=None
-else: QTDIR=r'%s'
-env = Environment(QTDIR = QTDIR,
-                  QT_LIB = r'%s',
-                  QT_MOC = r'%s',
-                  QT_UIC = r'%s',
-                  tools=['default','qt'])
-dup = 1
-if ARGUMENTS.get('build_dir', 0):
-    if ARGUMENTS.get('chdir', 0):
-        SConscriptChdir(1)
-    else:
-        SConscriptChdir(0)
-    dup=int(ARGUMENTS.get('dup', 1))
-    if dup == 0:
-        builddir = 'build_dup0'
-        env['QT_DEBUG'] = 1
-    else:
-        builddir = 'build'
-    BuildDir(builddir, '.', duplicate=dup)
-    print builddir, dup
-    sconscript = Dir(builddir).File('SConscript')
-else:
-    sconscript = File('SConscript')
-Export("env dup")
-SConscript( sconscript )
-""" % (QT, QT_LIB, QT_MOC, QT_UIC))
-
-test.subdir( 'work1', 'work2', 'work3', 'work4',
-             'work5', 'work6', 'work7', 'work8',
-             'work9', ['work9', 'local_include'],
-             'work10', ['work10', 'sub'], ['work10', 'sub', 'local_include'],
-             'work11', ['work11', 'include'], ['work11', 'ui'],
-             'work12')
-
-##############################################################################
-# 1. create a moc file from a header file.
-
-aaa_exe = 'aaa' + _exe
-moc = 'moc_aaa.cc'
-
-createSConstruct(test, ['work1', 'SConstruct'])
-test.write( ['work1', 'SConscript'], """
-Import("env")
-env.Program(target = 'aaa', source = 'aaa.cpp')
-""")
-
-test.write(['work1', 'aaa.cpp'], r"""
-#include "aaa.h"
-int main() { aaa(); return 0; }
-""")
-
-test.write(['work1', 'aaa.h'], r"""
-#include "my_qobject.h"
-void aaa(void) Q_OBJECT;
-""")
-
-test.run(chdir='work1', arguments = aaa_exe)
-test.up_to_date(chdir='work1', options = '-n', arguments=aaa_exe)
-
-test.up_to_date(chdir='work1', options = '-n', arguments = aaa_exe)
-test.write(['work1', 'aaa.h'], r"""
-/* a change */
-#include "my_qobject.h"
-void aaa(void) Q_OBJECT;
-""")
-test.not_up_to_date(chdir='work1', options='-n', arguments = moc)
-test.run(program = test.workpath('work1', aaa_exe), stdout = 'aaa.h\n')
-
-test.run(chdir='work1',
-         arguments = "build_dir=1 " +
-                     test.workpath('work1', 'build', aaa_exe) )
-test.run(chdir='work1',
-         arguments = "build_dir=1 chdir=1 " +
-                     test.workpath('work1', 'build', aaa_exe) )
-
-test.fail_test( not os.path.exists(test.workpath('work1', 'build', moc)) )
-
-test.run(chdir='work1',
-         arguments = "build_dir=1 chdir=1 dup=0 " +
-                     test.workpath('work1', 'build_dup0', aaa_exe) )
-test.must_exist(['work1', 'build_dup0', moc],
-                ['work1', 'build_dup0', aaa_exe])
-
-##############################################################################
-# 2. create .cpp, .h, moc_....cpp from .ui file
-
-aaa_dll = dll_ + 'aaa' + _dll
-moc = 'moc_aaa.cc'
-cpp = 'uic_aaa.cc'
-obj = os.path.splitext(cpp)[0] + _shobj
-h = 'aaa.h'
-
-createSConstruct(test, ['work2', 'SConstruct'])
-test.write(['work2', 'SConscript'], """
-Import("env dup")
-if dup == 0: env.Append(CPPPATH=['#', '.'])
-env.SharedLibrary(target = 'aaa', source = ['aaa.ui', 'useit.cpp'])
-""")
-
-test.write(['work2', 'aaa.ui'], r"""
-#if defined (_WIN32) || defined(__CYGWIN__)
-#define DLLEXPORT __declspec(dllexport)
-#else
-#define DLLEXPORT
-#endif
-DLLEXPORT void aaa(void)
-""")
-
-test.write(['work2', 'useit.cpp'], r"""
-#include "aaa.h"
-void useit() {
-  aaa();
-}
-""")
-
-test.run(chdir='work2', arguments = aaa_dll)
-test.up_to_date(chdir='work2', options='-n',arguments = aaa_dll)
-test.write(['work2', 'aaa.ui'], r"""
-/* a change */
-#if defined (_WIN32) || defined(__CYGWIN__)
-#define DLLEXPORT __declspec(dllexport)
-#else
-#define DLLEXPORT
-#endif
-DLLEXPORT void aaa(void)
-""")
-test.not_up_to_date(chdir='work2', options = '-n', arguments = moc)
-test.not_up_to_date(chdir='work2', options = '-n', arguments = cpp)
-test.not_up_to_date(chdir='work2', options = '-n', arguments = h)
-test.run(chdir='work2', arguments = aaa_dll)
-test.write(['work2', 'aaa.ui'], r"""
-void aaa(void)
-//<include>aaa.ui.h</include>
-""")
-test.run(chdir='work2', arguments = aaa_dll) # test that non-existant ui.h files are ignored (as uic does)
-test.write(['work2', 'aaa.ui.h'], r"""
-/* test dependency to .ui.h */