Skip to content
oliver---- edited this page Nov 23, 2012 · 10 revisions

Welcome to the swig-v8 wiki!

FAQ

1.How do I configure it properly? I get ":3. Unable to find 'javascript.swg'"

Build and Configure

> git clone git://github.com/oliver----/swig-v8.git
> cd swig-v8
> ./autogen.sh
> ./configure
> make

To set a default js engine for examples and test-suite:

> ./configure JSDEFAULT=jsc

or

> ./configure JSDEFAULT=v8

To get a debuggable version you have to run make commands this way:

> make CFLAGS="-g -O0" CXXFLAGS="-g -O0" <target>

Running examples:

You have to build the javascript interpreter, only once

> cd Examples
> make javascript_exe

To run an example:

> cd Examples/javascript/class
> make check

You can override the default engine here, e.g.,

> make V8=1 check

Running the test-suite:

(run from root source directory)

> make check-javascript-test-suite

Again, argument V8=1 or JSC=1 will override the default engine.

Using the executable

To use swig for your custom projects you can use a pre-install executable within the source root

preinst-swig -javascript -jsc <-c++> ...

or for JSC

preinst-swig -javascript -v8 <-c++> ...

This takes the Lib files from the source directory. preinst-swig is not debuggable. For that you need to run the (debuggable version) of swig executable built into root of source tree. Here you have to specify manually where to find the swig library folder

> swig -I<path-to-swig-v8>/Lib -I<path-to-swig-v8>/Lib/javascript/v8 -javascript -v8 <-c++> ...

or for JSC:

> swig -I<path-to-swig-v8>/Lib -I<path-to-swig-v8>/Lib/javascript/jsc -javascript -jsc <-c++> ...