Skip to content

Commit

Permalink
Merge pull request #739 from wheremyfoodat/ios
Browse files Browse the repository at this point in the history
[Core] Improve iOS compilation workflow
  • Loading branch information
wheremyfoodat authored Mar 5, 2025
2 parents 0a65519 + ebefbdc commit 08fbf6b
Show file tree
Hide file tree
Showing 4 changed files with 969 additions and 3 deletions.
15 changes: 13 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ option(ENABLE_RENDERDOC_API "Build with support for Renderdoc's capture API for
option(DISABLE_SSE4 "Build with SSE4 instructions disabled, may reduce performance" OFF)
option(USE_LIBRETRO_AUDIO "Enable to use the LR audio device with the LR core. Otherwise our own device is used" OFF)

# Discord RPC & LuaJIT are currently not supported on iOS
if(IOS)
set(ENABLE_DISCORD_RPC OFF)
set(ENABLE_LUAJIT OFF)
endif()

set(OPENGL_PROFILE ${DEFAULT_OPENGL_PROFILE} CACHE STRING "OpenGL profile to use if OpenGL is enabled. Valid values are 'OpenGL' and 'OpenGLES'.")
set_property(CACHE OPENGL_PROFILE PROPERTY STRINGS OpenGL OpenGLES)

Expand Down Expand Up @@ -320,8 +326,8 @@ set(SOURCE_FILES src/emulator.cpp src/io_file.cpp src/config.cpp
src/core/CPU/cpu_dynarmic.cpp src/core/CPU/dynarmic_cycles.cpp
src/core/memory.cpp src/renderer.cpp src/core/renderer_null/renderer_null.cpp
src/http_server.cpp src/stb_image_write.c src/core/cheats.cpp src/core/action_replay.cpp
src/discord_rpc.cpp src/lua.cpp src/memory_mapped_file.cpp src/miniaudio.cpp src/renderdoc.cpp
src/frontend_settings.cpp
src/discord_rpc.cpp src/lua.cpp src/memory_mapped_file.cpp src/renderdoc.cpp
src/frontend_settings.cpp src/miniaudio/miniaudio.cpp
)
set(CRYPTO_SOURCE_FILES src/core/crypto/aes_engine.cpp)
set(KERNEL_SOURCE_FILES src/core/kernel/kernel.cpp src/core/kernel/resource_limits.cpp
Expand Down Expand Up @@ -410,6 +416,11 @@ set(HEADER_FILES include/emulator.hpp include/helpers.hpp include/termcolor.hpp
include/audio/audio_device_interface.hpp include/audio/libretro_audio_device.hpp
)

if(IOS)
set(SOURCE_FILES ${SOURCE_FILES} src/miniaudio/miniaudio.m)
target_compile_definitions(AlberCore PUBLIC "PANDA3DS_IOS=1")
endif()

cmrc_add_resource_library(
resources_console_fonts
NAMESPACE ConsoleFonts
Expand Down
4 changes: 3 additions & 1 deletion src/miniaudio.cpp → src/miniaudio/miniaudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@
#define MA_NO_ENCODING
#define MINIAUDIO_IMPLEMENTATION

#include "miniaudio.h"
#ifndef PANDA3DS_IOS
#include "miniaudio.h"
#endif
8 changes: 8 additions & 0 deletions src/miniaudio/miniaudio.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// We do not need the ability to be able to encode or decode audio files for the time being
// So we disable said functionality to make the executable smaller.
#define MA_NO_DECODING
#define MA_NO_ENCODING
#define MINIAUDIO_IMPLEMENTATION

// On iOS we have to compile miniaudio as Obj-C
#include "miniaudio.h"
Loading

0 comments on commit 08fbf6b

Please sign in to comment.