From 2577b55681a97f3eec3fb0e3b5a4fb7f2cb18b8a Mon Sep 17 00:00:00 2001 From: manuel Date: Thu, 30 Aug 2018 00:42:04 +0200 Subject: sync with upstream --- cmake/modules/FindGBM.cmake | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'cmake/modules/FindGBM.cmake') diff --git a/cmake/modules/FindGBM.cmake b/cmake/modules/FindGBM.cmake index ac95241..37a26a7 100644 --- a/cmake/modules/FindGBM.cmake +++ b/cmake/modules/FindGBM.cmake @@ -2,7 +2,7 @@ # ---------- # Finds the GBM library # -# This will will define the following variables:: +# This will define the following variables:: # # GBM_FOUND - system has GBM # GBM_INCLUDE_DIRS - the GBM include directory @@ -29,11 +29,35 @@ find_package_handle_standard_args(GBM REQUIRED_VARS GBM_LIBRARY GBM_INCLUDE_DIR VERSION_VAR GBM_VERSION) +include(CheckCSourceCompiles) +set(CMAKE_REQUIRED_LIBRARIES ${GBM_LIBRARY}) +check_c_source_compiles("#include + + int main() + { + gbm_bo_map(NULL, 0, 0, 0, 0, GBM_BO_TRANSFER_WRITE, NULL, NULL); + } + " GBM_HAS_BO_MAP) + +check_c_source_compiles("#include + + int main() + { + gbm_surface_create_with_modifiers(NULL, 0, 0, 0, NULL, 0); + } + " GBM_HAS_MODIFIERS) + if(GBM_FOUND) set(GBM_LIBRARIES ${GBM_LIBRARY}) set(GBM_INCLUDE_DIRS ${GBM_INCLUDE_DIR}) set(GBM_DEFINITIONS -DHAVE_GBM=1) - if(NOT TARGET GBM::GBM) + if(GBM_HAS_BO_MAP) + list(APPEND GBM_DEFINITIONS -DHAS_GBM_BO_MAP=1) + endif() + if(GBM_HAS_MODIFIERS) + list(APPEND GBM_DEFINITIONS -DHAS_GBM_MODIFIERS=1) + endif() + if(NOT TARGET GBM::GBM) add_library(GBM::GBM UNKNOWN IMPORTED) set_target_properties(GBM::GBM PROPERTIES IMPORTED_LOCATION "${GBM_LIBRARY}" -- cgit v1.2.3