playlist_manager: replace HAVE_COCOATOUCH gate with SDK-version gate

In hindsight the HAVE_COCOATOUCH gate applied by cc1a131860 and
345a2effcf was too coarse.  RetroArchPlaylistManager.m/.h is not
iOS/tvOS-only - the file is portable to modern macOS, and the only
reason it couldn't be built for macOS earlier was that its syntax
requires Xcode 7 / SDK 10.11 (nullability macros
NS_ASSUME_NONNULL_BEGIN/END, nullable, _Nonnull; Obj-C lightweight
generics NSArray<...>).  Pre-10.11 macOS (and PPC/Leopard in
particular, where GCC 4.0 doesn't understand the syntax at all)
should be excluded, but modern macOS should be able to use it.

Introduce a new feature flag HAVE_RETROARCH_PLAYLIST_MANAGER and
gate all the call sites on it instead:

  qb/config.params.sh - declare HAVE_RETROARCH_PLAYLIST_MANAGER=auto
  near HAVE_COCOA.  qb.make.sh auto-plumbs this into config.mk via
  the existing CONFIG_OPTS iteration.

  qb/config.libs.sh - extend the existing Darwin probe to compute
  macos_target_pre_10_11 alongside macos_target_pre_10_7, then set
  HAVE_RETROARCH_PLAYLIST_MANAGER=yes if HAVE_COCOATOUCH=yes OR
  macos_target_pre_10_11=no; else no.

  Makefile.common - flip ifeq ($(HAVE_COCOATOUCH), 1) to
  ifeq ($(HAVE_RETROARCH_PLAYLIST_MANAGER), 1).

  griffin/griffin_objc.m - flip #ifdef HAVE_COCOATOUCH to
  #ifdef HAVE_RETROARCH_PLAYLIST_MANAGER around the .m include.

  ui/drivers/cocoa/cocoa_common.h - add a C-preprocessor synthesis
  block for non-qb builds (e.g. RetroArch.xcodeproj) that sets
  HAVE_RETROARCH_PLAYLIST_MANAGER based on HAVE_COCOATOUCH or
  MAC_OS_X_VERSION_MAX_ALLOWED >= 101100.  Guarded with #ifndef
  so the qb-set value wins when present.  Also flip the
  cocoa_launch_game_by_filename forward-decl gate.

  ui/drivers/cocoa/cocoa_common.m - flip the two existing gates
  (header include and function body open/close).

Behavioral outcomes:
  - iOS/tvOS: HAVE_COCOATOUCH -> HAVE_RETROARCH_PLAYLIST_MANAGER.
    No change; file still built.
  - Modern macOS (10.11+): now builds the file.  This is NEW -
    the previous HAVE_COCOATOUCH gate excluded it even though
    the file would have compiled fine there.
  - Pre-10.11 macOS (includes PPC/Leopard/Xcode 3.1): correctly
    excluded, same as before.
  - Non-Darwin: HAVE_RETROARCH_PLAYLIST_MANAGER stays 'auto',
    never emitted as 1 in config.mk; Makefile gate is false;
    nothing changes (and these builds never reached the file
    anyway, guarded further by HAVE_COCOA_COMMON).

Supersedes the over-gating in cc1a131860 (source-side) and
345a2effcf (Makefile-side).
This commit is contained in:
U-DESKTOP-SPFP6AQ\twistedtechre committed 2026-04-21 03:10:48 +02:00
1 parent 3030b782e3
commit 41dd469359
6 files changed
+58 -14

No files matched your search

+6 -5
View File
@@ -2609,11 +2609,12 @@ ifeq ($(HAVE_COCOA_COMMON),1)
ui/drivers/ui_cocoa.o \
ui/drivers/cocoa/cocoa_common.o
# RetroArchPlaylistManager uses Obj-C lightweight generics and
# nullability macros (Xcode 7+, 2015). Its only consumer,
# cocoa_launch_game_by_filename(), is iOS/tvOS-only. Gate on
# HAVE_COCOATOUCH so desktop (macOS) make-builds don't try to
# compile it - GCC 4.0 on PPC can't parse the Xcode 7 syntax.
ifeq ($(HAVE_COCOATOUCH), 1)
# nullability macros (Xcode 7+, 2015). It's fine on iOS/tvOS and
# modern macOS (10.11+), but GCC 4.0 / old clang on pre-10.11
# macOS SDKs can't parse the syntax. HAVE_RETROARCH_PLAYLIST_MANAGER
# is set by qb/config.libs.sh based on the macOS target version
# (or HAVE_COCOATOUCH on iOS/tvOS).
ifeq ($(HAVE_RETROARCH_PLAYLIST_MANAGER), 1)
OBJ += ui/drivers/cocoa/RetroArchPlaylistManager.o
endif
LIBS += -framework Cocoa -framework AppKit -framework Foundation
+5 -4
View File
@@ -32,10 +32,11 @@
#if defined(HAVE_COCOATOUCH) || defined(HAVE_COCOA) || defined(HAVE_COCOA_METAL)
#include "../ui/drivers/cocoa/cocoa_common.m"
#ifdef HAVE_COCOATOUCH
/* RetroArchPlaylistManager is iOS/tvOS-only and uses Obj-C
* lightweight generics + nullability macros (Xcode 7+, 2015).
* Don't pull it into the macOS build - GCC 4.0 can't parse it. */
#ifdef HAVE_RETROARCH_PLAYLIST_MANAGER
/* RetroArchPlaylistManager uses Obj-C lightweight generics and
* nullability macros (Xcode 7+, 2015). Usable on iOS/tvOS and
* modern macOS, not on older macOS SDKs. Flag is synthesized
* in cocoa_common.h for non-qb builds; set directly by qb. */
#include "../ui/drivers/cocoa/RetroArchPlaylistManager.m"
#endif
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES)
+24 -1
View File
@@ -250,10 +250,15 @@ if [ "$OS" = 'Darwin' ]; then
# <stdatomic.h>, AVFoundation, @available). On Tiger/Leopard /
# PowerPC / Xcode 3.1 those APIs are absent and builds fail.
#
# We also compute macos_target_pre_10_11 for code that requires
# Xcode 7-era Obj-C features (nullability macros, lightweight
# generics) - those need SDK 10.11 / Xcode 7 or newer.
#
# MACOSX_DEPLOYMENT_TARGET (set by the invoker or the toolchain)
# takes priority over sw_vers, because on a cross-build the host
# OS version may be newer than the target.
macos_target_pre_10_7=no
macos_target_pre_10_11=no
macos_target_ver="${MACOSX_DEPLOYMENT_TARGET:-}"
if [ -z "$macos_target_ver" ] && command -v sw_vers >/dev/null 2>&1; then
macos_target_ver="$(sw_vers -productVersion 2>/dev/null)"
@@ -267,6 +272,10 @@ if [ "$OS" = 'Darwin' ]; then
{ [ "$mt_major" -eq 10 ] && [ "$mt_minor" -lt 7 ]; }; then
macos_target_pre_10_7=yes
fi
if [ "$mt_major" -lt 10 ] || \
{ [ "$mt_major" -eq 10 ] && [ "$mt_minor" -lt 11 ]; }; then
macos_target_pre_10_11=yes
fi
unset mt_major mt_minor
fi
@@ -307,7 +316,21 @@ if [ "$OS" = 'Darwin' ]; then
HAVE_MICROPHONE=no
die : "Notice: macOS target $macos_target_ver is pre-10.7; disabling microphone (requires C11 <stdatomic.h>). Override with --enable-microphone."
fi
unset macos_target_ver macos_target_pre_10_7
# RetroArchPlaylistManager.m/.h uses Obj-C nullability macros
# (NS_ASSUME_NONNULL_BEGIN/END, nullable, _Nonnull) and
# lightweight generics (NSArray<...>) - all Xcode 7+ (2015)
# features requiring SDK 10.11 / iOS 9.0 or newer. Enable on
# iOS/tvOS (any HAVE_COCOATOUCH build is modern enough in
# practice) and on macOS 10.11+ targets. Disable on pre-10.11
# macOS where GCC/old-clang can't parse the syntax.
if [ "$HAVE_COCOATOUCH" = 'yes' ] || \
[ "$macos_target_pre_10_11" = 'no' ]; then
HAVE_RETROARCH_PLAYLIST_MANAGER=yes
else
HAVE_RETROARCH_PLAYLIST_MANAGER=no
fi
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
+4
View File
@@ -215,4 +215,8 @@ HAVE_GAME_AI=no
HAVE_SMBCLIENT=auto # SMB client support
HAVE_BUILTINSMBCLIENT=no # Use builtin libsmb2
HAVE_COCOA=auto # Cocoa support (Darwin/Apple)
# RetroArchPlaylistManager (iOS/tvOS playlist helper, also fine on
# modern macOS). Auto-disabled on pre-10.11 macOS targets by
# config.libs.sh because the file uses Xcode 7-era Obj-C syntax.
HAVE_RETROARCH_PLAYLIST_MANAGER=auto
HAVE_MFI=auto # GameController.framework joypad support (Apple)
+16 -1
View File
@@ -29,6 +29,21 @@
#include <AppKit/AppKit.h>
#endif
/* RetroArchPlaylistManager.m/.h uses Obj-C nullability macros
* (NS_ASSUME_NONNULL_BEGIN/END, nullable, _Nonnull) and
* lightweight generics (NSArray<...>) - all Xcode 7+ (2015)
* features requiring SDK 10.11 / iOS 9.0 or newer. Synthesize
* HAVE_RETROARCH_PLAYLIST_MANAGER here for build systems that
* don't pass it in (e.g. the RetroArch_PPC.xcodeproj, non-qb
* builds). qb/config.libs.sh sets the flag directly for make
* builds and takes priority if already defined. */
#ifndef HAVE_RETROARCH_PLAYLIST_MANAGER
#if defined(HAVE_COCOATOUCH) || \
(defined(MAC_OS_X_VERSION_MAX_ALLOWED) && MAC_OS_X_VERSION_MAX_ALLOWED >= 101100)
#define HAVE_RETROARCH_PLAYLIST_MANAGER 1
#endif
#endif
#include "../../../retroarch.h"
#if TARGET_OS_IPHONE && defined(HAVE_COCOATOUCH)
@@ -128,7 +143,7 @@ void cocoa_show_mouse(void *data, bool state);
void *cocoa_screen_get_chosen(void);
#ifdef HAVE_COCOATOUCH
#ifdef HAVE_RETROARCH_PLAYLIST_MANAGER
bool cocoa_launch_game_by_filename(NSString *filename);
#endif
+3 -3
View File
@@ -23,7 +23,7 @@
#include "cocoa_common.h"
#include "apple_platform.h"
#include "../ui_cocoa.h"
#ifdef HAVE_COCOATOUCH
#ifdef HAVE_RETROARCH_PLAYLIST_MANAGER
#include "RetroArchPlaylistManager.h"
#endif
@@ -1197,7 +1197,7 @@ void cocoa_file_load_with_detect_core(const char *filename)
}
}
#ifdef HAVE_COCOATOUCH
#ifdef HAVE_RETROARCH_PLAYLIST_MANAGER
bool cocoa_launch_game_by_filename(NSString *filename)
{
core_info_list_t *core_info_list = NULL;
@@ -1294,4 +1294,4 @@ bool cocoa_launch_game_by_filename(NSString *filename)
return task_push_load_content_with_new_core_from_companion_ui(
info->path, full_path, NULL, NULL, NULL, &content_info, NULL, NULL);
}
#endif /* HAVE_COCOATOUCH */
#endif /* HAVE_RETROARCH_PLAYLIST_MANAGER */