build_module(modulename=None,
source_directory=' . ' ,
code='
' ,
init_code='
' ,
additional_definitions='
' ,
additional_declarations='
' ,
sources=[ ] ,
wrap_headers=[ ] ,
local_headers=[ ] ,
system_headers=[ ] ,
include_dirs=[ ' . ' ] ,
library_dirs=[ ] ,
libraries=[ ] ,
swigargs=[ ' -c++ ' , ' -fcompact ' , ' -O ' , ' -I. ' , ' -small ' ] ,
cppargs=[ ' -O2 ' ] ,
lddargs=[ ] ,
object_files=[ ] ,
arrays=[ ] ,
generate_interface=True,
generate_setup=True,
signature=None,
cache_dir=None)
| source code
|
Generate and compile a module from C/C++ code using SWIG.
Arguments:
The keyword arguments are as follows:
-
modulename:
-
The name you want for the module. If specified, the module
will not be cached. If missing, a name will be constructed
based on a checksum of the other arguments, and the module will
be placed in the global cache. String.
-
source_directory:
-
The directory where used supplied files reside.
-
code:
-
A string containing C or C++ code to be compiled and
wrapped.
-
init_code:
-
Code that should be executed when the instant module is
imported.
-
additional_definitions:
-
A list of additional definitions (typically needed for
inheritance).
-
additional_declarations:
-
A list of additional declarations (typically needed for
inheritance).
-
sources:
-
A list of source files to compile and link with the
module.
-
wrap_headers:
-
A list of local header files that should be wrapped by
SWIG.
-
local_headers:
-
A list of local header files required to compile the wrapped
code.
-
system_headers:
-
A list of system header files required to compile the
wrapped code.
-
include_dirs:
-
A list of directories to search for header files.
-
library_dirs:
-
A list of directories to search for libraries
(
-l ).
-
libraries:
-
A list of libraries needed by the instant module.
-
swigargs:
-
List of arguments to swig, e.g.
["-lpointers.i"] to include the SWIG
pointers.i library.
-
cppargs:
-
List of arguments to the compiler, e.g.
["-D", "-U"] .
-
lddargs:
-
List of arguments to the linker, e.g.
["-D",
"-U"] .
-
object_files:
-
If you want to compile the files yourself. TODO: Not yet
supported.
-
arrays:
-
A list of the C arrays to be made from NumPy arrays. FIXME:
Describe this correctly. Tests pass arrays of arrays of
strings.
-
generate_interface:
-
A bool to indicate if you want to generate the interface
files.
-
generate_setup:
-
A bool to indicate if you want to generate the setup.py
file.
-
signature:
-
A signature string to identify the form instead of the
source code.
-
cache_dir:
-
A directory to look for cached modules and place new ones.
If missing, a default directory is used. Note that the module
will not be cached if
modulename is specified. The
cache directory should not be used for anything else.
|