All Projects → python-cmake-buildsystem → Python Cmake Buildsystem

python-cmake-buildsystem / Python Cmake Buildsystem

Licence: apache-2.0
A cmake buildsystem for compiling Python

Programming Languages

cpython
15 projects

Projects that are alternatives of or similar to Python Cmake Buildsystem

Ultralight
Next-generation HTML renderer for apps and games
Stars: ✭ 3,585 (+1030.91%)
Mutual labels:  cmake, cross-platform
Reggae
Build system in D, Python, Ruby, Javascript or Lua
Stars: ✭ 141 (-55.52%)
Mutual labels:  cmake, build-system
Arduino Cmake Ng
CMake-Based framework for Arduino platforms
Stars: ✭ 123 (-61.2%)
Mutual labels:  cmake, build-system
Nitroshare Desktop
Network file transfer application for Windows, OS X, & Linux
Stars: ✭ 1,150 (+262.78%)
Mutual labels:  cmake, cross-platform
Div Games Studio
Complete cross platform games development package, originally for DOS but now available on modern platforms.
Stars: ✭ 168 (-47%)
Mutual labels:  cmake, cross-platform
Corrosion
Marrying Rust and CMake - Easy Rust and C/C++ Integration!
Stars: ✭ 106 (-66.56%)
Mutual labels:  cmake, build-system
Blt
A streamlined CMake build system foundation for developing HPC software
Stars: ✭ 135 (-57.41%)
Mutual labels:  cmake, build-system
Arxlibertatis
Cross-platform port of Arx Fatalis, a first-person role-playing game
Stars: ✭ 602 (+89.91%)
Mutual labels:  cmake, cross-platform
Raz
Modern & multiplatform game engine in C++17
Stars: ✭ 161 (-49.21%)
Mutual labels:  cmake, cross-platform
Crosswindow
💻📱 A cross platform system abstraction library written in C++ for managing windows and performing OS tasks.
Stars: ✭ 155 (-51.1%)
Mutual labels:  cmake, cross-platform
Spirit
Atomistic Spin Simulation Framework
Stars: ✭ 67 (-78.86%)
Mutual labels:  cmake, cross-platform
Engine
A basic cross-platform 3D game engine
Stars: ✭ 208 (-34.38%)
Mutual labels:  cmake, cross-platform
Cmake Get
Get dependencies with cmake
Stars: ✭ 59 (-81.39%)
Mutual labels:  cmake, cross-platform
Qhttpengine
HTTP server for Qt applications
Stars: ✭ 112 (-64.67%)
Mutual labels:  cmake, cross-platform
Cmake Js
CMake.js - a Node.js native addon build tool
Stars: ✭ 610 (+92.43%)
Mutual labels:  cmake, build-system
Notepanda
📃 A simple cross-platform notepad. Based on Qt and C++.
Stars: ✭ 134 (-57.73%)
Mutual labels:  cmake, cross-platform
Screencloud
Screenshot sharing application for Windows, Mac and Linux.
Stars: ✭ 537 (+69.4%)
Mutual labels:  cmake, cross-platform
Cpm.cmake
📦 CMake's missing package manager. A small CMake script for setup-free, cross-platform, reproducible dependency management.
Stars: ✭ 560 (+76.66%)
Mutual labels:  cmake, cross-platform
Polyfem
A polyvalent C++ FEM library
Stars: ✭ 147 (-53.63%)
Mutual labels:  cmake, cross-platform
Methanekit
🎲 Modern 3D graphics made simple with cross-platform C++17 meta-API on top of DirectX 12 & Metal (Vulkan is coming)
Stars: ✭ 197 (-37.85%)
Mutual labels:  cmake, cross-platform

CPython CMake Buildsystem

Overview

A replacement buildsystem for CPython.

This CMake <http://cmake.org>_ buildsystem has the following advantages:

  • No compiled program for the target architecture is used in the build itself. This makes cross-compiling easier, less error prone, and reduces manual steps.
  • Same build information for all platforms - there's no need to maintain the autotools configuration separately from four different MSVC project files.
  • Support for other build systems and IDE's like Ninja <https://martine.github.io/ninja/>, Sublime Text <https://www.sublimetext.com/>, and many others.
  • Easily build C-extensions against other C/C++ libraries built with CMake.
  • It's much faster to compile: 7 seconds instead of 58 seconds in my unscientific test.

Usage

How to use this buildsystem:

  1. Checkout the buildsystem

.. code:: bash

cd ~/scratch git clone git://github.com/python-cmake-buildsystem/python-cmake-buildsystem

  1. Build

.. code:: bash

Unix

cd ~/scratch mkdir -p python-build && mkdir -p python-install cd python-build cmake -DCMAKE_INSTALL_PREFIX:PATH=${HOME}/scratch/python-install ../python-cmake-buildsystem make -j10 make install

Windows

cd %HOME%/scratch mkdir python-build mkdir python-install cd python-build cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_INSTALL_PREFIX:PATH=%HOME%/scratch/python-install ../python-cmake-buildsystem cmake --build . --config Release -- /m cmake --build . --config Release --target INSTALL

.. note::

By default, the build system will download the python 3.6.7 source from http://www.python.org/ftp/python/

CMake Options

You can pass options to CMake to control the way Python is built. You only need to give each option once - they get saved in CMakeCache.txt. Pass options on the commandline with -DOPTION=VALUE, or use the "ccmake" gui.

::

PYTHON_VERSION=major.minor.patch (defaults to 3.6.7) The version of Python to build.

PYTHON_APPLY_PATCHES=ON|OFF (defaults to ON) Apply patches required to build CPython based on the system and compiler found when configuring the project. Note that when cross-compiling, patches coresponding to the target system are applied. Patches can be found in "patches" directory.

CMAKE_BUILD_TYPE=Debug|Release Build with debugging symbols or with optimisations.

CMAKE_INSTALL_PREFIX= (defaults to /usr/local) Path in which to install Python.

DOWNLOAD_SOURCES=ON|OFF (defaults to ON) Download, check MD5 sum and extract python sources in the parent directory. Source archive is downloaded from http://www.python.org/ftp/python

BUILD_LIBPYTHON_SHARED=ON|OFF (defaults to OFF) Build libpython as a shared library (.so or .dll) or a static library (.a).

Note that Python extensions are always built as shared libraries.  On
Windows it is not possible to build shared .dll extensions against a
static libpython, so you must build any extensions you want into libpython
itself (see the BUILTIN flags below).

BUILD_EXTENSIONS_AS_BUILTIN=ON|OFF (defaults to OFF) If enabled, all extensions are statically compiled into the built python libraries (static and/or shared).

Note that all previously set BUILTIN_<extension> options are ignored and
reset to their original value.

WITH_STATIC_DEPENDENCIES=ON|OFF (defaults to OFF, available only on UNIX) If this is set to ON then cmake will compile statically libpython and all extensions. External dependencies (ncurses, sqlite, ...) will be builtin only if they are available as static libraries.

BUILD_WININST=ON|OFF (only for windows, defaults to ON if not crosscompiling) If enabled, build the 'Windows Installer' program for distutils if not already provided in the source tree.

BUILD_WININST_ALWAYS=ON|OFF (only for windows, defaults to OFF) If enabled, always build 'Windows Installer' program for distutils even if it is already provided in the source tree.

INSTALL_DEVELOPMENT=ON|OFF (defaults to ON) If enabled, install files required to develop C extensions.

INSTALL_MANUAL=ON|OFF (defaults to ON) If enabled, install manuals.

INSTALL_TEST=ON|OFF (defaults to ON) If enabled, install test files.

ENABLE_=ON|OFF (defaults to ON) BUILTIN_=ON|OFF (defaults to OFF except for POSIX, PWD and NT extensions which are builtin by default) These two options control how individual python extensions are built. is the name of the extension in upper case, and without any leading underscore (_). Known extensions for 2.7.12 include:

  ARRAY AUDIOOP BINASCII BISECT BSDDB BZ2 CMATH CODECS_CN CODECS_HK
  CODECS_ISO2022 CODECS_JP CODECS_KR CODECS_TW COLLECTIONS CPICKLE CRYPT
  CSTRINGIO CSV CTYPES CTYPES_TEST CURSES CURSES_PANEL DATETIME DBM
  ELEMENTTREE FCNTL FUNCTOOLS FUTURE_BUILTINS GDBM GRP HASHLIB HEAPQ
  HOTSHOT IO ITERTOOLS JSON LINUXAUDIODEV LOCALE LSPROF LZMA MATH MMAP
  MULTIBYTECODEC MULTIPROCESSING NIS NT OPERATOR OSSAUDIODEV PARSER POSIX
  PWD PYEXPAT RANDOM READLINE RESOURCE SELECT SOCKET SPWD SQLITE3 SSL
  STROP STRUCT SYSLOG TERMIOS TESTCAPI TIME TKINTER UNICODEDATA ZLIB

All extensions are enabled by default, but some might depend on system
libraries and will get disabled if they're not available (a list of
extensions that didn't have all their prerequisites available will be
printed when you run cmake).

By default extensions are compiled as separate shared libraries (.so or
.dll files) and installed in lib/python2.7/lib-dynload.  If you set
BUILTIN_<extension> to ON then the extension is compiled into libpython
instead.

USE_LIB64=ON|OFF (defaults to OFF) If this is set to ON then cmake will look for dependencies in lib64 as well as lib directories. Compiled python extensions will also be installed into lib64/python2.7/lib-dynload instead of lib/python2.7/lib-dynload.

Py_USING_UNICODE (only for python2, defaults to ON) Enable unicode support. By default, ucs2 is used. It can be forced to ucs4 setting Py_UNICODE_SIZE to 4.

EXTRA_PYTHONPATH=dir1:dir2 (defaults to "") Colon (:) separated list of extra directories to add to the compiled-in PYTHONPATH.

USE_SYSTEM_LIBRARIES=ON|OFF (defaults to ON) If set to OFF, no attempt to detect system libraries will be done. Options documented below allow to enable/disable detection of particular libraries.

USE_SYSTEM_Curses=ON|OFF (defaults to ON) If set to OFF, no attempt to detect Curses libraries will be done. Associated python extensions are: CURSES, CURSES_PANEL, READLINE Following CMake variables can manually be set: CURSES_LIBRARIES, PANEL_LIBRARIES

USE_SYSTEM_EXPAT=ON|OFF (defaults to ON) If set to OFF, no attempt to detect Expat libraries will be done. Associated python extensions are: ELEMENTTREE, PYEXPAT Following CMake variables can manually be set: EXPAT_LIBRARIES, EXPAT_INCLUDE_DIRS

USE_SYSTEM_OpenSSL=ON|OFF (defaults to ON) If set to OFF, no attempt to detect OpenSSL libraries will be done. Associated python extensions are: HASHLIB, SSL, MD5, SHA, SHA256, SHA512 Following CMake variables can manually be set: OPENSSL_INCLUDE_DIR, OPENSSL_LIBRARIES If [OPENSSL_INCLUDE_DIR, OPENSSL_LIBRARIES] are found, extensions [HASHLIB, SSL] will be built If [OPENSSL_INCLUDE_DIR, OPENSSL_LIBRARIES] are NOT found, extensions [SHA, SHA256, SHA512] will be built

USE_SYSTEM_TCL=ON|OFF (defaults to ON) If set to OFF, no attempt to detect Tcl libraries will be done. Associated python extensions are: TKINTER Following CMake variables can manually be set: TCL_LIBRARY, TK_LIBRARY, TCL_INCLUDE_PATH, TK_INCLUDE_PATH

USE_SYSTEM_ZLIB=ON|OFF (defaults to ON) If set to OFF, no attempt to detect ZLIB libraries will be done. Associated python extensions are: BINASCII, ZLIB Following CMake variables can manually be set: ZLIB_LIBRARY, ZLIB_INCLUDE_DIR, ZLIB_ROOT ZLIB_ROOT should be set only if USE_SYSTEM_ZLIB is ON If [ZLIB_LIBRARY, ZLIB_INCLUDE_DIR] are found, extensions [BINASCII] will be built with ZLIB_CRC32

USE_SYSTEM_DB=ON|OFF (defaults to ON) If set to OFF, no attempt to detect DB libraries will be done. Associated python extensions are: BSDDB Following CMake variables can manually be set: DB_INCLUDE_PATH, DB_LIBRARIES

USE_SYSTEM_GDBM=ON|OFF (defaults to ON) If set to OFF, no attempt to detect GDBM libraries will be done. Associated python extensions are: DBM, GDBM Following CMake variables can manually be set: GDBM_INCLUDE_PATH, GDBM_LIBRARY, GDBM_COMPAT_LIBRARY

USE_SYSTEM_LZMA=ON|OFF (defaults to ON) If set to OFF, no attempt to detect LZMA libraries will be done. Associated python extensions are: LZMA Following CMake variables can manually be set: LZMA_INCLUDE_PATH, LZMA_LIBRARY

USE_SYSTEM_READLINE=ON|OFF (defaults to ON) If set to OFF, no attempt to detect Readline libraries will be done. Associated python extensions are: READLINE Following CMake variables can manually be set: READLINE_INCLUDE_PATH, READLINE_LIBRARY

USE_SYSTEM_SQLITE3=ON|OFF (defaults to ON) If set to OFF, no attempt to detect SQLITE3 libraries will be done. Associated python extensions are: SQLITE3 Following CMake variables can manually be set: SQLITE3_INCLUDE_PATH, SQLITE3_LIBRARY

CMAKE_OSX_SDK (MacOSX, default is autodetected, e.g 'macosx10.06') By default, the variable is automatically set running xcrun and/or xcodebuild. Note that its value can also be explicitly set when doing a clean configuration either by adding a cache entry in cmake-gui or by passing the argument -DCMAKE_OSX_SDK:STRING=macosx10.6 when running cmake. Then, this variable is used to initialize CMAKE_OSX_SYSROOT, CMAKE_OSX_DEPLOYMENT_TARGET and MACOSX_DEPLOYMENT_TARGET variables.

Cross-compiling

Cross-compiling for Windows from Linux ......................................

There are some patches in the cmake/patches-win32 directory that make it possible to compile Python using the mingw32 compiler. You have to apply these before running make::

patch -p0 < cmake/patches-win32/01-dynload_win.patch patch -p0 < cmake/patches-win32/02-signalmodule.patch patch -p0 < cmake/patches-win32/03-mingw32.patch

Remarks

Note: Currently, multiple versions of Python 2.7 and 3.5 are supported. This repository is maintained separately from Python itself it needs to be manually updated whenever there is a new release of Python.

Licenses

Materials in this repository are distributed under the following licenses:

All software is licensed under the Apache 2.0 License. See LICENSE_Apache_20 <LICENSE_Apache_20>_ file for details.

FAQ

Why Apache 2.0 License? .......................

From the python.org wiki, the answer to the question What if I want to contribute my code to the PSF <https://wiki.python.org/moin/PythonSoftwareFoundationLicenseFaq#What_if_I_want_to_contribute_my_code_to_the_PSF.3F>_ mentions that if code is going to end up in Python or the standard library, the PSF will require you to license code under "Academic Free License" or "Apache License 2.0".

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].