Update readme and remove old license
This commit is contained in:
parent
37c3aeccdd
commit
f889d7d151
6 changed files with 74 additions and 44 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,4 +1,5 @@
|
||||||
build/
|
build/
|
||||||
|
dist/
|
||||||
*.so
|
*.so
|
||||||
*.py[cod]
|
*.py[cod]
|
||||||
*.egg-info
|
*.egg-info
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
cmake_minimum_required(VERSION 2.8.12)
|
cmake_minimum_required(VERSION 2.8.12)
|
||||||
project(pybind11_cmake_example)
|
project(cmake_example)
|
||||||
|
|
||||||
add_subdirectory(pybind11)
|
add_subdirectory(pybind11)
|
||||||
|
|
||||||
pybind11_add_module(cmake_example src/main.cpp)
|
pybind11_add_module(cmake_example src/main.cpp)
|
||||||
|
|
71
README.md
Normal file
71
README.md
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
# cmake_example for pybind11
|
||||||
|
|
||||||
|
[](https://travis-ci.org/pybind/cmake_example)
|
||||||
|
[](https://ci.appveyor.com/project/dean0x7d/cmake-example/branch/master)
|
||||||
|
|
||||||
|
An example [pybind11](https://github.com/pybind/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:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
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][vs2015_runtime]. 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
|
||||||
|
|
||||||
|
```python
|
||||||
|
import cmake_example
|
||||||
|
cmake_example.add(1, 2)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
[FAQ]: http://pybind11.rtfd.io/en/latest/faq.html#working-with-ancient-visual-studio-2009-builds-on-windows
|
||||||
|
[vs2015_runtime]: https://www.microsoft.com/en-us/download/details.aspx?id=48145
|
24
license.md
24
license.md
|
@ -1,24 +0,0 @@
|
||||||
Copyright (c) 2016, Dean Moldovan
|
|
||||||
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright notice, this
|
|
||||||
list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer in the documentation
|
|
||||||
and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
2
pybind11
2
pybind11
|
@ -1 +1 @@
|
||||||
Subproject commit 0a07805ab663b981d72bbe2663b946f8c18e67cf
|
Subproject commit 19d95ef09a384d6631308161ead24e5a230c9bf8
|
17
readme.md
17
readme.md
|
@ -1,17 +0,0 @@
|
||||||
## Building pybind11 modules with CMake
|
|
||||||
|
|
||||||
An example of building a Python extension using [pybind11](https://github.com/pybind/pybind11) and CMake.
|
|
||||||
This is useful for C++ codebases that already have an existing CMake-based build system.
|
|
||||||
|
|
||||||
### Install
|
|
||||||
|
|
||||||
1. Make sure CMake >= 2.8.12 is installed on your system
|
|
||||||
2. Clone this repository
|
|
||||||
3. `pip install ./pybind11_cmake_example`
|
|
||||||
|
|
||||||
### Test
|
|
||||||
|
|
||||||
```python
|
|
||||||
import cmake_example
|
|
||||||
cmake_example.add(1, 2)
|
|
||||||
```
|
|
Loading…
Add table
Reference in a new issue