build: HAVE_COCOA is the one Apple desktop define

qb, Makefile.common and the Xcode configurations set HAVE_COCOA for
macOS and HAVE_COCOATOUCH for iOS/tvOS; which video drivers are built
is decided by HAVE_METAL, HAVE_VULKAN and HAVE_OPENGL alone. The Xcode
macOS build now carries HAVE_COCOA like the make build, so the desktop
companion settings appear there too. A Darwin Vulkan build links the
Metal frameworks its CAMetalLayer render view needs, whether or not the
Metal driver is included.
This commit is contained in:
LibretroAdmin authored and libretroadmin committed 2026-09-06 05:57:37 +02:00
1 parent 3c95b6dab3
commit df7cb31237
4 files changed
+8 -25

No files matched your search

+3 -8
View File
@@ -1755,9 +1755,12 @@ ifeq ($(HAVE_VULKAN), 1)
# into Contents/Frameworks) produces a self-contained bundle with no
# external MoltenVK dependency. Matches what Xcode's
# LD_RUNPATH_SEARCH_PATHS does for the .xcodeproj build.
# The Vulkan render view is a CAMetalLayer on a Metal device, so the
# Metal frameworks are linked whether or not the Metal driver is.
ifneq ($(findstring Darwin,$(OS)),)
LDFLAGS += -Xlinker -rpath -Xlinker @executable_path/../Frameworks \
-Xlinker -rpath -Xlinker @executable_path/../Frameworks/MoltenVK.framework
LIBS += -framework Metal -framework QuartzCore
endif
endif
@@ -2729,14 +2732,6 @@ ifeq ($(HAVE_COMPRESSION), 1)
endif
ifeq ($(HAVE_COCOA), 1)
HAVE_COCOA_COMMON = 1
endif
ifeq ($(HAVE_COCOA_METAL), 1)
HAVE_COCOA_COMMON = 1
DEFINES += -DHAVE_COCOA_METAL
endif
ifeq ($(HAVE_COCOA_COMMON),1)
DEFINES += -DHAVE_MAIN -DTARGET_OS_OSX=1 -DHAVE_COCOA
OBJ += input/drivers/cocoa_input.o \
ui/drivers/ui_cocoa.o \
+1 -1
View File
@@ -24,7 +24,6 @@ OTHER_CFLAGS = $(inherited) -DHAVE_CHEATS
OTHER_CFLAGS = $(inherited) -DHAVE_CHEEVOS
OTHER_CFLAGS = $(inherited) -DHAVE_CHEEVOS_RVZ
OTHER_CFLAGS = $(inherited) -DHAVE_CLOUDSYNC
OTHER_CFLAGS = $(inherited) -DHAVE_COCOA_METAL
OTHER_CFLAGS = $(inherited) -DHAVE_COMMAND
OTHER_CFLAGS = $(inherited) -DHAVE_CONFIGFILE
OTHER_CFLAGS = $(inherited) -DHAVE_COREAUDIO
@@ -109,6 +108,7 @@ OTHER_CFLAGS[sdk=macosx*] = $(inherited) -DHAVE_AVF
OTHER_CFLAGS[sdk=macosx*] = $(inherited) -DHAVE_COREMIDI
OTHER_CFLAGS[sdk=macosx*] = $(inherited) -DHAVE_DISCORD
OTHER_CFLAGS[sdk=macosx*] = $(inherited) -DHAVE_DYLIB
OTHER_CFLAGS[sdk=macosx*] = $(inherited) -DHAVE_COCOA
OTHER_CFLAGS[sdk=macosx*] = $(inherited) -DHAVE_GETOPT_LONG
OTHER_CFLAGS[sdk=macosx*] = $(inherited) -DHAVE_HID
OTHER_CFLAGS[sdk=macosx*] = $(inherited) -DHAVE_IOHIDMANAGER
@@ -1396,7 +1396,6 @@
"-D_LZMA_UINT32_IS_ULONG",
"-DHAVE_MFI",
"-DHAVE_KEYMAPPER",
"-DHAVE_COCOA_METAL",
"-DHAVE_METAL",
"-DHAVE_SLANG",
"-DHAVE_SPIRV_CROSS",
@@ -1581,7 +1580,6 @@
"-D_LZMA_UINT32_IS_ULONG",
"-DHAVE_MFI",
"-DHAVE_KEYMAPPER",
"-DHAVE_COCOA_METAL",
"-DHAVE_METAL",
"-DHAVE_SLANG",
"-DHAVE_SPIRV_CROSS",
@@ -1729,7 +1727,6 @@
"-D_LZMA_UINT32_IS_ULONG",
"-DHAVE_MFI",
"-DHAVE_KEYMAPPER",
"-DHAVE_COCOA_METAL",
"-DHAVE_METAL",
"-DHAVE_SLANG",
"-DHAVE_SPIRV_CROSS",
@@ -1872,7 +1869,6 @@
"-D_LZMA_UINT32_IS_ULONG",
"-DHAVE_MFI",
"-DHAVE_KEYMAPPER",
"-DHAVE_COCOA_METAL",
"-DHAVE_METAL",
"-DHAVE_SLANG",
"-DHAVE_SPIRV_CROSS",
+4 -12
View File
@@ -298,15 +298,11 @@ if [ "$OS" = 'Darwin' ]; then
# * HAVE_METAL defaults to 'no' in config.params.sh so check_platform
# early-outs. Force it on here so the Metal video driver is built,
# unless the user explicitly passed --disable-metal.
# * HAVE_VULKAN must be set to 'yes' before the COCOA_METAL check
# below, which decides which AppKit glue to compile based on
# whether Metal/Vulkan is in play. Link-time libvulkan is not
# required on Darwin; MoltenVK is loaded dynamically at runtime
# by gfx/common/vulkan_common.c.
# * HAVE_VULKAN is forced on alongside it. Link-time libvulkan is
# not required on Darwin; MoltenVK is loaded dynamically at
# runtime by gfx/common/vulkan_common.c.
# Skip the force-on on pre-10.7 targets — Metal is 10.11+ and
# MoltenVK is 10.11+, so neither is buildable on Tiger/Leopard.
# That also keeps HAVE_COCOA_METAL off, which in turn avoids code
# paths that use the 10.6+ NSWindowDelegate protocol.
if [ "$macos_target_pre_10_7" = 'no' ]; then
[ "${USER_METAL:-}" != 'no' ] && HAVE_METAL=yes
[ "${USER_VULKAN:-}" != 'no' ] && HAVE_VULKAN=yes
@@ -374,11 +370,7 @@ if [ "$OS" = 'Darwin' ]; then
unset macos_target_ver macos_target_pre_10_7 macos_target_pre_10_11
if [ "$HAVE_METAL" = yes ] || [ "$HAVE_VULKAN" = yes ]; then
check_lib '' COCOA_METAL "-framework AppKit" NSApplicationMain
else
check_lib '' COCOA "-framework AppKit" NSApplicationMain
fi
check_lib '' COCOA "-framework AppKit" NSApplicationMain
check_lib '' CORELOCATION "-framework CoreLocation"
check_lib '' IOHIDMANAGER "-framework IOKit" IOHIDManagerCreate