summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2002-07-10 22:39:00 (GMT)
committerSteven Knight <knight@baldmt.com>2002-07-10 22:39:00 (GMT)
commitf98a2dabc8603592c74f02674a8dc551533382b6 (patch)
tree343c9712c76d4e3d5de04ae50a92d65abe2be90e /src
parent3de3284918acb0add37b818400c1a7309a3316ff (diff)
downloadSCons-f98a2dabc8603592c74f02674a8dc551533382b6.zip
SCons-f98a2dabc8603592c74f02674a8dc551533382b6.tar.gz
SCons-f98a2dabc8603592c74f02674a8dc551533382b6.tar.bz2
Allow build directories outside the SConstruct tree; add a FindFile() function to search for files with a specified name; add to the shared-object g++ and gcc command lines. (Charles Crain)
Diffstat (limited to 'src')
-rw-r--r--src/CHANGES.txt7
-rw-r--r--src/engine/SCons/Node/FS.py4
-rw-r--r--src/engine/SCons/Node/FSTests.py16
-rw-r--r--src/engine/SCons/Script/SConscript.py5
-rw-r--r--src/engine/SCons/Tool/g++.py2
-rw-r--r--src/engine/SCons/Tool/gcc.py2
6 files changed, 24 insertions, 12 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index 157cb11..45a6517 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -40,6 +40,13 @@ RELEASE 0.08 -
- Fix handling file names with multiple dots.
+ - Allow a build directory to be outside of the SConstruct tree.
+
+ - Add a FindFile() function that searches for a file node with a
+ specified name.
+
+ - Add $CPPFLAGS to the shared-object command lines for g++ and gcc.
+
From Charles Crain and Steven Knight:
- Add a "tools=" keyword argument to Environment instantiation,
diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py
index a047903..771ac56 100644
--- a/src/engine/SCons/Node/FS.py
+++ b/src/engine/SCons/Node/FS.py
@@ -289,8 +289,8 @@ class FS:
if not isinstance(build_dir, SCons.Node.Node):
build_dir = self.Dir(build_dir)
build_dir.duplicate = duplicate
- if not src_dir.is_under(self.Top) or not build_dir.is_under(self.Top):
- raise UserError, "Both source and build directories must be under top of build tree."
+ if not src_dir.is_under(self.Top):
+ raise UserError, "Source directory must be under top of build tree."
if src_dir.is_under(build_dir):
raise UserError, "Source directory cannot be under build directory."
build_dir.link(src_dir, duplicate)
diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py
index 6151f2d..1ae1215 100644
--- a/src/engine/SCons/Node/FSTests.py
+++ b/src/engine/SCons/Node/FSTests.py
@@ -95,6 +95,14 @@ class BuildDirTestCase(unittest.TestCase):
assert f2.srcpath == os.path.normpath('src/test1'), f2.srcpath
fs = SCons.Node.FS.FS()
+ fs.BuildDir('../var1', 'src')
+ fs.BuildDir('../var2', 'src')
+ f1 = fs.File('../var1/test1')
+ f2 = fs.File('../var2/test1')
+ assert f1.srcpath == os.path.normpath('src/test1'), f1.srcpath
+ assert f2.srcpath == os.path.normpath('src/test1'), f2.srcpath
+
+ fs = SCons.Node.FS.FS()
fs.BuildDir('build/var1', 'src', duplicate=0)
fs.BuildDir('build/var2', 'src')
f1 = fs.File('build/var1/test1')
@@ -129,14 +137,6 @@ class BuildDirTestCase(unittest.TestCase):
exc_caught = 0
try:
fs = SCons.Node.FS.FS()
- fs.BuildDir('/test/foo', '.')
- except UserError:
- exc_caught = 1
- assert exc_caught, "Should have caught a UserError."
-
- exc_caught = 0
- try:
- fs = SCons.Node.FS.FS()
fs.BuildDir('build', '/test/foo')
except UserError:
exc_caught = 1
diff --git a/src/engine/SCons/Script/SConscript.py b/src/engine/SCons/Script/SConscript.py
index 7ae7f21..0f65732 100644
--- a/src/engine/SCons/Script/SConscript.py
+++ b/src/engine/SCons/Script/SConscript.py
@@ -220,6 +220,10 @@ def GetBuildPath(files):
return ret[0]
return ret
+def FindFile(file, dirs):
+ nodes = SCons.Node.arg2nodes(dirs, SCons.Node.FS.default_fs.Dir)
+ return SCons.Node.FS.find_file(file, nodes)
+
def Export(*vars):
try:
for var in vars:
@@ -256,6 +260,7 @@ def BuildDefaultGlobals():
globals['Environment'] = SCons.Environment.Environment
globals['Export'] = Export
globals['File'] = SCons.Node.FS.default_fs.File
+ globals['FindFile'] = FindFile
globals['GetBuildPath'] = GetBuildPath
globals['GetCommandHandler'] = SCons.Action.GetCommandHandler
globals['Help'] = Help
diff --git a/src/engine/SCons/Tool/g++.py b/src/engine/SCons/Tool/g++.py
index a903b0a..f631b0b 100644
--- a/src/engine/SCons/Tool/g++.py
+++ b/src/engine/SCons/Tool/g++.py
@@ -55,7 +55,7 @@ def generate(env, platform):
env['CXXCOM'] = '$CXX $CXXFLAGS $CPPFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES'
env['SHCXX'] = '$CXX'
env['SHCXXFLAGS'] = '$CXXFLAGS -fPIC'
- env['SHCXXCOM'] = '$SHCXX $SHCXXFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES'
+ env['SHCXXCOM'] = '$SHCXX $SHCXXFLAGS $CPPFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES'
env['INCPREFIX'] = '-I'
env['INCSUFFIX'] = ''
diff --git a/src/engine/SCons/Tool/gcc.py b/src/engine/SCons/Tool/gcc.py
index c5a1e91..d767b21 100644
--- a/src/engine/SCons/Tool/gcc.py
+++ b/src/engine/SCons/Tool/gcc.py
@@ -55,7 +55,7 @@ def generate(env, platform):
env['CCCOM'] = '$CC $CCFLAGS $CPPFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES'
env['SHCC'] = '$CC'
env['SHCCFLAGS'] = '$CCFLAGS -fPIC'
- env['SHCCCOM'] = '$SHCC $SHCCFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES'
+ env['SHCCCOM'] = '$SHCC $SHCCFLAGS $CPPFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES'
env['INCPREFIX'] = '-I'
env['INCSUFFIX'] = ''