summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Tool/swig.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2003-08-13 05:56:44 (GMT)
committerSteven Knight <knight@baldmt.com>2003-08-13 05:56:44 (GMT)
commit9509a572ba9977ab49d2fe19475a0f7034618ac6 (patch)
treece68c6b7f64299bf52db9ba18bb8a3f44e89774a /src/engine/SCons/Tool/swig.py
parent94b5aa145df7b763a262dd163203e20879f242f3 (diff)
downloadSCons-9509a572ba9977ab49d2fe19475a0f7034618ac6.zip
SCons-9509a572ba9977ab49d2fe19475a0f7034618ac6.tar.gz
SCons-9509a572ba9977ab49d2fe19475a0f7034618ac6.tar.bz2
Add SWIG support.
Diffstat (limited to 'src/engine/SCons/Tool/swig.py')
-rw-r--r--src/engine/SCons/Tool/swig.py65
1 files changed, 65 insertions, 0 deletions
diff --git a/src/engine/SCons/Tool/swig.py b/src/engine/SCons/Tool/swig.py
new file mode 100644
index 0000000..9dcfad4
--- /dev/null
+++ b/src/engine/SCons/Tool/swig.py
@@ -0,0 +1,65 @@
+"""SCons.Tool.swig
+
+Tool-specific initialization for swig.
+
+There normally shouldn't be any need to import this module directly.
+It will usually be imported through the generic SCons.Tool.Tool()
+selection method.
+
+"""
+
+#
+# __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.path
+import string
+
+import SCons.Defaults
+import SCons.Tool
+
+def swigSuffixEmitter(env, source):
+ if '-c++' in string.split(env.subst("$SWIGFLAGS")):
+ return '$SWIGCXXFILESUFFIX'
+ else:
+ return '$SWIGCFILESUFFIX'
+
+def generate(env):
+ """Add Builders and construction variables for swig to an Environment."""
+ c_file, cxx_file = SCons.Tool.createCFileBuilders(env)
+
+ c_file.suffix['.i'] = swigSuffixEmitter
+ cxx_file.suffix['.i'] = swigSuffixEmitter
+
+ c_file.add_action('.i', '$SWIGCOM')
+ cxx_file.add_action('.i', '$SWIGCOM')
+
+ env['SWIG'] = 'swig'
+ env['SWIGFLAGS'] = ''
+ env['SWIGCFILESUFFIX'] = '_wrap$CFILESUFFIX'
+ env['SWIGCXXFILESUFFIX'] = '_wrap$CXXFILESUFFIX'
+ env['SWIGCOM'] = '$SWIG $SWIGFLAGS -o $TARGET $SOURCES'
+
+def exists(env):
+ return env.Detect(['swig'])