From 3bf9f4b83467b7de66f49b18130bc47ece3f27a7 Mon Sep 17 00:00:00 2001 From: crueter Date: Fri, 27 Mar 2026 16:57:26 -0400 Subject: [PATCH] Build fixes Signed-off-by: crueter --- .ci/ios/build.sh | 4 -- CMakeLists.txt | 36 ++++++++++++-- .../cmake-modules/DetectArchitecture.cmake | 2 +- externals/libusb/CMakeLists.txt | 3 +- src/ios/AppUI.swift | 1 - src/ios/CMakeLists.txt | 47 +++++++++++++++++-- src/ios/ContentView.swift | 16 +++---- src/yuzu/CMakeLists.txt | 2 +- 8 files changed, 88 insertions(+), 23 deletions(-) diff --git a/.ci/ios/build.sh b/.ci/ios/build.sh index 5537214cf9..cd3a57ec32 100755 --- a/.ci/ios/build.sh +++ b/.ci/ios/build.sh @@ -15,10 +15,6 @@ cmake -G Xcode -B build/ios \ -DDEPLOYMENT_TARGET=16.0 \ -DCMAKE_C_COMPILER="$(xcrun --sdk iphoneos --find clang)" \ -DCMAKE_CXX_COMPILER="$(xcrun --sdk iphoneos --find clang++)" \ - -DENABLE_LIBUSB=OFF \ - -DENABLE_QT=OFF \ - -DENABLE_WEB_SERVICE=OFF \ - -DENABLE_CUBEB=OFF \ -DCMAKE_BUILD_TYPE=Release \ "$@" diff --git a/CMakeLists.txt b/CMakeLists.txt index dd3349113b..4afadff0a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,29 @@ include(CMakeDependentOption) include(CTest) include(CPMUtil) +# TODO(crueter): Make this more automatic. +if (IOS) + list(APPEND CMAKE_FIND_ROOT_PATH "${CMAKE_OSX_SYSROOT_INT}" CACHE INTERNAL "") + list(APPEND CMAKE_PROGRAM_PATH "/opt/homebrew/bin" CACHE INTERNAL "") + + set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH CACHE INTERNAL "") + set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH CACHE INTERNAL "") + set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH CACHE INTERNAL "") + set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH CACHE INTERNAL "") + + list(LENGTH CMAKE_OSX_ARCHITECTURES _arch_len) + if (NOT _arch_len EQUAL 1) + message(FATAL_ERROR "CMAKE_OSX_ARCHITECTURES must contain exactly one architecture.") + endif() + + # TODO(crueter): Proper handling for this. + if (CMAKE_OSX_ARCHITECTURES STREQUAL arm64) + set(CMAKE_SYSTEM_PROCESSOR aarch64) + else() + set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_OSX_ARCHITECTURES}) + endif() +endif() + if (NOT DEFINED ARCHITECTURE) message(FATAL_ERROR "Architecture didn't make it out of scope, did you delete DetectArchitecture.cmake?") endif() @@ -67,7 +90,13 @@ if (YUZU_STATIC_ROOM) endif() # qt stuff -option(ENABLE_QT "Enable the Qt frontend" ON) +if (IOS OR ANDROID) + set(_default_qt OFF) +else() + set(_default_qt ON) +endif() + +option(ENABLE_QT "Enable the Qt frontend" ${_default_qt}) option(ENABLE_QT_TRANSLATION "Enable translations for the Qt frontend" OFF) cmake_dependent_option(ENABLE_UPDATE_CHECKER "Enable update checker (for Qt and Android)" OFF "ENABLE_QT OR ANDROID" OFF) cmake_dependent_option(YUZU_USE_QT_MULTIMEDIA "Use QtMultimedia for Camera" OFF "NOT YUZU_USE_BUNDLED_QT" OFF) @@ -179,7 +208,8 @@ endif() cmake_dependent_option(YUZU_USE_EXTERNAL_SDL2 "Build SDL2 from external source" OFF "NOT MSVC;NOT ANDROID" OFF) cmake_dependent_option(YUZU_USE_BUNDLED_SDL2 "Download bundled SDL2 build" "${EXT_DEFAULT}" "NOT ANDROID" OFF) -option(ENABLE_CUBEB "Enables the cubeb audio backend" ON) +# TODO(crueter): did not find header 'AudioHardware.h' in framework 'CoreAudio' +cmake_dependent_option(ENABLE_CUBEB "Enables the cubeb audio backend" ON "NOT IOS" OFF) # ffmpeg option(YUZU_USE_BUNDLED_FFMPEG "Download bundled FFmpeg" ${EXT_DEFAULT}) @@ -194,7 +224,7 @@ endif() option(YUZU_USE_BUNDLED_SIRIT "Download bundled sirit" ${BUNDLED_SIRIT_DEFAULT}) # FreeBSD 15+ has libusb, versions below should disable it -cmake_dependent_option(ENABLE_LIBUSB "Enable the use of LibUSB" ON "WIN32 OR PLATFORM_LINUX OR PLATFORM_FREEBSD OR APPLE" OFF) +cmake_dependent_option(ENABLE_LIBUSB "Enable the use of LibUSB" ON "WIN32 OR PLATFORM_LINUX OR PLATFORM_FREEBSD OR (APPLE AND NOT IOS)" OFF) cmake_dependent_option(ENABLE_OPENGL "Enable OpenGL" ON "NOT (WIN32 AND ARCHITECTURE_arm64) AND NOT APPLE" OFF) mark_as_advanced(FORCE ENABLE_OPENGL) diff --git a/externals/cmake-modules/DetectArchitecture.cmake b/externals/cmake-modules/DetectArchitecture.cmake index c4fd9e1ec3..a7e60eba30 100644 --- a/externals/cmake-modules/DetectArchitecture.cmake +++ b/externals/cmake-modules/DetectArchitecture.cmake @@ -35,7 +35,7 @@ This file is based off of Yuzu and Dynarmic. # Do note that situations where multiple architectures are defined # should NOT be too dependent on the architecture # otherwise, you may end up with duplicate code -if (CMAKE_OSX_ARCHITECTURES) +if (DEFINED CMAKE_OSX_ARCHITECTURES) set(MULTIARCH_BUILD 1) set(ARCHITECTURE "${CMAKE_OSX_ARCHITECTURES}") if (IOS) diff --git a/externals/libusb/CMakeLists.txt b/externals/libusb/CMakeLists.txt index 47b54f43cc..361e43a832 100644 --- a/externals/libusb/CMakeLists.txt +++ b/externals/libusb/CMakeLists.txt @@ -24,7 +24,8 @@ if (MINGW OR PLATFORM_LINUX OR APPLE) message(FATAL_ERROR "Required program `autoconf` not found.") endif() - find_program(LIBTOOLIZE libtoolize) + find_program(LIBTOOLIZE + NAMES libtoolize glibtoolize) if ("${LIBTOOLIZE}" STREQUAL "LIBTOOLIZE-NOTFOUND") message(FATAL_ERROR "Required program `libtoolize` not found.") endif() diff --git a/src/ios/AppUI.swift b/src/ios/AppUI.swift index dd1706ae23..b1d95324cc 100644 --- a/src/ios/AppUI.swift +++ b/src/ios/AppUI.swift @@ -7,7 +7,6 @@ import UIKit import Foundation import QuartzCore.CAMetalLayer -@main public struct AppUI { public static let shared = AppUI() diff --git a/src/ios/CMakeLists.txt b/src/ios/CMakeLists.txt index 525c182261..98b2585a5b 100644 --- a/src/ios/CMakeLists.txt +++ b/src/ios/CMakeLists.txt @@ -20,15 +20,54 @@ add_executable(eden-ios PomeloApp.swift ContentView.swift ) + +set(MACOSX_BUNDLE_GUI_IDENTIFIER "dev.eden-emu.eden") +set(MACOSX_BUNDLE_BUNDLE_NAME "Eden") +set(MACOSX_BUNDLE_INFO_STRING "Eden: A high-performance Nintendo Switch emulator") + +# TODO(crueter): Copyright, and versioning + # Keep bundle identifier as-is, for compatibility sake set_target_properties(eden-ios PROPERTIES - XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "com.yuzu-emu.yuzu" - XCODE_ATTRIBUTE_DEVELOPMENT_TEAM "YUZU1234" XCODE_ATTRIBUTE_SWIFT_OBJC_BRIDGING_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/AppUI-Bridging-Header.h" XCODE_ATTRIBUTE_SWIFT_OBJC_INTERFACE_HEADER_NAME "eden-ios-Swift.h" - XCODE_ATTRIBUTE_DERIVED_FILE_DIR "${CMAKE_CURRENT_BINARY_DIR}" -) + XCODE_ATTRIBUTE_DERIVED_FILE_DIR "${CMAKE_CURRENT_BINARY_DIR}") + target_link_libraries(eden-ios PRIVATE common core input_common frontend_common video_core sirit::sirit) target_link_libraries(eden-ios PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads) target_link_libraries(eden-ios PRIVATE SDL2::SDL2 glad stb::headers) create_target_directory_groups(eden-ios) + +# FIXME(crueter): This should /all/ be in a module of some kind! + +# Xcode will automatically generate the Assets.car and icns file for us. +set(_dist "${CMAKE_SOURCE_DIR}/dist") +if (CMAKE_GENERATOR MATCHES "Xcode") + set(_icons "${_dist}/eden.icon") + + set_target_properties(eden-ios PROPERTIES + XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME eden + MACOSX_BUNDLE_ICON_FILE eden + # Also force xcode to manage signing for us. + XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED ON + XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED ON + XCODE_ATTRIBUTE_CODE_SIGN_STYLE Automatic) +# Otherwise, we'll use our own. +else() + set(_icons "${_dist}/eden.icns" "${_dist}/Assets.car") +endif() + +set_source_files_properties(${_icons} PROPERTIES + MACOSX_PACKAGE_LOCATION Resources) +target_sources(eden-ios PRIVATE ${_icons}) + +set_target_properties(eden-ios PROPERTIES MACOSX_BUNDLE TRUE) + +set(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib") +find_library(MOLTENVK_LIBRARY MoltenVK REQUIRED) +message(STATUS "Using MoltenVK at ${MOLTENVK_LIBRARY}.") + +set_source_files_properties(${MOLTENVK_LIBRARY} PROPERTIES + MACOSX_PACKAGE_LOCATION Frameworks + XCODE_FILE_ATTRIBUTES "CodeSignOnCopy") +target_sources(eden-ios PRIVATE ${MOLTENVK_LIBRARY}) diff --git a/src/ios/ContentView.swift b/src/ios/ContentView.swift index 9ebe0622d7..877af33fcb 100644 --- a/src/ios/ContentView.swift +++ b/src/ios/ContentView.swift @@ -4,16 +4,16 @@ // SPDX-License-Identifier: GPL-3.0-or-later import SwiftUI -import Sudachi +//import AppUI struct ContentView: View { - @State var core = Core(games: [], root: FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]) +// @State var core = Core(games: [], root: FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]) var body: some View { - HomeView(core: core).onAppear() { - Air.play(AnyView( - Text("Select Game").font(.system(size: 100)) - )) - // rest of death - } +// HomeView(core: core).onAppear() { +// Air.play(AnyView( +// Text("Select Game").font(.system(size: 100)) +// )) +// // rest of death +// } } } diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt index 1ed1fdff2a..d94487ec79 100644 --- a/src/yuzu/CMakeLists.txt +++ b/src/yuzu/CMakeLists.txt @@ -369,7 +369,7 @@ if (APPLE) if (CMAKE_GENERATOR MATCHES "Xcode") set(_icons "${_dist}/eden.icon") - set_target_properties(eden PROPERTIES + set_target_properties(yuzu PROPERTIES XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME eden MACOSX_BUNDLE_ICON_FILE eden # Also force xcode to manage signing for us.