Skip to content

Mizux/cmake-swig

Repository files navigation

OS C++ Python Java .NET
Linux Status Status Status Status
macOS Status Status Status Status
Windows Status Status Status Status

Build Status

Introduction

| Requirement | Codemap | Dependencies | Build | C++ | Swig | Python 3 | .Net Core | Java | CI | Appendices | License |

This is a complete example of how to create a Modern CMake C++ Project with the SWIG code generator to generate wrapper and package for Python, .Net and Java.

This project should run on GNU/Linux, MacOS and Windows.

You can find detailed documentation for C++, Swig, Python 3, .Net Core and Java.

note: You should read C++ and Swig first since since other languages are just swig generated wrappers from the C++.

Requirement

You'll need:

  • "CMake >= 3.18".
  • "Python >= 3.6" and python module 'pip' (ed "setuptools" and "wheel" will be auto installed on demand).

Codemap

The project layout is as follow:

Dependencies

To complexify a little, the CMake project is composed of three libraries (Foo, Bar and FooBar) with the following dependencies:

Foo:
Bar:
FooBar: PUBLIC Foo PRIVATE Bar

Build

To build the C++ project, as usual:

cmake -S. -Bbuild
cmake --build build

Appendices

Few links on the subject...

Resources

Project layout:

  • The Pitchfork Layout Revision 1 (cxx-pflR1)

CMake:

Python:

.Net:

Issues

Some issue related to this process

Misc

Image has been generated using plantuml:

plantuml -Tsvg docs/{file}.dot

So you can find the dot source files in docs.

License

Apache 2. See the LICENSE file for details.

Disclaimer

This is not an official Google product, it is just code that happens to be owned by Google.