http://scons.tigris.org/svn/scons/branches/core
........
r2885 | stevenknight | 2008-04-18 21:38:59 -0700 (Fri, 18 Apr 2008) | 2 lines
Update troubleshooting appendix for new Taskmaster output.
........
r2886 | bdbaddog | 2008-04-19 15:15:03 -0700 (Sat, 19 Apr 2008) | 5 lines
Fix infinite loop in Fortran tool initialization.
Bug 2017.
Steven fixed, I tested.
........
r2887 | garyo | 2008-04-20 17:44:46 -0700 (Sun, 20 Apr 2008) | 1 line
Added this in two sections; simple one when discussing simple builds, and an example in the VariantDir section showing how it still works there.
........
r2888 | stevenknight | 2008-04-20 21:33:01 -0700 (Sun, 20 Apr 2008) | 4 lines
Accomodate test/MSVC/msvc.py's reliance on the Windows Platform SDK
(for now) by making use of the user's %INCLUDE% and %LIB% variables.
Split some independent embedded subtests into their own test scripts.
........
r2889 | stevenknight | 2008-04-20 21:38:05 -0700 (Sun, 20 Apr 2008) | 2 lines
Windows portability fix (line endings).
........
r2890 | stevenknight | 2008-04-20 21:44:24 -0700 (Sun, 20 Apr 2008) | 2 lines
Update Windows portion of if:-elif: block for a variable name change.
........
r2891 | stevenknight | 2008-04-20 21:52:41 -0700 (Sun, 20 Apr 2008) | 3 lines
On Windows, escape backslashes on the --interactive command line input,
so people can build targets in other directories.
........
r2892 | stevenknight | 2008-04-20 21:56:50 -0700 (Sun, 20 Apr 2008) | 3 lines
Fix ripple effects on Windows from redefining how $CXXFLAGS gets
added to C++ command lines.
........
r2893 | stevenknight | 2008-04-20 22:04:50 -0700 (Sun, 20 Apr 2008) | 4 lines
Handle a ripple effect from redefining the file() and open() builtin
functions by explicitly restoring the originals whenever we reset
the global state between tests.
........
r2894 | stevenknight | 2008-04-20 23:17:23 -0700 (Sun, 20 Apr 2008) | 2 lines
Remove by-hand backslash escaping, now that --interactive mode is handling it.
........
r2895 | stevenknight | 2008-04-20 23:23:04 -0700 (Sun, 20 Apr 2008) | 2 lines
Mention the fix for the Fortran suffix out-of-memory bug
........
git-svn-id: http://scons.tigris.org/svn/scons/trunk@2896
fdb21ef1-2011-0410-befe-
b5e4ea1792b1
</section>
+ <section>
+ <title>Making a list of files with Glob()</title>
+
+ <para>
+
+ You can also use the Glob() function to find all files matching a
+ certain template, using standard the shell pattern matching
+ characters *, ?, and [abc] to match any of a, b, or c. [!abc] is
+ also supported, to match any character <emphasis>except</emphasis>
+ a, b, or c. This makes many multi-source-file builds quite easy:
+
+ </para>
+
+ <sconstruct>
+ Program('program', Glob('*.c'))
+ </sconstruct>
+
+ <para>
+
+ The SCons man page has more details on using Glob() with Variant
+ dirs and Repositories and returning strings rather than Nodes.
+
+ </section>
+
<section>
<title>Specifying Single Files Vs. Lists of Files</title>
</section>
+ <section>
+ <title>Making a list of files with Glob()</title>
+
+ <para>
+
+ You can also use the Glob() function to find all files matching a
+ certain template, using standard the shell pattern matching
+ characters *, ?, and [abc] to match any of a, b, or c. [!abc] is
+ also supported, to match any character <emphasis>except</emphasis>
+ a, b, or c. This makes many multi-source-file builds quite easy:
+
+ </para>
+
+ <programlisting>
+ Program('program', Glob('*.c'))
+ </programlisting>
+
+ <para>
+
+ The SCons man page has more details on using Glob() with Variant
+ dirs and Repositories and returning strings rather than Nodes.
+
+ </section>
+
<section>
<title>Specifying Single Files Vs. Lists of Files</title>
</section>
+ <section>
+ <title>Using Glob() with &VariantDir;</title>
+
+ <para>
+
+ The Glob() file name pattern matching function
+ works just as usual when using &VariantDir;.
+ For example, if the
+ <filename>src/SConscript</filename>
+ looks like this:
+
+ </para>
+
+ <scons_example name="example_glob_builddir_sconscript">
+ <file name="SConstruct">
+ VariantDir('build', 'src')
+ SConscript('build/SConscript')
+ </file>
+ <file name="src/SConscript" printme="1">
+ env = Environment()
+ env.Program('hello', Glob('*.c'))
+ </file>
+ <file name="src/f1.c">
+ #include "f2.h"
+ int main() { printf(f2()); }
+ </file>
+ <file name="src/f2.c">
+ const char * f2() { return("Hello, world!\n"); }
+ </file>
+ <file name="src/f2.h">
+ const char * f2();
+ </file>
+ </scons_example>
+
+ <para>
+
+ Then with the same &SConstruct; file as in the previous section,
+ and source files f1.c and f2.c in src, we would see the following
+ output:
+
+ </para>
+
+ <scons_output example="example_glob_builddir_sconscript">
+ <scons_output_command>ls src</scons_output_command>
+ <scons_output_command>scons -Q</scons_output_command>
+ <scons_output_command>ls build</scons_output_command>
+ </scons_output>
+
+ <para>
+
+ The Glob function returns Nodes in the build/ tree, as
+ you'd expect.
+
+ </para>
+
+ </section>
+
<!--
<section>
</section>
+ <section>
+ <title>Using Glob() with &VariantDir;</title>
+
+ <para>
+
+ The Glob() file name pattern matching function
+ works just as usual when using &VariantDir;.
+ For example, if the
+ <filename>src/SConscript</filename>
+ looks like this:
+
+ </para>
+
+ <programlisting>
+ env = Environment()
+ env.Program('hello', Glob('*.c'))
+ </programlisting>
+
+ <para>
+
+ Then with the same &SConstruct; file as in the previous section,
+ and source files f1.c and f2.c in src, we would see the following
+ output:
+
+ </para>
+
+ <screen>
+ % <userinput>ls src</userinput>
+ SConscript f1.c f2.c f2.h
+ % <userinput>scons -Q</userinput>
+ cc -o build/f1.o -c build/f1.c
+ cc -o build/f2.o -c build/f2.c
+ cc -o build/hello build/f1.o build/f2.o
+ % <userinput>ls build</userinput>
+ SConscript f1.c f1.o f2.c f2.h f2.o hello
+ </screen>
+
+ <para>
+
+ The Glob function returns Nodes in the build/ tree, as
+ you'd expect.
+
+ </para>
+
+ </section>
+
<!--
<section>
% <userinput>scons -Q --debug=stacktrace</userinput>
scons: *** Source `prog.c' not found, needed by target `prog.o'. Stop.
scons: internal stack trace:
- File "bootstrap/src/engine/SCons/Job.py", line 131, in start
+ File "bootstrap/src/engine/SCons/Job.py", line 187, in start
File "bootstrap/src/engine/SCons/Script/Main.py", line 169, in prepare
- File "bootstrap/src/engine/SCons/Taskmaster.py", line 169, in prepare
- File "bootstrap/src/engine/SCons/Node/FS.py", line 2551, in prepare
- File "bootstrap/src/engine/SCons/Node/__init__.py", line 349, in prepare
+ File "bootstrap/src/engine/SCons/Taskmaster.py", line 184, in prepare
+ File "bootstrap/src/engine/SCons/Executor.py", line 171, in prepare
</screen>
<para>
<screen>
% <userinput>scons -Q --taskmastertrace=- prog</userinput>
- Taskmaster: 'prog': children:
- ['prog.o']
- waiting on unfinished children:
- ['prog.o']
- Taskmaster: 'prog.o': children:
- ['inc.h', 'prog.c']
- waiting on unfinished children:
- ['inc.h', 'prog.c']
- Taskmaster: 'prog.c': evaluating prog.c
- Taskmaster: 'inc.h': evaluating inc.h
- Taskmaster: 'prog.o': children:
- ['inc.h', 'prog.c']
- evaluating prog.o
+
+ Taskmaster: Looking for a node to evaluate
+ Taskmaster: Considering node <no_state 'prog'> and its children:
+ Taskmaster: <no_state 'prog.o'>
+ Taskmaster: Considering node <no_state 'prog.o'> and its children:
+ Taskmaster: <no_state 'prog.c'>
+ Taskmaster: <no_state 'inc.h'>
+ Taskmaster: Considering node <no_state 'prog.c'> and its children:
+ Taskmaster: Evaluating <pending 'prog.c'>
+
+ Taskmaster: Looking for a node to evaluate
+ Taskmaster: Considering node <no_state 'inc.h'> and its children:
+ Taskmaster: Evaluating <pending 'inc.h'>
+
+ Taskmaster: Looking for a node to evaluate
+ Taskmaster: Considering node <pending 'prog.o'> and its children:
+ Taskmaster: <up_to_date 'prog.c'>
+ Taskmaster: <up_to_date 'inc.h'>
+ Taskmaster: Evaluating <pending 'prog.o'>
cc -o prog.o -c -I. prog.c
- Taskmaster: 'prog': children:
- ['prog.o']
- evaluating prog
+
+ Taskmaster: Looking for a node to evaluate
+ Taskmaster: Considering node <pending 'prog'> and its children:
+ Taskmaster: <executed 'prog.o'>
+ Taskmaster: Evaluating <pending 'prog'>
cc -o prog prog.o
+
+ Taskmaster: Looking for a node to evaluate
+ Taskmaster: No candidate anymore.
</screen>
<para>
+RELEASE 0.98.2 - XXX
+
+ From Steven Knight:
+
+ - Fix a bug in Fortran suffix computation that would cause SCons to
+ run out of memory on Windows systems.
+
+ - Fix being able to specify --interactive mode command lines with
+ \ (backslash) path name separators on Windows.
+
+
+
RELEASE 0.98.1 - Fri, 18 Apr 2008 19:11:58 -0700
From Benoit Belley:
# NT treats execs of directories and non-executable files
# as "file not found" errors
expect_nonexistent = 1
- expect_nonexecutable = 1
+ expect_nonexecutable_file = 1
+ expect_nonexecutable_dir = 1
elif sys.platform == 'cygwin':
expect_nonexistent = 127
# Newer cygwin seems to return 126 for following
if self.scons_env['CXX'] == 'g++':
global existing_lib
existing_lib = 'm'
-
+
+ if sys.platform in ['cygwin', 'win32']:
+ # On Windows, SCons.Platform.win32 redefines the builtin
+ # file() and open() functions to close the file handles.
+ # This interferes with the unittest.py infrastructure in
+ # some way. Just sidestep the issue by restoring the
+ # original builtin functions whenever we have to reset
+ # all of our global state.
+
+ import __builtin__
+ import SCons.Platform.win32
+
+ __builtin__.file = SCons.Platform.win32._builtin_file
+ __builtin__.open = SCons.Platform.win32._builtin_open
+
def _baseTryXXX(self, TryFunc):
# TryCompile and TryLink are much the same, so we can test them
# in one method, we pass the function as a string ('TryCompile',
line = 'shell ' + line[1:]
elif line[0] == '?':
line = 'help ' + line[1:]
+ if os.sep == '\\':
+ line = string.replace(line, '\\', '\\\\')
argv = shlex.split(line)
argv[0] = self.synonyms.get(argv[0], argv[0])
if not argv[0]:
assert len(suffixes) > 0
s = suffixes[0]
sup = string.upper(s)
+ upper_suffixes = map(string.upper, suffixes)
if SCons.Util.case_sensitive_suffixes(s, sup):
- for i in suffixes:
- ppsuffixes.append(string.upper(i))
+ ppsuffixes.extend(upper_suffixes)
else:
- for i in suffixes:
- suffixes.append(string.upper(i))
+ suffixes.extend(upper_suffixes)
def CreateDialectActions(dialect):
"""Create dialect specific actions."""
test = TestSCons.TestSCons()
test.write('SConstruct', """
-foo = Environment(CCFLAGS = '-DFOO', CXXFLAGS = '-DCXX')
-bar = Environment(CCFLAGS = '-DBAR', CXXFLAGS = '-DCXX')
+foo = Environment()
+foo.Append(CCFLAGS = '-DFOO', CXXFLAGS = '-DCXX')
+bar = Environment()
+bar.Append(CCFLAGS = '-DBAR', CXXFLAGS = '-DCXX')
foo_obj = foo.Object(target = 'foo', source = 'prog.cpp')
bar_obj = bar.Object(target = 'bar', source = 'prog.cpp')
foo.Program(target = 'foo', source = foo_obj)
check(['all', '1', 'gl ical qt x11', 'gl ical qt x11',
"['gl ical qt x11']"])
-test.must_match(test.workpath('scons.options'),
- "shared = 'all'"+os.linesep,
- mode='r')
+test.must_match(test.workpath('scons.options'), "shared = 'all'"+os.linesep)
check(['all', '1', 'gl ical qt x11', 'gl ical qt x11',
"['gl ical qt x11']"])
""")
foo_exe = test.workpath('foo' + TestSCons._exe)
-_foo_exe_ = '"%s"' % string.replace(foo_exe, '\\', '\\\\')
# Start scons, to build "foo"
scons = test.start(arguments = '--interactive')
-scons.send("build %(_foo_exe_)s 1\n" % locals())
+scons.send("build %(foo_exe)s 1\n" % locals())
test.wait_for(test.workpath('1'), popen=scons)
}
""")
-scons.send("build %(_foo_exe_)s 2\n" % locals())
+scons.send("build %(foo_exe)s 2\n" % locals())
test.wait_for(test.workpath('2'))
-scons.send("build %(_foo_exe_)s 3\n" % locals())
+scons.send("build %(foo_exe)s 3\n" % locals())
test.wait_for(test.workpath('3'))
--- /dev/null
+#!/usr/bin/env python\r
+#\r
+# __COPYRIGHT__\r
+#\r
+# Permission is hereby granted, free of charge, to any person obtaining\r
+# a copy of this software and associated documentation files (the\r
+# "Software"), to deal in the Software without restriction, including\r
+# without limitation the rights to use, copy, modify, merge, publish,\r
+# distribute, sublicense, and/or sell copies of the Software, and to\r
+# permit persons to whom the Software is furnished to do so, subject to\r
+# the following conditions:\r
+#\r
+# The above copyright notice and this permission notice shall be included\r
+# in all copies or substantial portions of the Software.\r
+#\r
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY\r
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE\r
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+#\r
+\r
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"\r
+\r
+"""\r
+# Test error reporting\r
+"""\r
+\r
+import re\r
+import sys\r
+\r
+import TestSCons\r
+\r
+test = TestSCons.TestSCons(match = TestSCons.match_re)\r
+\r
+if sys.platform != 'win32':\r
+ msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform\r
+ test.skip_test(msg)\r
+\r
+\r
+\r
+SConstruct_path = test.workpath('SConstruct')\r
+\r
+test.write(SConstruct_path, """\\r
+env = Environment()\r
+env['PDB'] = File('test.pdb')\r
+env['PCH'] = env.PCH('StdAfx.cpp')[0]\r
+if int(ARGUMENTS.get('SET_PCHSTOP')):\r
+ env['PCHSTOP'] = File('StdAfx.h')\r
+env.Program('test', 'test.cpp')\r
+""")\r
+\r
+\r
+\r
+expect_stderr = r'''\r
+scons: \*\*\* The PCHSTOP construction must be defined if PCH is defined.\r
+File "%s", line \d+, in \?\r
+''' % re.escape(SConstruct_path)\r
+\r
+test.run(arguments='SET_PCHSTOP=0', status=2, stderr=expect_stderr)\r
+\r
+\r
+\r
+expect_stderr = r'''\r
+scons: \*\*\* The PCHSTOP construction variable must be a string: .+\r
+File "%s", line \d+, in \?\r
+''' % re.escape(SConstruct_path)\r
+\r
+test.run(arguments='SET_PCHSTOP=1', status=2, stderr=expect_stderr)\r
+\r
+\r
+\r
+test.pass_test()\r
--- /dev/null
+#!/usr/bin/env python\r
+#\r
+# __COPYRIGHT__\r
+#\r
+# Permission is hereby granted, free of charge, to any person obtaining\r
+# a copy of this software and associated documentation files (the\r
+# "Software"), to deal in the Software without restriction, including\r
+# without limitation the rights to use, copy, modify, merge, publish,\r
+# distribute, sublicense, and/or sell copies of the Software, and to\r
+# permit persons to whom the Software is furnished to do so, subject to\r
+# the following conditions:\r
+#\r
+# The above copyright notice and this permission notice shall be included\r
+# in all copies or substantial portions of the Software.\r
+#\r
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY\r
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE\r
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+#\r
+\r
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"\r
+\r
+"""\r
+Verify use of Visual Studio with a hierarchical build.\r
+"""\r
+\r
+import sys\r
+\r
+import TestSCons\r
+\r
+test = TestSCons.TestSCons(match = TestSCons.match_re)\r
+\r
+if sys.platform != 'win32':\r
+ msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform\r
+ test.skip_test(msg)\r
+\r
+\r
+\r
+test.subdir('src', 'build', 'out')\r
+\r
+test.write('SConstruct', """\r
+VariantDir('build', 'src', duplicate=0)\r
+SConscript('build/SConscript')\r
+""")\r
+\r
+test.write('src/SConscript',"""\r
+import os\r
+env = Environment()\r
+env.Append(CPPPATH=os.environ['INCLUDE'],\r
+ LIBPATH=os.environ['LIB'])\r
+env['PCH'] = 'StdAfx.pch'\r
+env['PDB'] = '#out/test.pdb'\r
+env['PCHSTOP'] = 'StdAfx.h'\r
+env.PCH('StdAfx.cpp')\r
+env.Program('#out/test.exe', 'test.cpp')\r
+""")\r
+\r
+test.write('src/test.cpp', '''\r
+#include "StdAfx.h"\r
+\r
+int main(void) \r
+{ \r
+ return 1;\r
+}\r
+''')\r
+\r
+test.write('src/StdAfx.h', '''\r
+#include <windows.h>\r
+''')\r
+\r
+test.write('src/StdAfx.cpp', '''\r
+#include "StdAfx.h"\r
+''')\r
+\r
+test.run(arguments='out', stderr=None)\r
+\r
+test.must_exist(test.workpath('out/test.pdb'))\r
+test.must_exist(test.workpath('build/StdAfx.pch'))\r
+test.must_exist(test.workpath('build/StdAfx.obj'))\r
+\r
+test.run(arguments='-c out')\r
+\r
+test.must_not_exist(test.workpath('out/test.pdb'))\r
+test.must_not_exist(test.workpath('build/StdAfx.pch'))\r
+test.must_not_exist(test.workpath('build/StdAfx.obj'))\r
+\r
+\r
+\r
+test.pass_test()\r
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import os.path
import re
import sys
import time
-import TestCmd
import TestSCons
-test = TestSCons.TestSCons(match = TestCmd.match_re)
+test = TestSCons.TestSCons(match = TestSCons.match_re)
if sys.platform != 'win32':
msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform
# Test the basics
test.write('SConstruct',"""
-env=Environment()
+import os
+env = Environment()
+env.Append(CPPPATH=os.environ['INCLUDE'],
+ LIBPATH=os.environ['LIB'])
env['PDB'] = File('test.pdb')
env['PCHSTOP'] = 'StdAfx.h'
env['PCH'] = env.PCH('StdAfx.cpp')[0]
test.run(program=test.workpath('test.exe'), stdout='2003 test 2\n')
-##########
-# Test a hierarchical build
-
-test.subdir('src', 'build', 'out')
-
-test.write('SConstruct',"""
-VariantDir('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', stderr=None)
-
-test.must_exist(test.workpath('out/test.pdb'))
-test.must_exist(test.workpath('build/StdAfx.pch'))
-test.must_exist(test.workpath('build/StdAfx.obj'))
-
-test.run(arguments='-c out')
-
-test.must_not_exist(test.workpath('out/test.pdb'))
-test.must_not_exist(test.workpath('build/StdAfx.pch'))
-test.must_not_exist(test.workpath('build/StdAfx.obj'))
-
-#####
-# Test error reporting
-
-SConstruct_path = test.workpath('SConstruct')
-
-test.write(SConstruct_path, """\
-env = Environment()
-env['PDB'] = File('test.pdb')
-env['PCH'] = env.PCH('StdAfx.cpp')[0]
-env.Program('test', 'test.cpp')
-""")
-
-expect_stderr = r'''
-scons: \*\*\* The PCHSTOP construction must be defined if PCH is defined.
-File "%s", line 4, in \?
-''' % re.escape(SConstruct_path)
-
-test.run(status=2, stderr=expect_stderr)
-
-test.write(SConstruct_path, """\
-env = Environment()
-env['PDB'] = File('test.pdb')
-env['PCHSTOP'] = File('StdAfx.h')
-env['PCH'] = env.PCH('StdAfx.cpp')[0]
-env.Program('test', 'test.cpp')
-""")
-
-expect_stderr = r'''
-scons: \*\*\* The PCHSTOP construction variable must be a string: .+
-File "%s", line 5, in \?
-''' % re.escape(SConstruct_path)
-
-test.run(status=2, stderr=expect_stderr)
test.pass_test()
-
-
-
-
-
test = TestSCons.TestSCons()
-e = test.Environment()
-fooflags = e['SHCXXFLAGS'] + ' -DFOO'
-barflags = e['SHCXXFLAGS'] + ' -DBAR'
-
test.subdir('bld', 'src', ['src', 'subsrcdir'])
sconstruct = r"""
-foo = Environment(SHOBJPREFIX='', SHCXXFLAGS = '%(fooflags)s', WINDOWS_INSERT_DEF=1)
-bar = Environment(SHOBJPREFIX='', SHCXXFLAGS = '%(barflags)s', WINDOWS_INSERT_DEF=1)
+foo = Environment(SHOBJPREFIX='', WINDOWS_INSERT_DEF=1)
+foo.Append(SHCXXFLAGS = '-DFOO')
+bar = Environment(SHOBJPREFIX='', WINDOWS_INSERT_DEF=1)
+bar.Append(SHCXXFLAGS = '-DBAR')
src = Dir('src')
VariantDir('bld', src, duplicate=1)
Nodes=[]
goo_obj = gooMain.Object(target='goomain', source='main.c')
gooMain.Program(target='gooprog', source=goo_obj)
"""
-
test.write('foo.def', r"""
LIBRARY "foo"
-DESCRIPTION "Foo Shared Library"
EXPORTS
doIt
test.write('bar.def', r"""
LIBRARY "bar"
-DESCRIPTION "Bar Shared Library"
EXPORTS
doIt
import sys
sys.stderr.write('VariantDir exists() population did not occur! (%%s:%%s,%%s,%%s)\n'%%(str(node),before,via_node,after))
sys.exit(-2)
-
-goo = Environment(CPPFLAGS = '%(fooflags)s')
+
+goo = Environment()
+goo.Append(CFLAGS = '-DFOO')
goof_in = File('goof.in')
if %(_E)s:
exists_test(goof_in)
""")
test.write('main.c', r"""
-
void doIt();
int
testObject(test, 'cppfile2.o', 'g++ -c')
testObject(test, 'cfile1.os', 'gcc -c' + c_fpic)
testObject(test, 'cfile2.os', 'gcc -c' + c_fpic)
-testObject(test, 'cppfile1.os', 'g++ -c -fPIC')
-testObject(test, 'cppfile2.os', 'g++ -c -fPIC')
+testObject(test, 'cppfile1.os', 'g++ -c' + c_fpic)
+testObject(test, 'cppfile2.os', 'g++ -c' + c_fpic)
testObject(test, 'c-only' + _exe, 'gcc')
testObject(test, 'cpp-only' + _exe, 'g++')
testObject(test, 'c-and-cpp' + _exe, 'g++')