[Mesa-dev] [PATCH kmscube] meson build support (v3)

Rob Clark robdclark at gmail.com
Mon Mar 27 15:23:32 UTC 2017


Figured I should figure out what this meson stuff is all about.  After a
bit of hunting around to find examples to look at (and interruptions) it
took maybe ~1hr to convert (for someone who never looked at meson
before).  The build speed is definitely faster even after Emil's auto-
tools improvements:

meson:
	real	0m1.310s
	user	0m2.069s
	sys	0m0.459s

autotools:
	real	0m4.489s
	user	0m3.754s
	sys	0m0.731s

(with gst / video-cube enabled, fresh build in either case so it is
including the time spent compiling .c files in both cases)

Signed-off-by: Rob Clark <robdclark at gmail.com>
Reviewed-by: Eric Engestrom <eric at engestrom.ch>
Tested-by: Eric Engestrom <eric at engestrom.ch>
---
Updated with feedback from various folks.. also tried to make the gst
support configurable.. which seems to work, but not sure if there is
a more canonical way to do the true/false/auto thing.

 meson.build       | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 meson_options.txt |  5 +++++
 2 files changed, 58 insertions(+)
 create mode 100644 meson.build
 create mode 100644 meson_options.txt

diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..231e34c
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,53 @@
+project('kmscube', 'c', default_options: [
+	'c_std=c99',
+	'buildtype=debug',
+	'warning_level=2',
+])
+
+cc = meson.get_compiler('c')
+
+srcs = [
+	'common.c',
+	'common.h',
+	'cube-smooth.c',
+	'cube-tex.c',
+	'drm-atomic.c',
+	'drm-common.c',
+	'drm-common.h',
+	'drm-legacy.c',
+	'esTransform.c',
+	'esUtil.h',
+	'frame-512x512-NV12.c',
+	'frame-512x512-RGBA.c',
+	'kmscube.c'
+]
+
+deps = [
+	dependency('libdrm'),
+	dependency('gbm', version: '>= 17.0'),
+	dependency('egl'),
+	dependency('glesv2'),
+	cc.find_library('m')
+]
+
+gst_option = get_option('gstreamer')
+if gst_option != 'false'
+	gst = dependency('
+		gstreamer-1.0
+		gstreamer-plugins-base-1.0
+		gstreamer-app-1.0
+		gstreamer-allocators-1.0
+		gstreamer-video-1.0
+		glib-2.0',
+		required: gst_option == 'true')
+	if gst.found()
+		message('Building video-cube')
+		deps += [gst, dependency('threads')]
+		srcs += ['cube-video.c', 'gst-decoder.c']
+		add_global_arguments('-DHAVE_GST=1', language: 'c')
+	endif
+endif
+
+executable('kmscube', srcs,
+	dependencies: deps,
+	install: true)
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..d9cc42b
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,5 @@
+option('gstreamer',
+	type: 'combo',
+	choices: ['true', 'false', 'auto'],
+	value: 'auto',
+	description: 'Enable GStreamer video decoder (default: auto)')
-- 
2.9.3



More information about the mesa-dev mailing list