<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<p>Hi Andres,</p>
<p><br>
</p>
<p>Oh I can see how that's much simpler than a Makefile <img class="EmojiInsert" id="OWAEmoji783873" alt="😊" style="vertical-align: bottom;" src="cid:e79b45e7-7642-4a3f-abfa-3ae25864cbec"> (100 lines of "find libdrm" later...). </p>
<p><br>
</p>
<p>I'd rather not wholesale rip off KDE since their license (appears to be BSDish) is different. </p>
<p><br>
</p>
<p>I may just clone the one Edward provided as you suggested instead.</p>
<p><br>
</p>
<p>Tom</p>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Andres Rodriguez <andresx7@gmail.com><br>
<b>Sent:</b> Sunday, February 5, 2017 16:26<br>
<b>To:</b> Tom St Denis; amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> StDenis, Tom<br>
<b>Subject:</b> Re: [PATCH] autodetect path to libdrm</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">Hey Tom,<br>
<br>
Overall in cmake calling pkg_check_modules() directly is usually not a<br>
good practice. The common approach is to have a file in<br>
cmake/modules/Find$(name).cmake that takes care of everything.<br>
<br>
For example, you could use this FindLibdrm.cmake from the KDE project:<br>
<a href="https://github.com/KDE/kwin/blob/master/cmake/modules/FindLibdrm.cmake" id="LPlnk853974" previewremoved="true">https://github.com/KDE/kwin/blob/master/cmake/modules/FindLibdrm.cmake</a>
<div id="LPBorder_GT_14863314491400.3266837289036184" style="margin-bottom: 20px; overflow: auto; width: 100%; text-indent: 0px;">
<table id="LPContainer_14863314491360.23251578702446163" cellspacing="0" style="width: 90%; background-color: rgb(255, 255, 255); position: relative; overflow: auto; padding-top: 20px; padding-bottom: 20px; margin-top: 20px; border-top: 1px dotted rgb(200, 200, 200); border-bottom: 1px dotted rgb(200, 200, 200);">
<tbody>
<tr valign="top" style="border-spacing: 0px;">
<td id="ImageCell_14863314491370.9415047857926189" colspan="1" style="width: 250px; position: relative; display: table-cell; padding-right: 20px;">
<div id="LPImageContainer_14863314491370.973940285275452" style="background-color: rgb(255, 255, 255); height: 128px; position: relative; margin: auto; display: table; width: 128px;">
<a id="LPImageAnchor_14863314491380.44843371590227443" href="https://github.com/KDE/kwin/blob/master/cmake/modules/FindLibdrm.cmake" target="_blank" style="display: table-cell; text-align: center;"><img aria-label="Preview image with link selected. Double-tap to open the link." id="LPThumbnailImageID_14863314491380.184524212352823" width="128" height="128" style="display: inline-block; max-width: 250px; max-height: 250px; height: 128px; width: 128px; border-width: 0px; vertical-align: bottom;" src="https://avatars1.githubusercontent.com/u/14312869?v=3&s=400"></a></div>
</td>
<td id="TextCell_14863314491380.9261600004914521" colspan="2" style="vertical-align: top; position: relative; padding: 0px; display: table-cell;">
<div id="LPRemovePreviewContainer_14863314491380.18681304615791383"></div>
<div id="LPTitle_14863314491380.4078901055148296" style="top: 0px; color: rgb(59, 87, 119); font-weight: normal; font-size: 21px; font-family: wf_segoe-ui_light, "Segoe UI Light", "Segoe WP Light", "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; line-height: 21px;">
<a id="LPUrlAnchor_14863314491390.6694582062640435" href="https://github.com/KDE/kwin/blob/master/cmake/modules/FindLibdrm.cmake" target="_blank" style="text-decoration: none;">KDE/kwin</a></div>
<div id="LPMetadata_14863314491390.9257390175374733" style="margin: 10px 0px 16px; color: rgb(102, 102, 102); font-weight: normal; font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; font-size: 14px; line-height: 14px;">
github.com</div>
<div id="LPDescription_14863314491390.00395181714752546" style="display: block; color: rgb(102, 102, 102); font-weight: normal; font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; font-size: 14px; line-height: 20px; max-height: 100px; overflow: hidden;">
kwin - This repository has no description</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
<br>
<br>
Alternatively a simple modification of the FindPCIAccess.cmake file that<br>
Edward sent out could also work.<br>
<br>
Sorry for the late feedback on a Sunday.<br>
<br>
Regards,<br>
Andres<br>
<br>
On 2/5/2017 10:34 AM, Tom St Denis wrote:<br>
> Signed-off-by: Tom St Denis <tom.stdenis@amd.com><br>
> ---<br>
> CMakeLists.txt | 4 +++-<br>
> src/lib/query_drm.c | 4 ++--<br>
> 2 files changed, 5 insertions(+), 3 deletions(-)<br>
><br>
> diff --git a/CMakeLists.txt b/CMakeLists.txt<br>
> index bef94fdba788..d2f393f0fa9b 100644<br>
> --- a/CMakeLists.txt<br>
> +++ b/CMakeLists.txt<br>
> @@ -25,6 +25,8 @@ include_directories(${CURSES_INCLUDE_DIRS})<br>
> find_package(PCIAccess REQUIRED)<br>
> include_directories(${PCIACCESS_INCLUDE_DIR})<br>
><br>
> +pkg_check_modules(DRM REQUIRED libdrm)<br>
> +<br>
> set(REQUIRED_EXTERNAL_LIBS<br>
> ${CURSES_LIBRARIES}<br>
> ${PCIACCESS_LIBRARIES}<br>
> @@ -34,7 +36,7 @@ set(REQUIRED_EXTERNAL_LIBS<br>
> set(CMAKE_POSITION_INDEPENDENT_CODE ON)<br>
><br>
> # CFLAGS += -Wall -W -O2 -g3 -Isrc/ -DPIC -fPIC<br>
> -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -W -O2 -g3")<br>
> +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${DRM_CFLAGS} -Wall -W -O2 -g3")<br>
><br>
> add_subdirectory(src)<br>
> add_subdirectory(doc)<br>
> diff --git a/src/lib/query_drm.c b/src/lib/query_drm.c<br>
> index b9d80a8fc0c8..755c65fbc662 100644<br>
> --- a/src/lib/query_drm.c<br>
> +++ b/src/lib/query_drm.c<br>
> @@ -25,8 +25,8 @@<br>
> #include "umr.h"<br>
> #include <asm/ioctl.h><br>
> #include <sys/ioctl.h><br>
> -#include <drm/drm.h><br>
> -#include <drm/amdgpu_drm.h><br>
> +#include <drm.h><br>
> +#include <amdgpu_drm.h><br>
><br>
> #define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size)<br>
> #define DRM_IOC_WRITE _IOC_WRITE<br>
><br>
</div>
</span></font></div>
</div>
</body>
</html>