From aae98e0f02e927f993713afc154da1f3673ebb3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 15 Jul 2019 12:39:36 +0200 Subject: [PATCH] python: remove pybind11 2.2.4 workarounds. --- src/python/CMakeLists.txt | 14 +------------- src/python/corrade/CMakeLists.txt | 4 ++-- src/python/magnum/CMakeLists.txt | 14 +++++++------- src/python/magnum/platform/CMakeLists.txt | 8 ++++---- 4 files changed, 14 insertions(+), 26 deletions(-) diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index 47a6ef1..c28e5dd 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -26,21 +26,9 @@ # Thanks, CMake, for making the recommended way of installing pacakges so # useless that it's impossible to call find_package() consistently independent # of whether it's installed system-wide or added through add_subdirectory(). -# This also means we can't use pybind11_VERSION below but have to extract it -# from some private cache variables instead. THIS IS ABSOLUTELY AWFUL, FFS. +# This is absolutely awful. if(NOT COMMAND pybind11_add_module) find_package(pybind11 CONFIG REQUIRED) -elseif(NOT pybind11_VERSION) - set(pybind11_VERSION ${PYBIND11_VERSION_MAJOR}.${PYBIND11_VERSION_MINOR}.${PYBIND11_VERSION_PATCH}) -endif() - -# By default, pybind11_add_module() adds the include directories as non-system. -# That, combined with Corrade's warning level, adds an insane amount of -# warnings to the build. Since https://github.com/pybind/pybind11/pull/1416 -# (scheduled to release in 2.3) it's possible to override that by passing -# SYSTEM to pybind11_add_module(). -if(NOT pybind11_VERSION VERSION_LESS 2.3) - set(pybind11_add_module_SYSTEM SYSTEM) endif() # UGH FFS diff --git a/src/python/corrade/CMakeLists.txt b/src/python/corrade/CMakeLists.txt index 1cdd94c..703e43b 100644 --- a/src/python/corrade/CMakeLists.txt +++ b/src/python/corrade/CMakeLists.txt @@ -29,7 +29,7 @@ set(corrade_containers_SRCS # If Corrade is not built as static, compile the sub-libraries as separate # modules if(NOT CORRADE_BUILD_STATIC) - pybind11_add_module(corrade_containers ${pybind11_add_module_SYSTEM} ${corrade_containers_SRCS}) + pybind11_add_module(corrade_containers SYSTEM ${corrade_containers_SRCS}) target_include_directories(corrade_containers PRIVATE ${PROJECT_SOURCE_DIR}/src/python) target_link_libraries(corrade_containers PRIVATE Corrade::Containers @@ -47,7 +47,7 @@ else() corrade.cpp ${corrade_containers_SRCS}) - pybind11_add_module(corrade ${pybind11_add_module_SYSTEM} ${corrade_SRCS}) + pybind11_add_module(corrade SYSTEM ${corrade_SRCS}) target_include_directories(corrade PRIVATE ${PROJECT_SOURCE_DIR}/src/python) target_link_libraries(corrade PRIVATE Corrade::Utility ${corrade_LIBS}) set_target_properties(corrade PROPERTIES diff --git a/src/python/magnum/CMakeLists.txt b/src/python/magnum/CMakeLists.txt index 5244149..877f07b 100644 --- a/src/python/magnum/CMakeLists.txt +++ b/src/python/magnum/CMakeLists.txt @@ -72,7 +72,7 @@ set(magnum_trade_SRCS # modules if(NOT MAGNUM_BUILD_STATIC) if(Magnum_GL_FOUND) - pybind11_add_module(magnum_gl ${pybind11_add_module_SYSTEM} ${magnum_gl_SRCS}) + pybind11_add_module(magnum_gl SYSTEM ${magnum_gl_SRCS}) target_include_directories(magnum_gl PRIVATE ${PROJECT_SOURCE_DIR}/src/python) target_link_libraries(magnum_gl PRIVATE Magnum::GL) set_target_properties(magnum_gl PROPERTIES @@ -82,7 +82,7 @@ if(NOT MAGNUM_BUILD_STATIC) endif() if(Magnum_MeshTools_FOUND) - pybind11_add_module(magnum_meshtools ${pybind11_add_module_SYSTEM} ${magnum_meshtools_SRCS}) + pybind11_add_module(magnum_meshtools SYSTEM ${magnum_meshtools_SRCS}) target_include_directories(magnum_meshtools PRIVATE ${PROJECT_SOURCE_DIR}/src/python) target_link_libraries(magnum_meshtools PRIVATE Magnum::MeshTools) set_target_properties(magnum_meshtools PROPERTIES @@ -92,7 +92,7 @@ if(NOT MAGNUM_BUILD_STATIC) endif() if(Magnum_Primitives_FOUND) - pybind11_add_module(magnum_primitives ${pybind11_add_module_SYSTEM} ${magnum_primitives_SRCS}) + pybind11_add_module(magnum_primitives SYSTEM ${magnum_primitives_SRCS}) target_include_directories(magnum_primitives PRIVATE ${PROJECT_SOURCE_DIR}/src/python) target_link_libraries(magnum_primitives PRIVATE Magnum::Primitives) set_target_properties(magnum_primitives PROPERTIES @@ -102,7 +102,7 @@ if(NOT MAGNUM_BUILD_STATIC) endif() if(Magnum_SceneGraph_FOUND) - pybind11_add_module(magnum_scenegraph ${pybind11_add_module_SYSTEM} ${magnum_scenegraph_SRCS}) + pybind11_add_module(magnum_scenegraph SYSTEM ${magnum_scenegraph_SRCS}) target_include_directories(magnum_scenegraph PRIVATE ${PROJECT_SOURCE_DIR}/src ${PROJECT_SOURCE_DIR}/src/python) @@ -114,7 +114,7 @@ if(NOT MAGNUM_BUILD_STATIC) endif() if(Magnum_Shaders_FOUND) - pybind11_add_module(magnum_shaders ${pybind11_add_module_SYSTEM} ${magnum_shaders_SRCS}) + pybind11_add_module(magnum_shaders SYSTEM ${magnum_shaders_SRCS}) target_include_directories(magnum_shaders PRIVATE ${PROJECT_SOURCE_DIR}/src/python) target_link_libraries(magnum_shaders PRIVATE Magnum::Shaders) set_target_properties(magnum_shaders PROPERTIES @@ -124,7 +124,7 @@ if(NOT MAGNUM_BUILD_STATIC) endif() if(Magnum_Trade_FOUND) - pybind11_add_module(magnum_trade ${pybind11_add_module_SYSTEM} ${magnum_trade_SRCS}) + pybind11_add_module(magnum_trade SYSTEM ${magnum_trade_SRCS}) target_include_directories(magnum_trade PRIVATE ${PROJECT_SOURCE_DIR}/src/python) target_link_libraries(magnum_trade PRIVATE Magnum::Trade) set_target_properties(magnum_trade PROPERTIES @@ -191,7 +191,7 @@ else() endif() endif() -pybind11_add_module(magnum ${pybind11_add_module_SYSTEM} ${magnum_SRCS}) +pybind11_add_module(magnum SYSTEM ${magnum_SRCS}) target_include_directories(magnum PRIVATE ${PROJECT_SOURCE_DIR}/src # SceneGraph/Python.h for static build ${PROJECT_SOURCE_DIR}/src/python diff --git a/src/python/magnum/platform/CMakeLists.txt b/src/python/magnum/platform/CMakeLists.txt index 70b234a..c883fb1 100644 --- a/src/python/magnum/platform/CMakeLists.txt +++ b/src/python/magnum/platform/CMakeLists.txt @@ -25,7 +25,7 @@ if(NOT MAGNUM_BUILD_STATIC) if(Magnum_GlfwApplication_FOUND) - pybind11_add_module(magnum_platform_glfw ${pybind11_add_module_SYSTEM} glfw.cpp) + pybind11_add_module(magnum_platform_glfw SYSTEM glfw.cpp) target_link_libraries(magnum_platform_glfw PRIVATE Magnum::GlfwApplication) target_include_directories(magnum_platform_glfw PRIVATE ${CMAKE_SOURCE_DIR}/src/python) set_target_properties(magnum_platform_glfw PROPERTIES @@ -35,7 +35,7 @@ if(NOT MAGNUM_BUILD_STATIC) endif() if(Magnum_Sdl2Application_FOUND) - pybind11_add_module(magnum_platform_sdl2 ${pybind11_add_module_SYSTEM} sdl2.cpp) + pybind11_add_module(magnum_platform_sdl2 SYSTEM sdl2.cpp) target_link_libraries(magnum_platform_sdl2 PRIVATE Magnum::Sdl2Application) target_include_directories(magnum_platform_sdl2 PRIVATE ${CMAKE_SOURCE_DIR}/src/python) set_target_properties(magnum_platform_sdl2 PROPERTIES @@ -45,7 +45,7 @@ if(NOT MAGNUM_BUILD_STATIC) endif() if(Magnum_WindowlessEglApplication_FOUND) - pybind11_add_module(magnum_platform_egl ${pybind11_add_module_SYSTEM} egl.cpp) + pybind11_add_module(magnum_platform_egl SYSTEM egl.cpp) target_link_libraries(magnum_platform_egl PRIVATE Magnum::WindowlessEglApplication) target_include_directories(magnum_platform_egl PRIVATE ${PROJECT_SOURCE_DIR}/src/python) set_target_properties(magnum_platform_egl PROPERTIES @@ -55,7 +55,7 @@ if(NOT MAGNUM_BUILD_STATIC) endif() if(Magnum_WindowlessGlxApplication_FOUND) - pybind11_add_module(magnum_platform_glx ${pybind11_add_module_SYSTEM} glx.cpp) + pybind11_add_module(magnum_platform_glx SYSTEM glx.cpp) target_link_libraries(magnum_platform_glx PRIVATE Magnum::WindowlessGlxApplication) target_include_directories(magnum_platform_glx PRIVATE ${PROJECT_SOURCE_DIR}/src/python) set_target_properties(magnum_platform_glx PROPERTIES