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}) set(${PROJECT_NAME}_VERSION ${PYBIND11_VERSION_MAJOR}.${PYBIND11_VERSION_MINOR}.${PYBIND11_VERSION_PATCH})
message(STATUS "pybind11 v${${PROJECT_NAME}_VERSION}") 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 if(NOT (CMAKE_VERSION VERSION_LESS 3.0)) # CMake >= 3.0
# Build an interface library target: # Build an interface library target:
add_library(module INTERFACE) add_library(module INTERFACE)

View File

@ -4,18 +4,14 @@
from setuptools import setup from setuptools import setup
from pybind11 import __version__ from pybind11 import __version__
import os
setup( # Prevent installation of pybind11 headers by setting
name='pybind11', # PYBIND11_USE_CMAKE.
version=__version__, if os.environ.get('PYBIND11_USE_CMAKE'):
description='Seamless operability between C++11 and Python', headers = []
author='Wenzel Jakob', else:
author_email='wenzel.jakob@epfl.ch', headers = [
url='https://github.com/wjakob/pybind11',
download_url='https://github.com/wjakob/pybind11/tarball/v' + __version__,
packages=['pybind11'],
license='BSD',
headers=[
'include/pybind11/attr.h', 'include/pybind11/attr.h',
'include/pybind11/cast.h', 'include/pybind11/cast.h',
'include/pybind11/chrono.h', 'include/pybind11/chrono.h',
@ -33,7 +29,19 @@ setup(
'include/pybind11/stl.h', 'include/pybind11/stl.h',
'include/pybind11/stl_bind.h', 'include/pybind11/stl_bind.h',
'include/pybind11/typeid.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=[ classifiers=[
'Development Status :: 5 - Production/Stable', 'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers', 'Intended Audience :: Developers',