https://github.com/danielunderwood/swig-example
An example for using CMake with the SWIG code generator
https://github.com/danielunderwood/swig-example
cpp python swig swig-binding
Last synced: 7 days ago
JSON representation
An example for using CMake with the SWIG code generator
- Host: GitHub
- URL: https://github.com/danielunderwood/swig-example
- Owner: danielunderwood
- License: apache-2.0
- Created: 2016-12-12T00:29:44.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-06-16T01:37:33.000Z (almost 5 years ago)
- Last Synced: 2026-03-29T19:11:02.313Z (3 months ago)
- Topics: cpp, python, swig, swig-binding
- Language: CMake
- Homepage:
- Size: 50.8 KB
- Stars: 49
- Watchers: 4
- Forks: 10
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SWIG Example
This is an example of how to use CMake with the [SWIG](http://www.swig.org) interface generator. It is meant for those
interested to use as a guide to setting up a project built by CMake with interfaces in other languages generated by
SWIG.
## Getting Started
### Docker
If you have docker installed, the following should get you started with a sample environment
```shell
$ docker build -t swig-example .
$ docker run --name swig-example -it swig-example
$ # Now in container
# python swig/python/test.py
```
### Local Build
To build locally, the following should be installed:
- cmake
- swig
- python Headers (python-dev for debian-based systems)
It can then be built and run with
```shell
$ # Build libraries
$ mkdir build && cd build
$ cmake ..
$ make -j4
$ # Note that this currently installs in /usr/lib, which isn't ideal
$ make install
$ make install-python
$ # Go back to root dir to run
$ cd ..
$ python swig/python/test.sh
```
## Languages
This example currently generates interfaces for the following languages:
* Python
I will add languages as I need to use them. Anyone that wishes to add another language, feel free to open a pull request
and let me know if there are any issues with using the installation procedure described below with your language.