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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. [Bernd: rebased for version 9.0.0]
  10. Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
  11. ---
  12. meson.build | 19 ++++++++++++-------
  13. meson_options.txt | 1 +
  14. src/egl/meson.build | 5 ++++-
  15. src/meson.build | 4 +++-
  16. 4 files changed, 20 insertions(+), 9 deletions(-)
  17. diff --git a/meson.build b/meson.build
  18. index e1968fab..a15699d6 100644
  19. --- a/meson.build
  20. +++ b/meson.build
  21. @@ -39,7 +39,10 @@ add_project_arguments(
  22. dep_m = cc.find_library('m', required : false)
  23. dep_winmm = cc.find_library('winmm', required : false)
  24. -dep_gl = dependency('gl')
  25. +dep_gl = dependency('gl', required : get_option('gl'))
  26. +if not dep_gl.found()
  27. + add_project_arguments('-DEGL_NO_X11=1', language: 'c')
  28. +endif
  29. dep_epoll = dependency('epoll-shim', required : false)
  30. dep_gles1 = dependency('glesv1_cm', required : get_option('gles1'))
  31. @@ -87,15 +87,17 @@
  32. dep_threads = dependency('threads')
  33. -dep_glu = dependency('glu', required : false)
  34. -# GLU is part of OpenGL.Framework
  35. -if not dep_glu.found() and host_machine.system() != 'darwin'
  36. - _glu_name = 'GLU'
  37. - if host_machine.system() == 'windows'
  38. - _glu_name = 'glu32'
  39. +if dep_gl.found()
  40. + dep_glu = dependency('glu', required : false)
  41. + # GLU is part of OpenGL.Framework
  42. + if not dep_glu.found() and host_machine.system() != 'darwin'
  43. + _glu_name = 'GLU'
  44. + if host_machine.system() == 'windows'
  45. + _glu_name = 'glu32'
  46. + endif
  47. + dep_glu = cc.find_library(_glu_name, has_headers: 'GL/glu.h',
  48. + required : dep_x11.found())
  49. endif
  50. - dep_glu = cc.find_library(_glu_name, has_headers: 'GL/glu.h',
  51. - required : dep_x11.found())
  52. endif
  53. dep_glx = dependency('glx', required: false, disabler : true)
  54. diff --git a/meson_options.txt b/meson_options.txt
  55. index ddadd2e3..f5405698 100644
  56. --- a/meson_options.txt
  57. +++ b/meson_options.txt
  58. @@ -1,5 +1,6 @@
  59. option('with-glut', type : 'string')
  60. option('egl', type : 'feature')
  61. +option('gl', type : 'feature')
  62. option('gles1', type : 'feature')
  63. option('gles2', type : 'feature')
  64. option('glut', type : 'feature')
  65. diff --git a/src/egl/meson.build b/src/egl/meson.build
  66. index d1846921..42bf8ecd 100644
  67. --- a/src/egl/meson.build
  68. +++ b/src/egl/meson.build
  69. @@ -19,7 +19,10 @@
  70. # SOFTWARE.
  71. subdir('eglut')
  72. -subdir('opengl')
  73. +
  74. +if dep_gl.found()
  75. + subdir('opengl')
  76. +endif
  77. if dep_gles1.found()
  78. subdir('opengles1')
  79. diff --git a/src/meson.build b/src/meson.build
  80. index 39cac78d..7607c6de 100644
  81. --- a/src/meson.build
  82. +++ b/src/meson.build
  83. @@ -20,7 +20,9 @@
  84. subdir('glad')
  85. -subdir('util')
  86. +if dep_gl.found()
  87. + subdir('util')
  88. +endif
  89. if dep_glut.found()
  90. subdir('demos')
  91. --
  92. 2.37.3