Example pybind11 module built with a CMake-based build system
Find a file
Dean Moldovan 0a8d583cd0 Improve CI tests
- Test sdist package on all platforms
- Include Python 2.7 and 32-bit versions on Windows
2016-06-05 13:30:17 +02:00
conda.recipe Add conda recipe 2016-06-03 09:30:23 -04:00
pybind11@19d95ef09a Update readme and remove old license 2016-06-05 13:26:26 +02:00
src Initial commit 2016-05-23 00:22:06 +02:00
tests Improve CI tests 2016-06-05 13:30:17 +02:00
.appveyor.yml Improve CI tests 2016-06-05 13:30:17 +02:00
.gitignore Update readme and remove old license 2016-06-05 13:26:26 +02:00
.gitmodules Switch submodule url to main pybind11 repository 2016-05-29 15:25:00 +02:00
.travis.yml Improve CI tests 2016-06-05 13:30:17 +02:00
CMakeLists.txt Update readme and remove old license 2016-06-05 13:26:26 +02:00
LICENSE Add conda recipe 2016-06-03 09:30:23 -04:00
MANIFEST.in Improve CI tests 2016-06-05 13:30:17 +02:00
README.md Update readme and remove old license 2016-06-05 13:26:26 +02:00
setup.py Initial commit 2016-05-23 00:22:06 +02:00

cmake_example for pybind11

Build Status Build status

An example pybind11 module built with a CMake-based build system. This is useful for C++ codebases that have an existing CMake project structure.

Prerequisites

On Unix (Linux, OS X)

  • A compiler with C++11 support
  • CMake >= 2.8.12

On Windows

  • Visual Studio 2015 (required for all Python versions, see notes below)
  • CMake >= 3.1

Installation

Just clone this repository and pip install. Note the --recursive option which is needed for the pybind11 submodule:

git clone --recursive https://github.com/pybind/cmake_example.git
pip install ./cmake_example

With the setup.py file included in this example, the pip install command will invoke CMake and build the pybind11 module as specified in CMakeLists.txt.

Special notes for Windows

Compiler requirements

Pybind11 requires a C++11 compliant compiler, i.e Visual Studio 2015 on Windows. This applies to all Python versions, including 2.7. Unlike regular C extension modules, it's perfectly fine to compile a pybind11 module with a VS version newer than the target Python's VS version. See the FAQ for more details.

Runtime requirements

The Visual C++ 2015 redistributable packages are a runtime requirement for this project. It can be found here. If you use the Anaconda Python distribution, you can add vs2015_runtime as a platform-dependent runtime requirement for you package: see the conda.recipe/meta.yaml file in this example.

License

Pybind11 is provided under a BSD-style license that can be found in the LICENSE file. By using, distributing, or contributing to this project, you agree to the terms and conditions of this license.

Test call

import cmake_example
cmake_example.add(1, 2)