blob: 6f1ad93e04f50d2f117cd5823a2abaa3287a6ebe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
From c69500c88058358bdc6c0a036d90b000d63f2a41 Mon Sep 17 00:00:00 2001
From: "Ung, Teng En" <teng.en.ung@intel.com>
Date: Wed, 3 Nov 2021 14:23:15 +0000
Subject: [PATCH 4/4] samples: use find_program to detect wayland-scanner in
cmake
Upstream-Status: Submitted
innersource PR #269
---
tools/legacy/sample_common/CMakeLists.txt | 4 +-
tools/legacy/sample_misc/wayland/CMakeLists.txt | 59 +++++++++++--------------
2 files changed, 28 insertions(+), 35 deletions(-)
diff --git a/tools/legacy/sample_common/CMakeLists.txt b/tools/legacy/sample_common/CMakeLists.txt
index 0ed8b39..658d44d 100644
--- a/tools/legacy/sample_common/CMakeLists.txt
+++ b/tools/legacy/sample_common/CMakeLists.txt
@@ -93,10 +93,10 @@ if(UNIX)
${TARGET}
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../sample_misc/wayland/include)
- pkg_check_modules(PKG_WAYLAND_SCANNER "wayland-scanner>=1.15")
+ find_program(WAYLAND_SCANNER_BIN "wayland-scanner")
pkg_check_modules(PKG_WAYLAND_PROTCOLS "wayland-protocols>=1.15")
- if(PKG_WAYLAND_SCANNER_FOUND AND PKG_WAYLAND_PROTCOLS_FOUND)
+ if(WAYLAND_SCANNER_BIN AND PKG_WAYLAND_PROTCOLS_FOUND)
pkg_get_variable(WAYLAND_PROTOCOLS_PATH wayland-protocols pkgdatadir)
if(WAYLAND_PROTOCOLS_PATH)
find_file(
diff --git a/tools/legacy/sample_misc/wayland/CMakeLists.txt b/tools/legacy/sample_misc/wayland/CMakeLists.txt
index 01e6029..7625bc5 100644
--- a/tools/legacy/sample_misc/wayland/CMakeLists.txt
+++ b/tools/legacy/sample_misc/wayland/CMakeLists.txt
@@ -29,43 +29,36 @@ target_sources(
${CMAKE_CURRENT_SOURCE_DIR}/src/listener_wayland.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/wayland-drm-protocol.c)
-if(PKG_WAYLAND_SCANNER_FOUND AND PKG_WAYLAND_PROTCOLS_FOUND AND WAYLAND_LINUX_DMABUF_XML_PATH)
- pkg_get_variable(WAYLAND_SCANNER_BIN_PATH wayland-scanner bindir)
- pkg_get_variable(WAYLAND_SCANNER_BIN wayland-scanner wayland_scanner)
+ if(WAYLAND_SCANNER_BIN AND PKG_WAYLAND_PROTCOLS_FOUND AND WAYLAND_LINUX_DMABUF_XML_PATH)
- if(WAYLAND_SCANNER_BIN_PATH AND WAYLAND_SCANNER_BIN)
- execute_process(
- COMMAND "${WAYLAND_SCANNER_BIN_PATH}\/${WAYLAND_SCANNER_BIN}"
- "client-header" "${WAYLAND_LINUX_DMABUF_XML_PATH}"
- "tools/legacy/sample_misc/wayland/linux-dmabuf-unstable-v1.h"
- WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
- RESULT_VARIABLE WAYLAND_SCANNER_RESULT)
- if (WAYLAND_SCANNER_RESULT)
- message(ERROR "Failed to generate linux-dmabuf-unstable-v1.h")
- return()
- endif()
-
- execute_process(
- COMMAND "${WAYLAND_SCANNER_BIN_PATH}\/${WAYLAND_SCANNER_BIN}"
- "private-code" "${WAYLAND_LINUX_DMABUF_XML_PATH}"
- "tools/legacy/sample_misc/wayland/linux-dmabuf-unstable-v1.c"
- WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
- RESULT_VARIABLE WAYLAND_SCANNER_RESULT)
- if (WAYLAND_SCANNER_RESULT)
- message(ERROR "Failed to generate linux-dmabuf-unstable-v1.c")
- return()
- endif()
+ execute_process(
+ COMMAND "${WAYLAND_SCANNER_BIN}"
+ "client-header" "${WAYLAND_LINUX_DMABUF_XML_PATH}"
+ "tools/legacy/sample_misc/wayland/linux-dmabuf-unstable-v1.h"
+ WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
+ RESULT_VARIABLE WAYLAND_SCANNER_RESULT)
+ if (WAYLAND_SCANNER_RESULT)
+ message(ERROR "Failed to generate linux-dmabuf-unstable-v1.h")
+ return()
+ endif()
- include_directories(
- ${CMAKE_BINARY_DIR}/tools/legacy/sample_misc/wayland)
- add_definitions(-DWAYLAND_LINUX_DMABUF_SUPPORT)
- target_sources(
- ${TARGET}
- PRIVATE ${CMAKE_BINARY_DIR}/tools/legacy/sample_misc/wayland/linux-dmabuf-unstable-v1.c)
- else()
- message(ERROR "Don't know how to execute wayland-scanner.")
+ execute_process(
+ COMMAND "${WAYLAND_SCANNER_BIN}"
+ "private-code" "${WAYLAND_LINUX_DMABUF_XML_PATH}"
+ "tools/legacy/sample_misc/wayland/linux-dmabuf-unstable-v1.c"
+ WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
+ RESULT_VARIABLE WAYLAND_SCANNER_RESULT)
+ if (WAYLAND_SCANNER_RESULT)
+ message(ERROR "Failed to generate linux-dmabuf-unstable-v1.c")
return()
endif()
+
+ include_directories(
+ ${CMAKE_BINARY_DIR}/tools/legacy/sample_misc/wayland)
+ add_definitions(-DWAYLAND_LINUX_DMABUF_SUPPORT)
+ target_sources(
+ ${TARGET}
+ PRIVATE ${CMAKE_BINARY_DIR}/tools/legacy/sample_misc/wayland/linux-dmabuf-unstable-v1.c)
endif()
target_link_libraries(${TARGET} sample_common wayland-client va drm drm_intel)
--
2.7.4
|