diff --git a/Makefile b/Makefile index 28b77f081b..2fba3cac00 100644 --- a/Makefile +++ b/Makefile @@ -82,9 +82,11 @@ endif ifeq ($(HAVE_OSS), 1) OBJ += audio/oss.o endif + ifeq ($(HAVE_OSS_BSD), 1) OBJ += audio/oss.o endif + ifeq ($(HAVE_OSS_LIB), 1) LIBS += -lossaudio endif @@ -94,24 +96,28 @@ ifeq ($(HAVE_ALSA), 1) LIBS += $(ALSA_LIBS) DEFINES += $(ALSA_CFLAGS) endif + ifeq ($(HAVE_ROAR), 1) OBJ += audio/roar.o LIBS += $(ROAR_LIBS) DEFINES += $(ROAR_CFLAGS) endif + ifeq ($(HAVE_AL), 1) OBJ += audio/openal.o -ifeq ($(OSX),1) - LIBS += -framework OpenAL -else - LIBS += -lopenal -endif + ifeq ($(OSX),1) + LIBS += -framework OpenAL + else + LIBS += -lopenal + endif endif + ifeq ($(HAVE_JACK),1) OBJ += audio/jack.o LIBS += $(JACK_LIBS) DEFINES += $(JACK_CFLAGS) endif + ifeq ($(HAVE_PULSE), 1) OBJ += audio/pulse.o LIBS += $(PULSE_LIBS) @@ -129,43 +135,46 @@ ifeq ($(HAVE_SDL), 1) DEFINES += $(SDL_CFLAGS) $(BSD_LOCAL_INC) LIBS += $(SDL_LIBS) -ifeq ($(SCALER_NO_SIMD), 1) - DEFINES += -DSCALER_NO_SIMD -endif -ifeq ($(SCALER_PERF), 1) - DEFINES += -DSCALER_PERF -endif + ifeq ($(SCALER_NO_SIMD), 1) + DEFINES += -DSCALER_NO_SIMD + endif -ifeq ($(HAVE_X11), 1) - LIBS += $(X11_LIBS) - DEFINES += $(X11_CFLAGS) -endif + ifeq ($(SCALER_PERF), 1) + DEFINES += -DSCALER_PERF + endif -ifeq ($(HAVE_OPENGL), 1) - OBJ += gfx/gl.o gfx/fonts/freetype.o gfx/math/matrix.o + ifeq ($(HAVE_X11), 1) + LIBS += $(X11_LIBS) + DEFINES += $(X11_CFLAGS) + endif -ifeq ($(OSX),1) - LIBS += -framework OpenGL -else -ifeq ($(HAVE_GLES), 1) - LIBS += -lGLESv2 -lEGL - DEFINES += -DHAVE_OPENGLES -DHAVE_OPENGLES2 -else - LIBS += -lGL - OBJ += gfx/context/sdl_ctx.o -endif -endif -endif -endif + ifeq ($(HAVE_OPENGL), 1) + OBJ += gfx/gl.o gfx/fonts/freetype.o gfx/math/matrix.o -ifeq ($(HAVE_KMS), 1) - OBJ += gfx/context/drm_egl_ctx.o - DEFINES += $(GBM_CFLAGS) $(DRM_CFLAGS) - LIBS += $(GBM_LIBS) $(DRM_LIBS) -else -ifeq ($(HAVE_GLES), 1) - OBJ += gfx/context/xegl_ctx.o -endif + ifeq ($(OSX), 1) + LIBS += -framework OpenGL + else + ifeq ($(HAVE_KMS), 1) + OBJ += gfx/context/drm_egl_ctx.o + DEFINES += $(GBM_CFLAGS) $(DRM_CFLAGS) $(EGL_CFLAGS) + LIBS += $(GBM_LIBS) $(DRM_LIBS) $(EGL_LIBS) + else ifeq ($(HAVE_GLES), 1) + OBJ += gfx/context/xegl_ctx.o + DEFINES += $(EGL_CFLAGS) + LIBS += $(EGL_LIBS) + else + LIBS += -lGL + OBJ += gfx/context/sdl_ctx.o + endif + + ifeq ($(HAVE_GLES), 1) + LIBS += -lGLESv2 + DEFINES += -DHAVE_OPENGLES -DHAVE_OPENGLES2 + else + LIBS += -lGL + endif + endif + endif endif ifeq ($(HAVE_RPI), 1) @@ -189,9 +198,9 @@ ifeq ($(HAVE_XML), 1) LIBS += $(XML_LIBS) DEFINES += $(XML_CFLAGS) -ifeq ($(HAVE_OPENGL), 1) - OBJ += gfx/shader_glsl.o -endif + ifeq ($(HAVE_OPENGL), 1) + OBJ += gfx/shader_glsl.o + endif endif ifeq ($(HAVE_XML), 1) @@ -262,11 +271,11 @@ CFLAGS += -Wall $(OPTIMIZE_FLAG) $(INCLUDE_DIRS) -g -I. -pedantic ifeq ($(CXX_BUILD), 1) CFLAGS += -std=c++0x -xc++ -D__STDC_CONSTANT_MACROS else -ifneq ($(findstring icc,$(CC)),) - CFLAGS += -std=c99 -D_GNU_SOURCE -else - CFLAGS += -std=gnu99 -endif + ifneq ($(findstring icc,$(CC)),) + CFLAGS += -std=c99 -D_GNU_SOURCE + else + CFLAGS += -std=gnu99 + endif endif ifeq ($(NOUNUSED), yes) diff --git a/gfx/context/drm_egl_ctx.c b/gfx/context/drm_egl_ctx.c index 469b01e543..72a346b39a 100644 --- a/gfx/context/drm_egl_ctx.c +++ b/gfx/context/drm_egl_ctx.c @@ -22,6 +22,10 @@ #include "../gl_common.h" #include "../gfx_common.h" +#ifdef HAVE_CONFIG_H +#include "../../config.h" +#endif + #include #include #include @@ -321,7 +325,11 @@ bool gfx_ctx_init(void) EGL_GREEN_SIZE, 1, EGL_BLUE_SIZE, 1, EGL_ALPHA_SIZE, 0, +#ifdef HAVE_OPENGLES2 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, +#else + EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT, +#endif EGL_NONE }; @@ -336,8 +344,15 @@ bool gfx_ctx_init(void) if (!eglInitialize(g_egl_dpy, &major, &minor)) goto error; +#ifdef HAVE_OPENGLES2 + RARCH_LOG("[KMS/EGL]: Using OpenGL ES API.\n"); if (!eglBindAPI(EGL_OPENGL_ES_API)) goto error; +#else + RARCH_LOG("[KMS/EGL]: Using OpenGL API.\n"); + if (!eglBindAPI(EGL_OPENGL_API)) + goto error; +#endif EGLint n; if (!eglChooseConfig(g_egl_dpy, config_attribs, &g_config, 1, &n) || n != 1) diff --git a/qb/config.libs.sh b/qb/config.libs.sh index 709d98f6b3..d1bb8e7635 100644 --- a/qb/config.libs.sh +++ b/qb/config.libs.sh @@ -134,10 +134,12 @@ if [ "$HAVE_KMS" = "yes" ]; then if [ "$HAVE_GBM" = "yes" ] && [ "$HAVE_DRM" = "yes" ]; then HAVE_KMS=yes - HAVE_GLES=yes fi fi -check_lib GLES -lEGL eglCreateContext + +[ "$HAVE_GLES" = "yes" ] && HAVE_EGL=yes +check_pkgconf EGL egl +check_pkgconf GLES glesv2 check_pkgconf FREETYPE freetype2 check_pkgconf X11 x11 @@ -156,6 +158,6 @@ check_pkgconf PYTHON python3 add_define_make OS "$OS" # Creates config.mk and config.h. -VARS="ALSA OSS OSS_BSD OSS_LIB AL RSOUND ROAR JACK COREAUDIO PULSE SDL OPENGL GLES KMS GBM DRM DYLIB GETOPT_LONG THREADS CG XML SDL_IMAGE LIBPNG DYNAMIC FFMPEG AVCODEC AVFORMAT AVUTIL CONFIGFILE FREETYPE XVIDEO X11 XEXT NETPLAY NETWORK_CMD STDIN_CMD COMMAND SOCKET_LEGACY FBO PBO STRL PYTHON FFMPEG_ALLOC_CONTEXT3 FFMPEG_AVCODEC_OPEN2 FFMPEG_AVIO_OPEN FFMPEG_AVFORMAT_WRITE_HEADER FFMPEG_AVFORMAT_NEW_STREAM FFMPEG_AVCODEC_ENCODE_AUDIO2 FFMPEG_AVCODEC_ENCODE_VIDEO2 SINC FIXED_POINT BSV_MOVIE RPI" +VARS="ALSA OSS OSS_BSD OSS_LIB AL RSOUND ROAR JACK COREAUDIO PULSE SDL OPENGL GLES EGL KMS GBM DRM DYLIB GETOPT_LONG THREADS CG XML SDL_IMAGE LIBPNG DYNAMIC FFMPEG AVCODEC AVFORMAT AVUTIL CONFIGFILE FREETYPE XVIDEO X11 XEXT NETPLAY NETWORK_CMD STDIN_CMD COMMAND SOCKET_LEGACY FBO PBO STRL PYTHON FFMPEG_ALLOC_CONTEXT3 FFMPEG_AVCODEC_OPEN2 FFMPEG_AVIO_OPEN FFMPEG_AVFORMAT_WRITE_HEADER FFMPEG_AVFORMAT_NEW_STREAM FFMPEG_AVCODEC_ENCODE_AUDIO2 FFMPEG_AVCODEC_ENCODE_VIDEO2 SINC FIXED_POINT BSV_MOVIE RPI" create_config_make config.mk $VARS create_config_header config.h $VARS