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

Dylan Baker dylan at pnwbakers.com
Sat Mar 25 20:53:30 UTC 2017


Quoting Rob Clark (2017-03-25 13:11:46)
> 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 | 44 ++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 44 insertions(+)
>  create mode 100644 meson.build
> 
> diff --git a/meson.build b/meson.build
> new file mode 100644
> index 0000000..08e14b6
> --- /dev/null
> +++ b/meson.build
> @@ -0,0 +1,44 @@
> +project('kmscube', '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, cc.find_library('pthread')]
> +       srcs = srcs + ['cube-video.c', 'gst-decoder.c']
> +       add_global_arguments('-DHAVE_GST=1', language: 'c')
> +endif
> +
> +add_global_arguments('-O0', language: 'c')
> +add_global_arguments('-Wall', language: 'c')
> +add_global_arguments('-Wextra', language: 'c')
> +add_global_arguments('-std=c99', language: 'c')

You probably want to set at least a few of these (the std) in the project() command,
project(..., default_options : ['c_std=c99'[)

For reference you can set both c and c++ std using
['c_std=c99', 'cpp_std=c++11'], for projects that use both c and c++.

Dylan

> +
> +executable('kmscube', srcs,
> +       dependencies: deps,
> +       install: true)
> -- 
> 2.9.3
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170325/4fe3e041/attachment.sig>


More information about the mesa-dev mailing list