Browse Source

python: re-add an inverse of pybind11 2.2.4 workarounds for 2.6.

Sigh. AMAZING how they can break one thing twice in a span of a year
and a half.

This reverts commit aae98e0f02.
pull/10/head
Vladimír Vondruš 6 years ago
parent
commit
4bb19e0b3f
  1. 16
      src/python/CMakeLists.txt
  2. 6
      src/python/corrade/CMakeLists.txt
  3. 14
      src/python/magnum/CMakeLists.txt
  4. 8
      src/python/magnum/platform/CMakeLists.txt

16
src/python/CMakeLists.txt

@ -26,9 +26,23 @@
# 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 is absolutely awful.
# 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.
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()
# In pybind11 2.2.4 and below, pybind11_add_module() added the include
# directories as non-system. That, combined with Corrade's warning level, added
# an insane amount of warnings to the build. Since 2.3 it was possible to
# override that by passing SYSTEM to pybind11_add_module(), HOWEVER since 2.6
# doing so causes an ANNOYING warning because they made that a default. That
# all in a span of barely two years. Can't things just stay stable for a little
# moment?!
if(pybind11_VERSION VERSION_LESS 2.6)
set(pybind11_add_module_SYSTEM SYSTEM)
endif()
# UGH FFS

6
src/python/corrade/CMakeLists.txt

@ -42,7 +42,7 @@ set(corrade_pluginmanager_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 SYSTEM ${corrade_containers_SRCS})
pybind11_add_module(corrade_containers ${pybind11_add_module_SYSTEM} ${corrade_containers_SRCS})
target_include_directories(corrade_containers PRIVATE
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/src/python)
@ -55,7 +55,7 @@ if(NOT CORRADE_BUILD_STATIC)
LIBRARY_OUTPUT_DIRECTORY ${output_dir}/corrade)
if(Corrade_PluginManager_FOUND)
pybind11_add_module(corrade_pluginmanager SYSTEM ${corrade_pluginmanager_SRCS})
pybind11_add_module(corrade_pluginmanager ${pybind11_add_module_SYSTEM} ${corrade_pluginmanager_SRCS})
target_include_directories(corrade_pluginmanager PRIVATE
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/src/python)
@ -83,7 +83,7 @@ else()
endif()
endif()
pybind11_add_module(corrade SYSTEM ${corrade_SRCS})
pybind11_add_module(corrade ${pybind11_add_module_SYSTEM} ${corrade_SRCS})
target_include_directories(corrade PRIVATE
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/src/python

14
src/python/magnum/CMakeLists.txt

@ -83,7 +83,7 @@ set(magnum_trade_SRCS
# modules
if(NOT MAGNUM_BUILD_STATIC)
if(Magnum_GL_FOUND)
pybind11_add_module(magnum_gl SYSTEM ${magnum_gl_SRCS})
pybind11_add_module(magnum_gl ${pybind11_add_module_SYSTEM} ${magnum_gl_SRCS})
target_include_directories(magnum_gl PRIVATE
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/src/python)
@ -95,7 +95,7 @@ if(NOT MAGNUM_BUILD_STATIC)
endif()
if(Magnum_MeshTools_FOUND)
pybind11_add_module(magnum_meshtools SYSTEM ${magnum_meshtools_SRCS})
pybind11_add_module(magnum_meshtools ${pybind11_add_module_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
@ -105,7 +105,7 @@ if(NOT MAGNUM_BUILD_STATIC)
endif()
if(Magnum_Primitives_FOUND)
pybind11_add_module(magnum_primitives SYSTEM ${magnum_primitives_SRCS})
pybind11_add_module(magnum_primitives ${pybind11_add_module_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
@ -115,7 +115,7 @@ if(NOT MAGNUM_BUILD_STATIC)
endif()
if(Magnum_SceneGraph_FOUND)
pybind11_add_module(magnum_scenegraph SYSTEM ${magnum_scenegraph_SRCS})
pybind11_add_module(magnum_scenegraph ${pybind11_add_module_SYSTEM} ${magnum_scenegraph_SRCS})
target_include_directories(magnum_scenegraph PRIVATE
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/src/python)
@ -127,7 +127,7 @@ if(NOT MAGNUM_BUILD_STATIC)
endif()
if(Magnum_Shaders_FOUND)
pybind11_add_module(magnum_shaders SYSTEM ${magnum_shaders_SRCS})
pybind11_add_module(magnum_shaders ${pybind11_add_module_SYSTEM} ${magnum_shaders_SRCS})
target_include_directories(magnum_shaders PRIVATE
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/src/python)
@ -139,7 +139,7 @@ if(NOT MAGNUM_BUILD_STATIC)
endif()
if(Magnum_Trade_FOUND)
pybind11_add_module(magnum_trade SYSTEM ${magnum_trade_SRCS})
pybind11_add_module(magnum_trade ${pybind11_add_module_SYSTEM} ${magnum_trade_SRCS})
target_include_directories(magnum_trade PRIVATE
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/src/python)
@ -213,7 +213,7 @@ else()
endif()
endif()
pybind11_add_module(magnum SYSTEM ${magnum_SRCS})
pybind11_add_module(magnum ${pybind11_add_module_SYSTEM} ${magnum_SRCS})
target_include_directories(magnum PRIVATE
${PROJECT_SOURCE_DIR}/src # SceneGraph/Python.h for static build
${PROJECT_SOURCE_DIR}/src/python

8
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 SYSTEM glfw.cpp)
pybind11_add_module(magnum_platform_glfw ${pybind11_add_module_SYSTEM} glfw.cpp)
target_link_libraries(magnum_platform_glfw PRIVATE Magnum::GlfwApplication)
target_include_directories(magnum_platform_glfw PRIVATE
${PROJECT_SOURCE_DIR}/src
@ -37,7 +37,7 @@ if(NOT MAGNUM_BUILD_STATIC)
endif()
if(Magnum_Sdl2Application_FOUND)
pybind11_add_module(magnum_platform_sdl2 SYSTEM sdl2.cpp)
pybind11_add_module(magnum_platform_sdl2 ${pybind11_add_module_SYSTEM} sdl2.cpp)
target_link_libraries(magnum_platform_sdl2 PRIVATE Magnum::Sdl2Application)
target_include_directories(magnum_platform_sdl2 PRIVATE
${PROJECT_SOURCE_DIR}/src
@ -49,7 +49,7 @@ if(NOT MAGNUM_BUILD_STATIC)
endif()
if(Magnum_WindowlessEglApplication_FOUND)
pybind11_add_module(magnum_platform_egl SYSTEM egl.cpp)
pybind11_add_module(magnum_platform_egl ${pybind11_add_module_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
@ -59,7 +59,7 @@ if(NOT MAGNUM_BUILD_STATIC)
endif()
if(Magnum_WindowlessGlxApplication_FOUND)
pybind11_add_module(magnum_platform_glx SYSTEM glx.cpp)
pybind11_add_module(magnum_platform_glx ${pybind11_add_module_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

Loading…
Cancel
Save