[Mesa-dev] [PATCH kmscube 3/3] meson build support (v2)

Rob Clark robdclark at gmail.com
Sun Mar 26 13:59:51 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>
---
 meson.build | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100644 meson.build

diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..be83e7b
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,48 @@
+project('kmscube', 'c', default_options: [
+	'c_std=c99',
+	'buildtype=debugoptimized'
+])
+
+# Maybe some of these could be default_options?  I couldn't find
+# a good list of what options are supported.
+add_global_arguments('-O0', language: 'c')
+add_global_arguments('-Wall', language: 'c')
+add_global_arguments('-Wextra', language: 'c')
+
+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'),
+	dependency('egl'),
+	dependency('glesv2'),
+	cc.find_library('m')
+]
+
+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')
+if gst.found()
+	message('Building video-cube')
+	deps = deps + [gst, dependency('threads')]
+	srcs = srcs + ['cube-video.c', 'gst-decoder.c']
+	add_global_arguments('-DHAVE_GST=1', language: 'c')
+endif
+
+executable('kmscube', srcs,
+	dependencies: deps,
+	install: true)
-- 
2.9.3



More information about the mesa-dev mailing list