@@ -593,6 +593,10 @@ macro(CheckX11)
593
593
set (CMAKE_REQUIRED_LIBRARIES)
594
594
endif ()
595
595
endif ()
596
+ if (NOT HAVE_VIDEO_X11)
597
+ # Prevent Mesa from including X11 headers
598
+ list (APPEND EXTRA_CFLAGS "-DMESA_EGL_NO_X11_HEADERS -DEGL_NO_X11" )
599
+ endif ()
596
600
endmacro ()
597
601
598
602
macro (WaylandProtocolGen _SCANNER _CODE_MODE _XML _PROTL)
@@ -627,7 +631,7 @@ macro(CheckWayland)
627
631
pkg_check_modules(WAYLAND wayland-client wayland-scanner wayland-egl wayland-cursor egl xkbcommon)
628
632
pkg_check_modules(WAYLAND_SCANNER_1_15 "wayland-scanner>=1.15" )
629
633
630
- if (WAYLAND_FOUND)
634
+ if (WAYLAND_FOUND AND HAVE_VIDEO_OPENGL_EGL )
631
635
execute_process (
632
636
COMMAND ${PKG_CONFIG_EXECUTABLE} --variable =wayland_scanner wayland-scanner
633
637
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR} "
@@ -777,98 +781,76 @@ macro(CheckVivante)
777
781
endif (VIDEO_VIVANTE)
778
782
endmacro (CheckVivante)
779
783
780
- # Requires:
781
- # - libglvnd
782
- macro (CheckOpenGLKMSDRM)
783
- if (VIDEO_OPENGL AND HAVE_VIDEO_KMSDRM)
784
- check_c_source_compiles("
785
- #include <GL/gl.h>
786
- int main(int argc, char** argv) {}" HAVE_VIDEO_OPENGL)
787
-
788
- if (HAVE_VIDEO_OPENGL)
789
- set (HAVE_VIDEO_OPENGL TRUE )
790
- set (SDL_VIDEO_OPENGL 1)
791
- set (SDL_VIDEO_RENDER_OGL 1)
792
- endif ()
793
- endif ()
794
- endmacro ()
795
-
796
784
# Requires:
797
785
# - nada
798
- macro (CheckOpenGLX11 )
786
+ macro (CheckGLX )
799
787
if (VIDEO_OPENGL)
800
788
check_c_source_compiles("
801
- #include <GL/gl.h>
802
789
#include <GL/glx.h>
803
- int main(int argc, char** argv) {}" HAVE_VIDEO_OPENGL)
804
-
805
- if (HAVE_VIDEO_OPENGL)
806
- set (HAVE_VIDEO_OPENGL TRUE )
807
- set (SDL_VIDEO_OPENGL 1)
790
+ int main(int argc, char** argv) {}" HAVE_VIDEO_OPENGL_GLX)
791
+ if (HAVE_VIDEO_OPENGL_GLX)
808
792
set (SDL_VIDEO_OPENGL_GLX 1)
809
- set (SDL_VIDEO_RENDER_OGL 1)
810
793
endif ()
811
794
endif ()
812
795
endmacro ()
813
796
814
797
# Requires:
815
798
# - PkgCheckModules
816
799
macro (CheckEGL)
817
- pkg_check_modules(EGL egl)
818
- string (REPLACE "-D_THREAD_SAFE;" "-D_THREAD_SAFE=1;" EGL_CFLAGS "${EGL_CFLAGS} " )
819
- endmacro ()
820
-
821
- # Requires:
822
- # - PkgCheckModules
823
- macro (CheckEGLKMSDRM)
824
- if (HAVE_VIDEO_OPENGLES OR HAVE_VIDEO_OPENGL)
825
- CheckEGL()
800
+ if (VIDEO_OPENGL OR VIDEO_OPENGLES)
801
+ pkg_check_modules(EGL egl)
802
+ string (REPLACE "-D_THREAD_SAFE;" "-D_THREAD_SAFE=1;" EGL_CFLAGS "${EGL_CFLAGS} " )
826
803
set (CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${EGL_CFLAGS} " )
827
804
check_c_source_compiles("
828
- #define EGL_API_FB
829
- #define MESA_EGL_NO_X11_HEADERS
830
- #define EGL_NO_X11
831
- #include <EGL/egl.h>
832
- #include <EGL/eglext.h>
833
- int main (int argc, char** argv) {}" HAVE_VIDEO_OPENGL_EGL)
805
+ #define EGL_API_FB
806
+ #define MESA_EGL_NO_X11_HEADERS
807
+ #define EGL_NO_X11
808
+ #include <EGL/egl.h>
809
+ #include <EGL/eglext.h>
810
+ int main (int argc, char** argv) {}" HAVE_VIDEO_OPENGL_EGL)
834
811
if (HAVE_VIDEO_OPENGL_EGL)
835
- set (SDL_VIDEO_OPENGL_EGL 1)
812
+ set (SDL_VIDEO_OPENGL_EGL 1)
836
813
endif ()
837
814
endif ()
838
815
endmacro ()
839
816
840
817
# Requires:
841
- # - PkgCheckModules
842
- macro (CheckOpenGLESX11)
843
- CheckEGL()
844
- set (CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${EGL_CFLAGS} " )
845
- if (VIDEO_OPENGLES)
818
+ # - nada
819
+ macro (CheckOpenGL)
820
+ if (VIDEO_OPENGL)
846
821
check_c_source_compiles("
847
- #define EGL_API_FB
848
- #include <EGL/egl.h>
849
- int main (int argc, char** argv) {}" HAVE_VIDEO_OPENGL_EGL)
850
- if (HAVE_VIDEO_OPENGL_EGL)
851
- set (SDL_VIDEO_OPENGL_EGL 1)
822
+ #include <GL/gl.h>
823
+ #include <GL/glext.h>
824
+ int main(int argc, char** argv) {}" HAVE_VIDEO_OPENGL)
825
+ if (HAVE_VIDEO_OPENGL)
826
+ set (SDL_VIDEO_OPENGL 1)
827
+ set (SDL_VIDEO_RENDER_OGL 1)
852
828
endif ()
829
+ endif ()
830
+ endmacro ()
831
+
832
+ # Requires:
833
+ # - nada
834
+ macro (CheckOpenGLES)
835
+ if (VIDEO_OPENGLES)
853
836
check_c_source_compiles("
854
- #include <GLES/gl.h>
855
- #include <GLES/glext.h>
856
- int main (int argc, char** argv) {}" HAVE_VIDEO_OPENGLES_V1)
837
+ #include <GLES/gl.h>
838
+ #include <GLES/glext.h>
839
+ int main (int argc, char** argv) {}" HAVE_VIDEO_OPENGLES_V1)
857
840
if (HAVE_VIDEO_OPENGLES_V1)
858
841
set (HAVE_VIDEO_OPENGLES TRUE )
859
842
set (SDL_VIDEO_OPENGL_ES 1)
860
843
set (SDL_VIDEO_RENDER_OGL_ES 1)
861
844
endif ()
862
845
check_c_source_compiles("
863
- #include <GLES2/gl2.h>
864
- #include <GLES2/gl2ext.h>
865
- int main (int argc, char** argv) {}" HAVE_VIDEO_OPENGLES_V2)
846
+ #include <GLES2/gl2.h>
847
+ #include <GLES2/gl2ext.h>
848
+ int main (int argc, char** argv) {}" HAVE_VIDEO_OPENGLES_V2)
866
849
if (HAVE_VIDEO_OPENGLES_V2)
867
850
set (HAVE_VIDEO_OPENGLES TRUE )
868
851
set (SDL_VIDEO_OPENGL_ES2 1)
869
852
set (SDL_VIDEO_RENDER_OGL_ES2 1)
870
853
endif ()
871
-
872
854
endif ()
873
855
endmacro ()
874
856
0 commit comments