diff --git a/Makefile.common b/Makefile.common index dd25df71ec..786682b785 100644 --- a/Makefile.common +++ b/Makefile.common @@ -1342,15 +1342,14 @@ endif ifeq ($(HAVE_D3D9), 1) HAVE_D3D_COMMON = 1 - HAVE_D3DX = 1 DEFINES += -DHAVE_D3D9 - ifeq ($(HAVE_D3DX), 1) - DEFINES += -DHAVE_D3DX + ifeq ($(HAVE_D3DX9), 1) + HAVE_D3DX_COMMON = 1 endif ifneq ($(HAVE_DYLIB), 1) - LIBS += -ld3d9 - ifeq ($(HAVE_D3DX), 1) - LIBS += -ld3dx9 + LIBS += $(D3D9_LIBS) + ifeq ($(HAVE_D3DX9), 1) + LIBS += $(D3DX9_LIBS) endif endif HAVE_DX_COMMON = 1 @@ -1412,14 +1411,21 @@ ifeq ($(HAVE_D3D8), 1) HAVE_D3D_COMMON = 1 HAVE_DX_COMMON = 1 DEFINES += -DHAVE_D3D8 + ifeq ($(HAVE_D3DX8), 1) + HAVE_D3DX_COMMON = 1 + endif ifneq ($(HAVE_DYLIB), 1) - LIBS += -ld3d8 - ifeq ($(HAVE_D3DX), 1) - LIBS += -ld3dx8 + LIBS += $(D3D8_LIBS) + ifeq ($(HAVE_D3DX8), 1) + LIBS += $(D3DX8_LIBS) endif endif endif +ifeq ($(HAVE_D3DX_COMMON), 1) + DEFINES += -DHAVE_D3DX +endif + ifeq ($(HAVE_DX_COMMON), 1) LIBS += -ldxguid endif diff --git a/Makefile.msvc b/Makefile.msvc index 5eee104a72..90b87b9501 100644 --- a/Makefile.msvc +++ b/Makefile.msvc @@ -60,6 +60,20 @@ HAVE_CHEEVOS := 1 HAVE_SHADERPIPELINE := 1 HAVE_IMAGEVIEWER := 1 +ifeq ($(HAVE_D3D8), 1) + D3D8_LIBS := -ld3d8 + ifeq ($(HAVE_D3DX), 1) + D3DX8_LIBS := -ld3dx8 + endif +endif + +ifeq ($(HAVE_D3D9), 1) + D3D9_LIBS := -ld3d9 + ifeq ($(HAVE_D3DX), 1) + D3DX9_LIBS := -ld3dx9 + endif +endif + include Makefile.common INCLUDE_DIRS := $(patsubst -isystem%,-I%,$(INCLUDE_DIRS)) CFLAGS := $(filter-out -Wno-unknown-pragmas,$(DEF_FLAGS)) diff --git a/Makefile.win b/Makefile.win index 4f54d13426..d9e70bbc95 100644 --- a/Makefile.win +++ b/Makefile.win @@ -56,6 +56,20 @@ SDL2_LIBS := -lSDL2 SDL2_CFLAGS := -ISDL2 -DHAVE_SDL2 endif +ifeq ($(HAVE_D3D8), 1) +D3D8_LIBS := -ld3d8 +ifeq ($(HAVE_D3DX), 1) +D3DX8_LIBS := -ld3dx8 +endif +endif + +ifeq ($(HAVE_D3D9), 1) +D3D9_LIBS := -ld3d9 +ifeq ($(HAVE_D3DX), 1) +D3DX9_LIBS := -ld3dx9 +endif +endif + ifeq ($(HAVE_RSOUND), 1) RSOUND_CFLAGS := -DHAVE_RSOUND RSOUND_LIBS := -lrsound diff --git a/qb/config.libs.sh b/qb/config.libs.sh index 8cd062d392..44e3a2152c 100644 --- a/qb/config.libs.sh +++ b/qb/config.libs.sh @@ -128,10 +128,8 @@ add_define MAKEFILE BIN_DIR "${BIN_DIR:-${PREFIX}/bin}" add_define MAKEFILE DOC_DIR "${DOC_DIR:-${SHARE_DIR}/doc/retroarch}" add_define MAKEFILE MAN_DIR "${MAN_DIR:-${SHARE_DIR}/man}" -if [ "$OS" = 'DOS' ]; then - HAVE_SHADERPIPELINE=no - HAVE_LANGEXTRA=no -fi +check_platform DOS SHADERPIPELINE 'Shader-based pipelines are' false +check_platform DOS LANGEXTRA 'Extra languages are' false check_lib '' THREADS "$PTHREADLIB" pthread_create check_enabled THREADS THREAD_STORAGE 'Thread Local Storage' 'Threads are' false @@ -203,10 +201,8 @@ if [ "$HAVE_OSS" != 'no' ]; then check_lib '' OSS_LIB -lossaudio fi -if [ "$OS" = 'Linux' ]; then - HAVE_TINYALSA=yes - HAVE_RPILED=yes -fi +check_platform Linux TINYALSA 'Tinyalsa is' true +check_platform Linux RPILED 'The RPI led driver is' true if [ "$OS" = 'Darwin' ]; then check_lib '' COREAUDIO "-framework AudioUnit" AudioUnitInitialize @@ -234,6 +230,7 @@ if [ "$HAVE_SDL2" = 'yes' ] && [ "$HAVE_SDL" = 'yes' ]; then HAVE_SDL=no fi +check_platform Haiku DISCORD 'Discord is' false check_enabled CXX DISCORD discord 'The C++ compiler is' false check_enabled CXX QT 'Qt companion' 'The C++ compiler is' false @@ -303,9 +300,15 @@ check_val '' LIBUSB -lusb-1.0 libusb-1.0 libusb-1.0 1.0.13 '' false if [ "$OS" = 'Win32' ]; then check_lib '' DINPUT -ldinput8 + check_lib '' D3D8 -ld3d8 check_lib '' D3D9 -ld3d9 check_lib '' DSOUND -ldsound + if [ "$HAVE_D3DX" != 'no' ]; then + check_lib '' D3DX8 -ld3dx8 + check_lib '' D3DX9 -ld3dx9 + fi + if [ "$HAVE_DINPUT" != 'no' ]; then HAVE_XINPUT=yes fi @@ -313,13 +316,15 @@ if [ "$OS" = 'Win32' ]; then HAVE_WASAPI=yes HAVE_XAUDIO=yes HAVE_WINMM=yes -else - HAVE_D3D9=no - HAVE_D3D10=no - HAVE_D3D11=no - HAVE_D3D12=no fi +check_platform Win32 D3D8 'Direct3D 8 is' true +check_platform Win32 D3D9 'Direct3D 9 is' true +check_platform Win32 D3D10 'Direct3D 10 is' true +check_platform Win32 D3D11 'Direct3D 11 is' true +check_platform Win32 D3D12 'Direct3D 12 is' true +check_platform Win32 D3DX 'Direct3DX is' true + if [ "$HAVE_OPENGL" != 'no' ] && [ "$HAVE_OPENGLES" != 'yes' ]; then if [ "$OS" = 'Darwin' ]; then check_header OPENGL "OpenGL/gl.h" diff --git a/qb/config.params.sh b/qb/config.params.sh index 3e1bf0ad52..2dbe45230a 100644 --- a/qb/config.params.sh +++ b/qb/config.params.sh @@ -48,7 +48,7 @@ HAVE_MINIUPNPC=auto # Mini UPnP client library (for NAT traversal) HAVE_BUILTINMINIUPNPC=yes # Bake in Mini UPnP client library (for NAT traversal) C89_BUILTINMINIUPNPC=no HAVE_D3D8=no # Direct3D 8 support -HAVE_D3D9=yes # Direct3D 9 support +HAVE_D3D9=auto # Direct3D 9 support C89_D3D9=no HAVE_D3D10=yes # Direct3D 10 support C89_D3D10=no @@ -56,7 +56,7 @@ HAVE_D3D11=yes # Direct3D 11 support C89_D3D11=no HAVE_D3D12=yes # Direct3D 12 support C89_D3D12=no -HAVE_D3DX=yes # Direct3DX support +HAVE_D3DX=auto # Direct3DX support HAVE_OPENGL=auto # OpenGL 2.0 support HAVE_OPENGL_CORE=yes # Modern OpenGL driver support (GLES3+/GL3.2 core+), requires OpenGL. C89_OPENGL_CORE=no @@ -86,6 +86,7 @@ HAVE_BUILTINZLIB=yes # Bake in zlib HAVE_ZLIB=auto # zlib support (ZIP extract, PNG decoding/encoding) HAVE_ALSA=auto # ALSA support C89_ALSA=no +HAVE_RPILED=auto # RPI led support HAVE_TINYALSA=auto # TinyALSA support HAVE_AUDIOIO=auto # AudioIO support HAVE_OSS=auto # OSS support diff --git a/qb/qb.libs.sh b/qb/qb.libs.sh index 30902f99b9..9e56ef5feb 100644 --- a/qb/qb.libs.sh +++ b/qb/qb.libs.sh @@ -79,6 +79,34 @@ check_enabled() die 1 "Error: $4 disabled and forced to build with $3 support." } +# check_platform: +# $1 = OS +# $2 = HAVE_$2 +# $3 = feature +# $4 = enable feature when true [checked only if non-empty] +check_platform() +{ tmpval="$(eval "printf %s \"\$HAVE_$2\"")" + [ "$tmpval" = 'no' ] && return 0 + + setval="$(eval "printf %s \"\$USER_$2\"")" + + if [ "$setval" = 'yes' ]; then + if { [ "$1" != "$OS" ] && [ "${4:-}" = 'true' ]; } || + { [ "$1" = "$OS" ] && + [ "${4:-}" != 'true' ]; }; then + die 1 "Error: $3 not supported for $OS." + fi + elif [ "$1" = "$OS" ]; then + if [ "${4:-}" = 'true' ]; then + eval "HAVE_$2=yes" + else + eval "HAVE_$2=no" + fi + elif [ "${4:-}" = 'true' ]; then + eval "HAVE_$2=" + fi +} + # check_lib: # Compiles a simple test program to check if a library is available. # $1 = language diff --git a/qb/qb.params.sh b/qb/qb.params.sh index 1834431093..66ec134c12 100644 --- a/qb/qb.params.sh +++ b/qb/qb.params.sh @@ -74,7 +74,7 @@ parse_input() # Parse stuff :V TMPVAR="${VAR%=*}" NEWVAR="${TMPVAR##HAVE_}" OPTS="$OPTS $NEWVAR" - eval "USER_$NEWVAR=no" + eval "USER_$NEWVAR=auto" done < 'qb/config.params.sh' #OPTS contains all available options in config.params.sh - used to speedup #things in opt_exists() @@ -98,6 +98,7 @@ parse_input() # Parse stuff :V --disable-*) opt_exists "${1##--disable-}" "$1" eval "HAVE_$opt=no" + eval "USER_$opt=no" eval "HAVE_NO_$opt=yes" ;; --with-*)