Difference between revisions of "Swig"

From PLplotWiki
Jump to: navigation, search
(Added instructions for Mac OS X)
m (Instructions for Mac OS X)
Line 5: Line 5:
 
== Instructions for Mac OS X ==
 
== Instructions for Mac OS X ==
  
* The swig executable which is provided by Apple (''/usr/bin/swig'', version 1.3.31) is too old, at least for the [[lua Lua]] bindings. For Python and Java there is maybe no need to install a new version of swig.
+
* The SWIG executable which is provided by Apple (''/usr/bin/swig'', version 1.3.31) is too old, at least for the [[lua Lua]] bindings. For Python and Java there is maybe no need to install a new version of swig.
 
* Download [http://downloads.sourceforge.net/project/swig/swig/swig-1.3.40/swig-1.3.40.tar.gz SWIG 1.3.40 tar file]
 
* Download [http://downloads.sourceforge.net/project/swig/swig/swig-1.3.40/swig-1.3.40.tar.gz SWIG 1.3.40 tar file]
 
* Untar ''swig-1.3.40.tar.gz'' into a folder of your choice
 
* Untar ''swig-1.3.40.tar.gz'' into a folder of your choice
Line 17: Line 17:
 
  # add swig to PATH
 
  # add swig to PATH
 
  export PATH=$HOME/local/swig-1.3.40/bin:$PATH
 
  export PATH=$HOME/local/swig-1.3.40/bin:$PATH
 
  
 
== Instructions for Linux ==
 
== Instructions for Linux ==

Revision as of 01:38, 19 August 2009

Description

SWIG is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages. SWIG is used with different types of languages including common scripting languages such as Perl, PHP, Python, Tcl and Ruby.

Instructions for Mac OS X

  • The SWIG executable which is provided by Apple (/usr/bin/swig, version 1.3.31) is too old, at least for the lua Lua bindings. For Python and Java there is maybe no need to install a new version of swig.
  • Download SWIG 1.3.40 tar file
  • Untar swig-1.3.40.tar.gz into a folder of your choice
  • Cd into the folder and create a build folder
mkdir build
cd build
  • Configure, build and install SWIG. Omit the --prefix flag if you intend to install swig in the standard path (/usr/local)
./configure --prefix=$HOME/local/swig-1.3.40
make && make install
  • If you installed SWIG to a nonstandard location add the bin directory to the path by editing your .profile file in your home directory. Add the following lines
# add swig to PATH
export PATH=$HOME/local/swig-1.3.40/bin:$PATH

Instructions for Linux

N/A

Instructions for Windows

  • Download SWIG zip
  • Unzip swigwin-1.3.36.zip into a folder of your choice

Set CMake paths

  • set environment variables (for MinGW and Visual C++) and add SWIG directory to PATH
set SWIGDIR=C:\tools\swigwin-1.3.36
set PATH=%SWIGDIR%;%PATH%
set CMAKE_INCLUDE_PATH=%SWIGDIR%\lib;%CMAKE_INCLUDE_PATH%

CMake is now able to find SWIG.