[Mesa-dev] [PATCH kmscube 3/3] meson build support (v2)
Eric Engestrom
eric at engestrom.ch
Mon Mar 27 03:54:17 UTC 2017
On Sunday, 2017-03-26 09:59:51 -0400, Rob Clark wrote:
> 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']
`+=` to avoid risking typos/forgetting to change when copy/pasting :)
> + add_global_arguments('-DHAVE_GST=1', language: 'c')
> +endif
> +
> +executable('kmscube', srcs,
> + dependencies: deps,
> + install: true)
> --
> 2.9.3
>
If/when you commit this, I suggest removing the old build-system, so as
to avoid having to maintain both in parallel. Of course, you can keep
both around for a while, but this is a demo/teaching project, not
a production project, so I don't think it's necessary to do that :)
#1 could use the precision 'MIT licence' in the title to save googling
it, but is:
Acked-by: Eric Engestrom <eric at engestrom.ch>
I had a look at #2, and I didn't see anything wrong, but it's definitely
out of my area of expertise.
#3 is:
Reviewed-by: Eric Engestrom <eric at engestrom.ch>
Tested-by: Eric Engestrom <eric at engestrom.ch>
Cheers,
Eric
More information about the mesa-dev
mailing list