mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 19:20:35 +00:00
Merge pull request #10087 from orbea/glslang
qb: Support building with a system version of glslang.
This commit is contained in:
commit
7bf6bac63f
@ -1547,8 +1547,8 @@ ifeq ($(HAVE_SHADERS_COMMON), 1)
|
||||
OBJ += gfx/video_shader_parse.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_GLSLANG), 1)
|
||||
DEFINES += -DHAVE_GLSLANG
|
||||
ifeq ($(HAVE_BUILTINGLSLANG), 1)
|
||||
HAVE_GLSLANG_COMMON = 1
|
||||
|
||||
ifneq ($(findstring Win32,$(OS)),)
|
||||
GLSLANG_PLATFORM := Windows
|
||||
@ -1562,8 +1562,7 @@ ifeq ($(HAVE_GLSLANG), 1)
|
||||
-I$(DEPS_DIR)/glslang/glslang \
|
||||
-I$(DEPS_DIR)/glslang/glslang/glslang/MachineIndependent \
|
||||
-I$(DEPS_DIR)/glslang/glslang/glslang/Public \
|
||||
-I$(DEPS_DIR)/glslang/glslang/SPIRV \
|
||||
-I$(DEPS_DIR)/glslang
|
||||
-I$(DEPS_DIR)/glslang/glslang/SPIRV
|
||||
|
||||
GLSLANG_SOURCES := \
|
||||
$(wildcard $(DEPS_DIR)/glslang/*.cpp) \
|
||||
@ -1578,7 +1577,23 @@ ifeq ($(HAVE_GLSLANG), 1)
|
||||
DEFINES += -DENABLE_HLSL
|
||||
GLSLANG_SOURCES += $(wildcard $(DEPS_DIR)/glslang/glslang/hlsl/*.cpp)
|
||||
endif
|
||||
else ifeq ($(HAVE_GLSLANG),1)
|
||||
HAVE_GLSLANG_COMMON = 1
|
||||
GLSLANG_SOURCES := $(DEPS_DIR)/glslang/glslang.cpp
|
||||
|
||||
# The order of these libs are somewhat specific
|
||||
LIBS += $(GLSLANG_LIBS) \
|
||||
$(GLSLANG_OSDEPENDENT_LIBS) \
|
||||
$(GLSLANG_OGLCOMPILER_LIBS) \
|
||||
$(GLSLANG_HLSL_LIBS) \
|
||||
$(GLSLANG_SPIRV_LIBS) \
|
||||
$(GLSLANG_SPIRV_TOOLS_OPT_LIBS) \
|
||||
$(GLSLANG_SPIRV_TOOLS_LIBS)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_GLSLANG_COMMON), 1)
|
||||
DEFINES += -DHAVE_GLSLANG
|
||||
INCLUDE_DIRS += -I$(DEPS_DIR)/glslang
|
||||
OBJ += $(GLSLANG_SOURCES:.cpp=.o)
|
||||
endif
|
||||
|
||||
|
5
deps/glslang/glslang.cpp
vendored
5
deps/glslang/glslang.cpp
vendored
@ -15,8 +15,13 @@
|
||||
|
||||
#include "glslang.hpp"
|
||||
|
||||
#ifdef HAVE_BUILTINGLSLANG
|
||||
#include "glslang/glslang/Public/ShaderLang.h"
|
||||
#include "glslang/SPIRV/GlslangToSpv.h"
|
||||
#elif HAVE_GLSLANG
|
||||
#include <glslang/Public/ShaderLang.h>
|
||||
#include <glslang/SPIRV/GlslangToSpv.h>
|
||||
#endif
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
|
@ -126,7 +126,7 @@ if [ "$HAVE_ANGLE" = 'yes' ]; then
|
||||
;;
|
||||
esac
|
||||
else
|
||||
check_header EGL EGL/egl.h EGL/eglext.h
|
||||
check_header '' EGL EGL/egl.h EGL/eglext.h
|
||||
# some systems have EGL libs, but no pkgconfig
|
||||
# https://github.com/linux-sunxi/sunxi-mali/pull/8
|
||||
check_val '' EGL "-l${VC_PREFIX}EGL $EXTRA_GL_LIBS" '' "${VC_PREFIX}egl" '' '' true
|
||||
@ -165,7 +165,7 @@ check_enabled THREADS THREAD_STORAGE 'Thread Local Storage' 'Threads are' false
|
||||
check_lib '' THREAD_STORAGE "$PTHREADLIB" pthread_key_create
|
||||
|
||||
if [ "$OS" = 'Linux' ]; then
|
||||
check_header CDROM sys/ioctl.h scsi/sg.h
|
||||
check_header '' CDROM sys/ioctl.h scsi/sg.h
|
||||
fi
|
||||
|
||||
check_platform 'Linux Win32' CDROM 'CD-ROM is' user
|
||||
@ -230,8 +230,8 @@ check_val '' SIXEL -lsixel '' libsixel 1.6.0 '' false
|
||||
check_macro AUDIOIO AUDIO_SETINFO sys/audioio.h
|
||||
|
||||
if [ "$HAVE_OSS" != 'no' ]; then
|
||||
check_header OSS sys/soundcard.h
|
||||
check_header OSS_BSD soundcard.h
|
||||
check_header '' OSS sys/soundcard.h
|
||||
check_header '' OSS_BSD soundcard.h
|
||||
check_lib '' OSS_LIB -lossaudio
|
||||
fi
|
||||
|
||||
@ -303,7 +303,7 @@ check_val '' FLAC '-lFLAC' '' flac '' '' false
|
||||
check_enabled SSL BUILTINMBEDTLS 'builtin mbedtls' 'ssl is' true
|
||||
|
||||
if [ "$HAVE_SSL" != 'no' ]; then
|
||||
check_header MBEDTLS \
|
||||
check_header '' MBEDTLS \
|
||||
mbedtls/config.h \
|
||||
mbedtls/certs.h \
|
||||
mbedtls/debug.h \
|
||||
@ -363,13 +363,13 @@ fi
|
||||
|
||||
if [ "$HAVE_OPENGL" != 'no' ] && [ "$HAVE_OPENGLES" != 'yes' ]; then
|
||||
if [ "$OS" = 'Darwin' ]; then
|
||||
check_header OPENGL "OpenGL/gl.h"
|
||||
check_header '' OPENGL "OpenGL/gl.h"
|
||||
check_lib '' OPENGL "-framework OpenGL"
|
||||
elif [ "$OS" = 'Win32' ]; then
|
||||
check_header OPENGL "GL/gl.h"
|
||||
check_header '' OPENGL "GL/gl.h"
|
||||
check_lib '' OPENGL -lopengl32
|
||||
else
|
||||
check_header OPENGL "GL/gl.h"
|
||||
check_header '' OPENGL "GL/gl.h"
|
||||
check_lib '' OPENGL -lGL
|
||||
fi
|
||||
|
||||
@ -412,7 +412,7 @@ check_enabled ZLIB BUILTINZLIB 'builtin zlib' 'zlib is' true
|
||||
check_val '' ZLIB '-lz' '' zlib '' '' false
|
||||
check_val '' MPV -lmpv '' mpv '' '' false
|
||||
|
||||
check_header DRMINGW exchndl.h
|
||||
check_header '' DRMINGW exchndl.h
|
||||
check_lib '' DRMINGW -lexchndl
|
||||
|
||||
check_enabled THREADS FFMPEG FFmpeg 'Threads are' false
|
||||
@ -425,7 +425,7 @@ if [ "$HAVE_FFMPEG" != 'no' ]; then
|
||||
check_val '' AVUTIL -lavutil '' libavutil 55 '' false
|
||||
check_val '' SWSCALE -lswscale '' libswscale 4 '' false
|
||||
|
||||
check_header AV_CHANNEL_LAYOUT libavutil/channel_layout.h
|
||||
check_header '' AV_CHANNEL_LAYOUT libavutil/channel_layout.h
|
||||
|
||||
HAVE_FFMPEG='yes'
|
||||
if [ "$HAVE_AVCODEC" = 'no' ] || [ "$HAVE_SWRESAMPLE" = 'no' ] || [ "$HAVE_AVFORMAT" = 'no' ] || [ "$HAVE_AVUTIL" = 'no' ] || [ "$HAVE_SWSCALE" = 'no' ]; then
|
||||
@ -486,7 +486,7 @@ check_enabled XF86VM XVIDEO XVideo 'XF86vm is' false
|
||||
check_val '' XVIDEO -lXv '' xv '' '' false
|
||||
check_val '' XINERAMA -lXinerama '' xinerama '' '' false
|
||||
check_lib '' XRANDR -lXrandr
|
||||
check_header XSHM X11/Xlib.h X11/extensions/XShm.h
|
||||
check_header '' XSHM X11/Xlib.h X11/extensions/XShm.h
|
||||
check_val '' XKBCOMMON -lxkbcommon '' xkbcommon 0.3.2 '' false
|
||||
check_val '' WAYLAND '-lwayland-egl -lwayland-client' '' wayland-egl 10.1.0 '' false
|
||||
check_val '' WAYLAND_CURSOR -lwayland-cursor '' wayland-cursor 1.12 '' false
|
||||
@ -506,8 +506,8 @@ else
|
||||
HAVE_WAYLAND='no'
|
||||
fi
|
||||
|
||||
check_header PARPORT linux/parport.h
|
||||
check_header PARPORT linux/ppdev.h
|
||||
check_header '' PARPORT linux/parport.h
|
||||
check_header '' PARPORT linux/ppdev.h
|
||||
|
||||
if [ "$OS" != 'Win32' ] && [ "$OS" != 'Linux' ]; then
|
||||
check_lib '' STRL "$CLIB" strlcpy
|
||||
@ -564,6 +564,39 @@ check_enabled CXX SLANG slang 'The C++ compiler is' false
|
||||
check_enabled CXX GLSLANG glslang 'The C++ compiler is' false
|
||||
check_enabled CXX SPIRV_CROSS SPIRV-Cross 'The C++ compiler is' false
|
||||
|
||||
check_enabled GLSLANG BUILTINGLSLANG 'builtin glslang' 'glslang is' true
|
||||
|
||||
if [ "$HAVE_GLSLANG" != no ]; then
|
||||
check_header cxx GLSLANG \
|
||||
glslang/Public/ShaderLang.h \
|
||||
glslang/SPIRV/GlslangToSpv.h
|
||||
|
||||
check_lib cxx GLSLANG -lglslang
|
||||
check_lib cxx GLSLANG_OSDEPENDENT -lOSDependent
|
||||
check_lib cxx GLSLANG_OGLCOMPILER -lOGLCompiler
|
||||
check_lib cxx GLSLANG_HLSL -lHLSL
|
||||
check_lib cxx GLSLANG_SPIRV -lSPIRV
|
||||
check_lib cxx GLSLANG_SPIRV_TOOLS_OPT -lSPIRV-Tools-opt
|
||||
check_lib cxx GLSLANG_SPIRV_TOOLS -lSPIRV-Tools
|
||||
|
||||
if [ "$HAVE_GLSLANG" = no ] ||
|
||||
[ "$HAVE_GLSLANG_OSDEPENDENT" = no ] ||
|
||||
[ "$HAVE_GLSLANG_OGLCOMPILER" = no ] ||
|
||||
[ "$HAVE_GLSLANG_HLSL" = no ] ||
|
||||
[ "$HAVE_GLSLANG_SPIRV" = no ] ||
|
||||
[ "$HAVE_GLSLANG_SPIRV_TOOLS_OPT" = no ] ||
|
||||
[ "$HAVE_GLSLANG_SPIRV_TOOLS" = no ]; then
|
||||
if [ "$HAVE_BUILTINGLSLANG" != yes ]; then
|
||||
die : 'Notice: System glslang libraries not found, disabling glslang support.'
|
||||
HAVE_GLSLANG=no
|
||||
else
|
||||
HAVE_GLSLANG=yes
|
||||
fi
|
||||
else
|
||||
HAVE_GLSLANG=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
check_enabled SLANG GLSLANG glslang 'slang is' false
|
||||
check_enabled SLANG SPIRV_CROSS SPIRV-Cross 'slang is' false
|
||||
check_enabled SLANG OPENGL_CORE 'OpenGL core' 'slang is' false
|
||||
|
@ -161,6 +161,8 @@ HAVE_SLANG=auto # slang support
|
||||
C89_SLANG=no
|
||||
HAVE_GLSLANG=auto # glslang support (requires C++11)
|
||||
C89_GLSLANG=no
|
||||
HAVE_BUILTINGLSLANG=auto # Bake in glslang support
|
||||
C89_BUILTINGLSLANG=no
|
||||
HAVE_SPIRV_CROSS=auto # SPIRV-Cross support (requires C++11)
|
||||
C89_SPIRV_CROSS=no
|
||||
HAVE_METAL=no # Metal support (macOS-only)
|
||||
|
@ -264,25 +264,27 @@ check_pkgconf()
|
||||
}
|
||||
|
||||
# check_header:
|
||||
# $1 = HAVE_$1
|
||||
# $1 = language
|
||||
# $2 = HAVE_$2
|
||||
# $@ = header files
|
||||
check_header()
|
||||
{ add_opt "$1"
|
||||
tmpval="$(eval "printf %s \"\$HAVE_$1\"")"
|
||||
{ add_opt "$2"
|
||||
check_compiler "$1" ''
|
||||
tmpval="$(eval "printf %s \"\$HAVE_$2\"")"
|
||||
[ "$tmpval" = 'no' ] && return 0
|
||||
rm -f -- "$TEMP_C"
|
||||
val="$1"
|
||||
header="$2"
|
||||
shift
|
||||
val="$2"
|
||||
header="$3"
|
||||
shift 2
|
||||
for head do
|
||||
CHECKHEADER="$head"
|
||||
printf %s\\n "#include <$head>" >> "$TEMP_C"
|
||||
printf %s\\n "#include <$head>" >> "$TEMP_CODE"
|
||||
done
|
||||
printf %s\\n "int main(void) { return 0; }" >> "$TEMP_C"
|
||||
printf %s\\n "int main(void) { return 0; }" >> "$TEMP_CODE"
|
||||
answer='no'
|
||||
printf %s "Checking presence of header file $CHECKHEADER ... "
|
||||
$(printf %s "$CC") -o "$TEMP_EXE" "$TEMP_C" \
|
||||
$(printf %s "$BUILD_DIRS $CFLAGS $LDFLAGS") >>config.log 2>&1 &&
|
||||
$(printf %s "$COMPILER") -o "$TEMP_EXE" "$TEMP_CODE" \
|
||||
$(printf %s "$BUILD_DIRS $FLAGS $LDFLAGS") >>config.log 2>&1 &&
|
||||
answer='yes'
|
||||
eval "HAVE_$val=\"$answer\""
|
||||
printf %s\\n "$answer"
|
||||
|
Loading…
x
Reference in New Issue
Block a user