CMake installation path consistency (#652)

* Add flag for installation of headers under python include directory

* Allow the disabling of distutils install_headers
This commit is contained in:
Sylvain Corlay 2017-02-14 13:16:14 +01:00 committed by Wenzel Jakob
parent cec052b5c5
commit d5ce82b6f5
2 changed files with 25 additions and 12 deletions

View File

@ -92,6 +92,11 @@ endforeach()
set(${PROJECT_NAME}_VERSION ${PYBIND11_VERSION_MAJOR}.${PYBIND11_VERSION_MINOR}.${PYBIND11_VERSION_PATCH})
message(STATUS "pybind11 v${${PROJECT_NAME}_VERSION}")
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:
add_library(module INTERFACE)

View File

@ -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 @@ setup(
'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',