Skip to content

Commit 098546e

Browse files
committed
fix: exclude NFD from iOS builds
nativefiledialog-extended has no iOS backend (requires AppKit), which breaks CMake configure with APPKIT_LIBRARY NOTFOUND. Gate it out of the build for iOS and stub the installer's file picker with a message pointing at the Files app flow (UIFileSharingEnabled is already set).
1 parent 5d5adbc commit 098546e

3 files changed

Lines changed: 25 additions & 2 deletions

File tree

‎UnleashedRecomp/CMakeLists.txt‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,6 @@ set(UNLEASHED_RECOMP_LINK_LIBS
472472
fmt::fmt
473473
zstd::libzstd
474474
msdf-atlas-gen::msdf-atlas-gen
475-
nfd::nfd
476475
o1heap
477476
XenonUtils
478477
SDL2::SDL2-static
@@ -484,6 +483,10 @@ set(UNLEASHED_RECOMP_LINK_LIBS
484483
plume
485484
)
486485

486+
if(NOT IOS)
487+
list(APPEND UNLEASHED_RECOMP_LINK_LIBS nfd::nfd)
488+
endif()
489+
487490
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
488491
list(PREPEND UNLEASHED_RECOMP_LINK_LIBS SDL2::SDL2main)
489492
list(APPEND UNLEASHED_RECOMP_LINK_LIBS "-framework UniformTypeIdentifiers")

‎UnleashedRecomp/ui/installer_wizard.cpp‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#include "installer_wizard.h"
22

3+
#ifdef __APPLE__
4+
#include <TargetConditionals.h>
5+
#endif
6+
#if !TARGET_OS_IPHONE
37
#include <nfd.h>
8+
#endif
49

510
#include <apu/embedded_player.h>
611
#include <install/installer.h>
@@ -1083,6 +1088,7 @@ static void DrawProgressBar(float progressRatio)
10831088
drawList->AddRectFilledMultiColor(sliderMin, sliderMax, sliderColor0, sliderColor0, sliderColor1, sliderColor1);
10841089
}
10851090

1091+
#if !TARGET_OS_IPHONE
10861092
static bool ConvertPathSet(const nfdpathset_t *pathSet, std::list<std::filesystem::path> &filePaths)
10871093
{
10881094
nfdpathsetsize_t pathSetCount = 0;
@@ -1132,6 +1138,14 @@ static void PickerThreadProcess()
11321138

11331139
g_currentPickerResultsReady = true;
11341140
}
1141+
#else
1142+
static void PickerThreadProcess()
1143+
{
1144+
// NFD has no iOS backend; files are added through the app's Documents folder via the Files app.
1145+
g_currentPickerErrorMessage = "The file picker is not available on iOS. Copy your game files into this app's Documents folder using the Files app.";
1146+
g_currentPickerResultsReady = true;
1147+
}
1148+
#endif
11351149

11361150
static void PickerStart(bool folderMode) {
11371151
if (g_currentPickerThread != nullptr)
@@ -1849,7 +1863,9 @@ bool InstallerWizard::Run(std::filesystem::path installPath, bool skipGame)
18491863
g_installPath = installPath;
18501864

18511865
EmbeddedPlayer::Init();
1866+
#if !TARGET_OS_IPHONE
18521867
NFD_Init();
1868+
#endif
18531869

18541870
// Guarantee one controller is initialized. We'll rely on SDL's event loop to get the controller events.
18551871
XAMINPUT_STATE inputState;
@@ -1880,7 +1896,9 @@ bool InstallerWizard::Run(std::filesystem::path installPath, bool skipGame)
18801896
}
18811897

18821898
GameWindow::SetFullscreenCursorVisibility(false);
1899+
#if !TARGET_OS_IPHONE
18831900
NFD_Quit();
1901+
#endif
18841902

18851903
InstallerWizard::Shutdown();
18861904
EmbeddedPlayer::Shutdown();

‎thirdparty/CMakeLists.txt‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ if (WIN32)
2424
endif()
2525

2626
add_subdirectory("${UNLEASHED_RECOMP_THIRDPARTY_ROOT}/msdf-atlas-gen")
27-
add_subdirectory("${UNLEASHED_RECOMP_THIRDPARTY_ROOT}/nativefiledialog-extended")
27+
if(NOT IOS)
28+
add_subdirectory("${UNLEASHED_RECOMP_THIRDPARTY_ROOT}/nativefiledialog-extended")
29+
endif()
2830
add_subdirectory("${UNLEASHED_RECOMP_THIRDPARTY_ROOT}/o1heap")
2931
add_subdirectory("${UNLEASHED_RECOMP_THIRDPARTY_ROOT}/SDL")
3032
add_subdirectory("${UNLEASHED_RECOMP_THIRDPARTY_ROOT}/SDL_mixer")

0 commit comments

Comments
 (0)