From c1dd58efae7c04bd4d44db37b6f7ab6503937d16 Mon Sep 17 00:00:00 2001 From: Sylvain Corlay Date: Tue, 7 Feb 2017 15:44:03 +0100 Subject: [PATCH 1/3] Change header install directory --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 341f845e45..ad5a0f713f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -92,6 +92,9 @@ endforeach() set(${PROJECT_NAME}_VERSION ${PYBIND11_VERSION_MAJOR}.${PYBIND11_VERSION_MINOR}.${PYBIND11_VERSION_PATCH}) message(STATUS "pybind11 v${${PROJECT_NAME}_VERSION}") +#set(CMAKE_INSTALL_INCLUDEDIR ${PYTHON_INCLUDE_DIRS}) +file(RELATIVE_PATH CMAKE_INSTALL_INCLUDEDIR ${CMAKE_INSTALL_PREFIX} ${PYTHON_INCLUDE_DIRS}) + if(NOT (CMAKE_VERSION VERSION_LESS 3.0)) # CMake >= 3.0 # Build an interface library target: add_library(module INTERFACE) From 695866c07e04b5cf71687b1037dc19c5c50f198d Mon Sep 17 00:00:00 2001 From: Sylvain Corlay Date: Wed, 8 Feb 2017 12:06:00 +0100 Subject: [PATCH 2/3] Add flag for installation of headers under python include directory --- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ad5a0f713f..0db6cbcaf6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -92,8 +92,10 @@ endforeach() set(${PROJECT_NAME}_VERSION ${PYBIND11_VERSION_MAJOR}.${PYBIND11_VERSION_MINOR}.${PYBIND11_VERSION_PATCH}) message(STATUS "pybind11 v${${PROJECT_NAME}_VERSION}") -#set(CMAKE_INSTALL_INCLUDEDIR ${PYTHON_INCLUDE_DIRS}) -file(RELATIVE_PATH CMAKE_INSTALL_INCLUDEDIR ${CMAKE_INSTALL_PREFIX} ${PYTHON_INCLUDE_DIRS}) +option (USE_PYTHON_INCLUDE_DIR "Install pybind11 headers in Python include directory instead of default installation prefix" OFF) +if (USE_PYTHON_INCLUDE_DIR) + file(RELATIVE_PATH CMAKE_INSTALL_INCLUDEDIR ${CMAKE_INSTALL_PREFIX} ${PYTHON_INCLUDE_DIRS}) +endif() if(NOT (CMAKE_VERSION VERSION_LESS 3.0)) # CMake >= 3.0 # Build an interface library target: From 4af125b23c6dbdebf91a2208a1215932e8eab06b Mon Sep 17 00:00:00 2001 From: Sylvain Corlay Date: Wed, 8 Feb 2017 12:06:00 +0100 Subject: [PATCH 3/3] Allow the disabling of distutils install_headers --- setup.py | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/setup.py b/setup.py index a25f1af40f..f3011b0dde 100644 --- a/setup.py +++ b/setup.py @@ -4,18 +4,14 @@ from setuptools import setup from pybind11 import __version__ +import os -setup( - name='pybind11', - version=__version__, - description='Seamless operability between C++11 and Python', - author='Wenzel Jakob', - author_email='wenzel.jakob@epfl.ch', - url='https://github.com/wjakob/pybind11', - download_url='https://github.com/wjakob/pybind11/tarball/v' + __version__, - packages=['pybind11'], - license='BSD', - headers=[ +# Prevent installation of pybind11 headers by setting +# PYBIND11_USE_CMAKE. +if os.environ.get('PYBIND11_USE_CMAKE'): + headers = [] +else: + headers = [ 'include/pybind11/attr.h', 'include/pybind11/cast.h', 'include/pybind11/chrono.h', @@ -33,7 +29,19 @@ 'include/pybind11/stl.h', 'include/pybind11/stl_bind.h', 'include/pybind11/typeid.h' - ], + ] + +setup( + name='pybind11', + version=__version__, + description='Seamless operability between C++11 and Python', + author='Wenzel Jakob', + author_email='wenzel.jakob@epfl.ch', + url='https://github.com/wjakob/pybind11', + download_url='https://github.com/wjakob/pybind11/tarball/v' + __version__, + packages=['pybind11'], + license='BSD', + headers=headers, classifiers=[ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers',