[PATCH] Autodetect libdrm path (v2)

StDenis, Tom Tom.StDenis at amd.com
Sun Feb 5 22:42:46 UTC 2017


Thanks.  Pushed it.


Tom


________________________________
From: Andres Rodriguez <andresx7 at gmail.com>
Sent: Sunday, February 5, 2017 17:28
To: Tom St Denis; amd-gfx at lists.freedesktop.org
Cc: StDenis, Tom
Subject: Re: [PATCH] Autodetect libdrm path (v2)

Reviewed-by: Andres Rodriguez<andresx7 at gmail.com>

On 2/5/2017 5:24 PM, Tom St Denis wrote:
> (v2):  Use findLibDRM script instead of directly finding path
>
> Signed-off-by: Tom St Denis <tom.stdenis at amd.com>
> ---
>  CMakeLists.txt                 |  3 +++
>  cmake_modules/FindLibDRM.cmake | 35 +++++++++++++++++++++++++++++++++++
>  src/lib/query_drm.c            |  4 ++--
>  3 files changed, 40 insertions(+), 2 deletions(-)
>  create mode 100644 cmake_modules/FindLibDRM.cmake
>
> diff --git a/CMakeLists.txt b/CMakeLists.txt
> index bef94fdba788..ef78c97ad763 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -25,6 +25,9 @@ include_directories(${CURSES_INCLUDE_DIRS})
>  find_package(PCIAccess REQUIRED)
>  include_directories(${PCIACCESS_INCLUDE_DIR})
>
> +find_package(LibDRM REQUIRED)
> +include_directories(${LIBDRM_INCLUDE_DIR})
> +
>  set(REQUIRED_EXTERNAL_LIBS
>    ${CURSES_LIBRARIES}
>    ${PCIACCESS_LIBRARIES}
> diff --git a/cmake_modules/FindLibDRM.cmake b/cmake_modules/FindLibDRM.cmake
> new file mode 100644
> index 000000000000..e840c4d1bfd0
> --- /dev/null
> +++ b/cmake_modules/FindLibDRM.cmake
> @@ -0,0 +1,35 @@
> +# Try to find libdrm
> +#
> +# Once done, this will define
> +#
> +# LIBDRM_FOUND
> +# LIBDRM_INCLUDE_DIR
> +# LIBDRM_LIBRARIES
> +
> +find_package(PkgConfig)
> +
> +pkg_check_modules(PC_LIBDRM QUIET libdrm)
> +
> +find_path(LIBDRM_INCLUDE_DIR NAMES amdgpu_drm.h
> +    HINTS
> +    ${PC_LIBDRM_INCLUDEDIR}
> +    ${PC_LIBDRM_INCLUDE_DIRS}
> +    /usr/include
> +)
> +
> +find_library(LIBDRM_LIBRARY NAMES libdrm_amdgpu.so.1
> +    HINTS
> +    ${PC_LIBDRM_LIBDIR}
> +    ${PC_LIBDRM_LIBRARY_DIRS}
> +    /usr/lib64
> +    /usr/lib
> +)
> +
> +SET(LIBDRM_LIBRARIES optimized ${LIBDRM_LIBRARY})
> +
> +include(FindPackageHandleStandardArgs)
> +find_package_handle_standard_args(LIBDRM DEFAULT_MSG
> +     LIBDRM_LIBRARIES LIBDRM_INCLUDE_DIR
> +)
> +
> +mark_as_advanced(LIBDRM_INCLUDE_DIR LIBDRM_LIBRARIES)
> diff --git a/src/lib/query_drm.c b/src/lib/query_drm.c
> index b9d80a8fc0c8..755c65fbc662 100644
> --- a/src/lib/query_drm.c
> +++ b/src/lib/query_drm.c
> @@ -25,8 +25,8 @@
>  #include "umr.h"
>  #include <asm/ioctl.h>
>  #include <sys/ioctl.h>
> -#include <drm/drm.h>
> -#include <drm/amdgpu_drm.h>
> +#include <drm.h>
> +#include <amdgpu_drm.h>
>
>  #define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size)
>  #define DRM_IOC_WRITE           _IOC_WRITE
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20170205/2ba93bac/attachment.html>


More information about the amd-gfx mailing list