0001-demos-makes-opengl-an-optional-component.patch 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. From 9ec9f7b4d0ef5e799ca4cc5103163e4630d184d8 Mon Sep 17 00:00:00 2001
  2. From: Julien Olivain <ju.o@free.fr>
  3. Date: Fri, 16 Sep 2022 22:30:59 +0200
  4. Subject: [PATCH] demos: makes opengl an optional component
  5. This patch is a port of [1] for the new meson build system.
  6. [1].
  7. https://git.busybox.net/buildroot/tree/package/mesa3d-demos/0001-demos-makes-opengl-an-optional-component.patch?h=2022.08
  8. Signed-off-by: Julien Olivain <ju.o@free.fr>
  9. ---
  10. meson.build | 19 ++++++++++++-------
  11. meson_options.txt | 1 +
  12. src/egl/meson.build | 5 ++++-
  13. src/meson.build | 4 +++-
  14. 4 files changed, 20 insertions(+), 9 deletions(-)
  15. diff --git a/meson.build b/meson.build
  16. index e1968fab..a15699d6 100644
  17. --- a/meson.build
  18. +++ b/meson.build
  19. @@ -38,7 +38,10 @@ add_project_arguments(
  20. dep_m = cc.find_library('m', required : false)
  21. dep_winmm = cc.find_library('winmm', required : false)
  22. -dep_gl = dependency('gl')
  23. +dep_gl = dependency('gl', required : get_option('gl'))
  24. +if not dep_gl.found()
  25. + add_project_arguments('-DEGL_NO_X11=1', language: 'c')
  26. +endif
  27. dep_gles1 = dependency('glesv1_cm', required : get_option('gles1'))
  28. dep_gles2 = dependency('glesv2', required : get_option('gles2'))
  29. @@ -75,13 +78,15 @@ endif
  30. dep_threads = dependency('threads')
  31. -dep_glu = dependency('glu', required : dep_x11.found())
  32. -if not dep_glu.found()
  33. - _glu_name = 'GLU'
  34. - if host_machine.system() == 'windows'
  35. - _glu_name = 'glu32'
  36. +if dep_gl.found()
  37. + dep_glu = dependency('glu', required : dep_x11.found())
  38. + if not dep_glu.found()
  39. + _glu_name = 'GLU'
  40. + if host_machine.system() == 'windows'
  41. + _glu_name = 'glu32'
  42. + endif
  43. + dep_glu = cc.find_library(_glu_name, has_headers: 'GL/glu.h')
  44. endif
  45. - dep_glu = cc.find_library(_glu_name, has_headers: 'GL/glu.h')
  46. endif
  47. # GBM is needed for EGL on KMS
  48. diff --git a/meson_options.txt b/meson_options.txt
  49. index ddadd2e3..f5405698 100644
  50. --- a/meson_options.txt
  51. +++ b/meson_options.txt
  52. @@ -1,5 +1,6 @@
  53. option('with-glut', type : 'string')
  54. option('egl', type : 'feature')
  55. +option('gl', type : 'feature')
  56. option('gles1', type : 'feature')
  57. option('gles2', type : 'feature')
  58. option('osmesa', type : 'feature')
  59. diff --git a/src/egl/meson.build b/src/egl/meson.build
  60. index d1846921..42bf8ecd 100644
  61. --- a/src/egl/meson.build
  62. +++ b/src/egl/meson.build
  63. @@ -19,7 +19,10 @@
  64. # SOFTWARE.
  65. subdir('eglut')
  66. -subdir('opengl')
  67. +
  68. +if dep_gl.found()
  69. + subdir('opengl')
  70. +endif
  71. if dep_gles1.found()
  72. subdir('opengles1')
  73. diff --git a/src/meson.build b/src/meson.build
  74. index 39cac78d..7607c6de 100644
  75. --- a/src/meson.build
  76. +++ b/src/meson.build
  77. @@ -20,7 +20,9 @@
  78. subdir('glad')
  79. -subdir('util')
  80. +if dep_gl.found()
  81. + subdir('util')
  82. +endif
  83. if dep_glut.found()
  84. subdir('demos')
  85. --
  86. 2.37.3