From 587cf82e582b1f38a904facdb8bc57903505e318 Mon Sep 17 00:00:00 2001 From: Dean Moldovan Date: Mon, 14 Aug 2017 00:35:53 +0200 Subject: [PATCH] Move internal headers into `detail` subdirectory --- CMakeLists.txt | 13 ++++++------- include/pybind11/buffer_info.h | 2 +- include/pybind11/cast.h | 4 ++-- .../pybind11/{class_support.h => detail/class.h} | 4 ++-- include/pybind11/{ => detail}/common.h | 2 +- include/pybind11/{ => detail}/descr.h | 2 +- include/pybind11/{ => detail}/typeid.h | 2 +- include/pybind11/options.h | 2 +- include/pybind11/pybind11.h | 2 +- include/pybind11/pytypes.h | 4 ++-- include/pybind11/stl_bind.h | 2 +- setup.py | 8 ++++---- 12 files changed, 23 insertions(+), 24 deletions(-) rename include/pybind11/{class_support.h => detail/class.h} (99%) rename include/pybind11/{ => detail}/common.h (99%) rename include/pybind11/{ => detail}/descr.h (99%) rename include/pybind11/{ => detail}/typeid.h (94%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 842b59fbe9..fb51d389e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,14 +36,15 @@ set(PYTHON_MODULE_EXTENSION ${PYTHON_MODULE_EXTENSION} CACHE INTERNAL "") # NB: when adding a header don't forget to also add it to setup.py set(PYBIND11_HEADERS + include/pybind11/detail/class.h + include/pybind11/detail/common.h + include/pybind11/detail/descr.h + include/pybind11/detail/typeid.h include/pybind11/attr.h include/pybind11/buffer_info.h include/pybind11/cast.h include/pybind11/chrono.h - include/pybind11/class_support.h - include/pybind11/common.h include/pybind11/complex.h - include/pybind11/descr.h include/pybind11/options.h include/pybind11/eigen.h include/pybind11/embed.h @@ -55,7 +56,6 @@ set(PYBIND11_HEADERS include/pybind11/pytypes.h include/pybind11/stl.h include/pybind11/stl_bind.h - include/pybind11/typeid.h ) string(REPLACE "include/" "${CMAKE_CURRENT_SOURCE_DIR}/include/" PYBIND11_HEADERS "${PYBIND11_HEADERS}") @@ -68,7 +68,7 @@ include(GNUInstallDirs) include(CMakePackageConfigHelpers) # extract project version from source -file(STRINGS "${PYBIND11_INCLUDE_DIR}/pybind11/common.h" pybind11_version_defines +file(STRINGS "${PYBIND11_INCLUDE_DIR}/pybind11/detail/common.h" pybind11_version_defines REGEX "#define PYBIND11_VERSION_(MAJOR|MINOR|PATCH) ") foreach(ver ${pybind11_version_defines}) if (ver MATCHES "#define PYBIND11_VERSION_(MAJOR|MINOR|PATCH) +([^ ]+)$") @@ -110,8 +110,7 @@ if(NOT (CMAKE_VERSION VERSION_LESS 3.0)) # CMake >= 3.0 endif() if (PYBIND11_INSTALL) - install(FILES ${PYBIND11_HEADERS} - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/pybind11) + install(DIRECTORY ${PYBIND11_INCLUDE_DIR}/pybind11 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) # GNUInstallDirs "DATADIR" wrong here; CMake search path wants "share". set(PYBIND11_CMAKECONFIG_INSTALL_DIR "share/cmake/${PROJECT_NAME}" CACHE STRING "install path for pybind11Config.cmake") diff --git a/include/pybind11/buffer_info.h b/include/pybind11/buffer_info.h index 1f5e3a9531..9f072fa738 100644 --- a/include/pybind11/buffer_info.h +++ b/include/pybind11/buffer_info.h @@ -9,7 +9,7 @@ #pragma once -#include "common.h" +#include "detail/common.h" NAMESPACE_BEGIN(PYBIND11_NAMESPACE) diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h index 41e65cc8b9..e1823bd561 100644 --- a/include/pybind11/cast.h +++ b/include/pybind11/cast.h @@ -11,8 +11,8 @@ #pragma once #include "pytypes.h" -#include "typeid.h" -#include "descr.h" +#include "detail/typeid.h" +#include "detail/descr.h" #include #include #include diff --git a/include/pybind11/class_support.h b/include/pybind11/detail/class.h similarity index 99% rename from include/pybind11/class_support.h rename to include/pybind11/detail/class.h index d006a1e5cc..6f9667e053 100644 --- a/include/pybind11/class_support.h +++ b/include/pybind11/detail/class.h @@ -1,5 +1,5 @@ /* - pybind11/class_support.h: Python C API implementation details for py::class_ + pybind11/detail/class.h: Python C API implementation details for py::class_ Copyright (c) 2017 Wenzel Jakob @@ -9,7 +9,7 @@ #pragma once -#include "attr.h" +#include "../attr.h" NAMESPACE_BEGIN(PYBIND11_NAMESPACE) NAMESPACE_BEGIN(detail) diff --git a/include/pybind11/common.h b/include/pybind11/detail/common.h similarity index 99% rename from include/pybind11/common.h rename to include/pybind11/detail/common.h index e83a64759f..2201d2b2c6 100644 --- a/include/pybind11/common.h +++ b/include/pybind11/detail/common.h @@ -1,5 +1,5 @@ /* - pybind11/common.h -- Basic macros + pybind11/detail/common.h -- Basic macros Copyright (c) 2016 Wenzel Jakob diff --git a/include/pybind11/descr.h b/include/pybind11/detail/descr.h similarity index 99% rename from include/pybind11/descr.h rename to include/pybind11/detail/descr.h index f6c0a68385..e3bf2ba978 100644 --- a/include/pybind11/descr.h +++ b/include/pybind11/detail/descr.h @@ -1,5 +1,5 @@ /* - pybind11/descr.h: Helper type for concatenating type signatures + pybind11/detail/descr.h: Helper type for concatenating type signatures either at runtime (C++11) or compile time (C++14) Copyright (c) 2016 Wenzel Jakob diff --git a/include/pybind11/typeid.h b/include/pybind11/detail/typeid.h similarity index 94% rename from include/pybind11/typeid.h rename to include/pybind11/detail/typeid.h index 9d3ddcd533..6f36aab752 100644 --- a/include/pybind11/typeid.h +++ b/include/pybind11/detail/typeid.h @@ -1,5 +1,5 @@ /* - pybind11/typeid.h: Compiler-independent access to type identifiers + pybind11/detail/typeid.h: Compiler-independent access to type identifiers Copyright (c) 2016 Wenzel Jakob diff --git a/include/pybind11/options.h b/include/pybind11/options.h index 531ec8a81b..cc1e1f6f0f 100644 --- a/include/pybind11/options.h +++ b/include/pybind11/options.h @@ -9,7 +9,7 @@ #pragma once -#include "common.h" +#include "detail/common.h" NAMESPACE_BEGIN(PYBIND11_NAMESPACE) diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index 01c02dc4d1..9bf39d1457 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -42,7 +42,7 @@ #include "attr.h" #include "options.h" -#include "class_support.h" +#include "detail/class.h" NAMESPACE_BEGIN(PYBIND11_NAMESPACE) diff --git a/include/pybind11/pytypes.h b/include/pybind11/pytypes.h index ba30e84ee4..9e18a019bf 100644 --- a/include/pybind11/pytypes.h +++ b/include/pybind11/pytypes.h @@ -1,5 +1,5 @@ /* - pybind11/typeid.h: Convenience wrapper classes for basic Python types + pybind11/pytypes.h: Convenience wrapper classes for basic Python types Copyright (c) 2016 Wenzel Jakob @@ -9,7 +9,7 @@ #pragma once -#include "common.h" +#include "detail/common.h" #include "buffer_info.h" #include #include diff --git a/include/pybind11/stl_bind.h b/include/pybind11/stl_bind.h index d9f5b56d6a..31d84b2c9c 100644 --- a/include/pybind11/stl_bind.h +++ b/include/pybind11/stl_bind.h @@ -9,7 +9,7 @@ #pragma once -#include "common.h" +#include "detail/common.h" #include "operators.h" #include diff --git a/setup.py b/setup.py index f1eac9c8d9..395f83caf1 100644 --- a/setup.py +++ b/setup.py @@ -12,14 +12,15 @@ headers = [] else: headers = [ + 'include/pybind11/detail/class.h', + 'include/pybind11/detail/common.h', + 'include/pybind11/detail/descr.h', + 'include/pybind11/detail/typeid.h' 'include/pybind11/attr.h', 'include/pybind11/buffer_info.h', 'include/pybind11/cast.h', 'include/pybind11/chrono.h', - 'include/pybind11/class_support.h', - 'include/pybind11/common.h', 'include/pybind11/complex.h', - 'include/pybind11/descr.h', 'include/pybind11/eigen.h', 'include/pybind11/embed.h', 'include/pybind11/eval.h', @@ -31,7 +32,6 @@ 'include/pybind11/pytypes.h', 'include/pybind11/stl.h', 'include/pybind11/stl_bind.h', - 'include/pybind11/typeid.h' ] setup(