Utilities and example for using CMake to build Cython modules.
CMake Python C++
Latest commit c7d9acd Jan 15, 2017 @thewtex committed on GitHub Merge pull request #16 from weshoke/fix-pxi-dependencies
check for .pxi dependencies
Failed to load latest commit information.
bin Update rectangle_props.py Jun 17, 2014
cmake check for .pxi dependencies Jan 14, 2017
include Rename rectangle module to rect. #4. Aug 12, 2012
src Rename rectangle module to rect. #4. Aug 12, 2012
test Rename rectangle module to rect. #4. Aug 12, 2012
CTestConfig.cmake Change the CDash project start time to UTC. Oct 24, 2012
LICENSE Luis Ibanez initial commit. Oct 27, 2011
readme.rst Add link to scikit-build Sep 12, 2016
setup.py Add setup.py warning. Nov 3, 2011




Cython is hybrid C-Python language to easily write Python C-extensions. Cython allows one to write fast Python-ish code and easily integrate C or C++ code.

CMake is a cross-platform build system with good support for C/C++. With simple projects description scripts, CMakeLists.txt, a powerful configuration system is available. The configuration can be handled with a command line interface, curses interface, or Qt GUI interface.

This repository has CMake utilities for building Cython projects with CMake. The rectangle example from the Cython documentation is built to demonstrate their use. An example is also provided that shows registering a C callback with a function defined in a Cython module.

The features of this build system include:

  • Easy configuration of build settings.
  • Easy integration of external libraries.
  • Implicit Makefile dependency generation for .pxd files.
  • Implicit Makefile dependency generation for C/C++ headers.
  • Out-of-source builds.

The project is tested across platforms on the nightly dashboard.


The latest versions of these CMake Cython scripts are maintained in scikit-build.


Build Dependencies

Test Dependencies

Build Instructions

mkdir cython_example_build
cd cython_example_build
cmake /path/to/src/cython-cmake-example


In your CMake configuration, make sure that PYTHON_LIBRARY, PYTHON_INCLUDE_DIR, and CYTHON_EXECUTABLE are all using the same CPython version.

To run the tests: