From 12e4b63d2861945c4860fbf7f9751199a1a1bd2e Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Tue, 18 Aug 2020 19:07:47 +0200 Subject: [PATCH] CMake Build: Fix libdrm detection and compilation on QNX On QNX 7.1 x86drm.h is located under <...>/usr/include/libdrm, unlike linux where it's present under /usr/include. find_path would not find it on QNX, and instead get /usr/include from host, which resulted in a failure to compile. Task-number: QTBUG-83202 Change-Id: I03d6c2d4dfbe91bb70df0a322e84890bd7c8548a Reviewed-by: Alexandru Croitor --- cmake/3rdparty/kwin/FindLibdrm.cmake | 16 +++++++++------- .../eglfs_kms_egldevice/CMakeLists.txt | 7 +++++++ .../eglfs_kms_support/CMakeLists.txt | 7 +++++++ 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/cmake/3rdparty/kwin/FindLibdrm.cmake b/cmake/3rdparty/kwin/FindLibdrm.cmake index 48598e061b8..a94e7fbcb60 100644 --- a/cmake/3rdparty/kwin/FindLibdrm.cmake +++ b/cmake/3rdparty/kwin/FindLibdrm.cmake @@ -78,6 +78,8 @@ if(NOT WIN32) xf86drm.h HINTS ${PKG_Libdrm_INCLUDE_DIRS} + PATH_SUFFIXES + libdrm ) find_library(Libdrm_LIBRARY NAMES @@ -103,14 +105,14 @@ if(NOT WIN32) IMPORTED_LOCATION "${Libdrm_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${Libdrm_DEFINITIONS}" INTERFACE_INCLUDE_DIRECTORIES "${Libdrm_INCLUDE_DIR}" - INTERFACE_INCLUDE_DIRECTORIES "${Libdrm_INCLUDE_DIR}/libdrm" ) - if(EXISTS "${Libdrm_INCLUDE_DIR}/drm") - set_property(TARGET Libdrm::Libdrm APPEND PROPERTY - INTERFACE_INCLUDE_DIRECTORIES "${Libdrm_INCLUDE_DIR}/drm" - ) - endif() - + foreach(suffix libdrm drm) + if(EXISTS "${Libdrm_INCLUDE_DIR}/${suffix}") + set_property(TARGET Libdrm::Libdrm APPEND PROPERTY + INTERFACE_INCLUDE_DIRECTORIES "${Libdrm_INCLUDE_DIR}/${suffix}" + ) + endif() + endforeach() endif() mark_as_advanced(Libdrm_LIBRARY Libdrm_INCLUDE_DIR) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/CMakeLists.txt b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/CMakeLists.txt index 6f1d5f67511..61ae1b932ab 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/CMakeLists.txt +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/CMakeLists.txt @@ -30,3 +30,10 @@ qt_internal_add_plugin(QEglFSKmsEglDeviceIntegrationPlugin #### Keys ignored in scope 1:.:.:eglfs_kms_egldevice.pro:: # OTHER_FILES = "$$PWD/eglfs_kms_egldevice.json" + +# begin special case +qt_extend_target(QEglFSKmsEglDeviceIntegrationPlugin + CONDITION QNX + COMPILE_OPTIONS -fpermissive +) +# end special case diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/CMakeLists.txt b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/CMakeLists.txt index ec11b355af2..0090dbb1eed 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/CMakeLists.txt +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/CMakeLists.txt @@ -26,3 +26,10 @@ qt_add_module(EglFsKmsSupport Qt::GuiPrivate Qt::KmsSupportPrivate ) + +# begin special case +qt_extend_target(EglFsKmsSupport + CONDITION QNX + COMPILE_OPTIONS -fpermissive +) +# end special case