Skip to content

aabellagm/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.

About

Modern CMake C++ SWIG Sample

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • CMake 26.8%
  • C++ 23.7%
  • Dockerfile 15.6%
  • Java 11.2%
  • SWIG 9.8%
  • Makefile 6.8%
  • Other 6.1%