meson-add-back-default-driver-option.patch 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. From 0b81a53752dcf17a0b2b8cfe4c106f03edd2fe0e Mon Sep 17 00:00:00 2001
  2. From: David Mohammed <fossfreedom@ubuntu.com>
  3. Date: Tue, 15 Aug 2023 19:56:55 +0100
  4. Subject: [PATCH] meson: add back default_driver option n autotools it was
  5. possible to pass the --with-default-driver option to force the usage of a
  6. specific cogl driver at build time.
  7. Expose this functionality in meson as well
  8. Origin: https://gitlab.gnome.org/GNOME/mutter/merge_requests/392
  9. Forwarded: yes
  10. ---
  11. cogl/cogl-config.h.meson | 3 +++
  12. cogl/meson.build | 4 ++++
  13. meson.build | 3 +++
  14. meson_options.txt | 6 ++++++
  15. 4 files changed, 16 insertions(+)
  16. diff --git a/cogl/cogl-config.h.meson b/cogl/cogl-config.h.meson
  17. index 29ca42981f..85fd0c64f3 100644
  18. --- a/cogl/cogl-config.h.meson
  19. +++ b/cogl/cogl-config.h.meson
  20. @@ -10,4 +10,7 @@
  21. /* Enable unit tests */
  22. #mesondefine ENABLE_UNIT_TESTS
  23. +/* Default COGL driver */
  24. +#mesondefine COGL_DEFAULT_DRIVER
  25. +
  26. #define COGL_CONFIG_H_INCLUDED 1
  27. diff --git a/cogl/meson.build b/cogl/meson.build
  28. index a87cd18235..6a606482f9 100644
  29. --- a/cogl/meson.build
  30. +++ b/cogl/meson.build
  31. @@ -10,6 +10,10 @@ cdata.set('HAVE_COGL_GLES2', have_gles2)
  32. cdata.set('HAVE_TRACING', have_profiler)
  33. cdata.set('ENABLE_UNIT_TESTS', have_cogl_tests)
  34. +if default_driver != 'auto'
  35. + cdata.set_quoted('COGL_DEFAULT_DRIVER', default_driver)
  36. +endif
  37. +
  38. cogl_config_h = configure_file(
  39. input: 'cogl-config.h.meson',
  40. output: 'cogl-config.h',
  41. diff --git a/meson.build b/meson.build
  42. index 2e568d36df..015599d84d 100644
  43. --- a/meson.build
  44. +++ b/meson.build
  45. @@ -273,6 +273,8 @@ if have_wayland_eglstream
  46. endif
  47. endif
  48. +default_driver = get_option('default_driver')
  49. +
  50. have_sm = get_option('sm')
  51. if have_sm
  52. sm_dep = dependency('sm')
  53. @@ -671,6 +673,7 @@ summary('X11', have_x11, section: 'Options')
  54. #summary('XWayland', have_xwayland, section: 'Options')
  55. summary('Native Backend', have_native_backend, section: 'Options')
  56. summary('EGL Device', have_egl_device, section: 'Options')
  57. +summary('Default driver', default_driver, section: 'Options')
  58. summary('Remote desktop', have_remote_desktop, section: 'Options')
  59. summary('libgnome-desktop', have_gnome_desktop, section: 'Options')
  60. summary('Sound player', have_sound_player, section: 'Options')
  61. diff --git a/meson_options.txt b/meson_options.txt
  62. index f7290f1565..b18f409582 100644
  63. --- a/meson_options.txt
  64. +++ b/meson_options.txt
  65. @@ -230,3 +230,9 @@ option('with_example_wm',
  66. value: false,
  67. description: 'Build example window manager'
  68. )
  69. +
  70. +option('default_driver',
  71. + type: 'combo',
  72. + choices: ['auto', 'gl', 'gl3', 'gles2', 'nop'],
  73. + value: 'auto'
  74. +)