Skip to content

Commit a1b7b3c

Browse files
committed
i wonder if this breaks iOS devices
1 parent e906711 commit a1b7b3c

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

CMakeLists.txt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,32 @@ add_subdirectory($ENV{GEODE_SDK} ${CMAKE_CURRENT_BINARY_DIR}/geode)
3030
CPMAddPackage("gh:mackron/miniaudio#f40cf03")
3131
target_link_libraries(${PROJECT_NAME} miniaudio)
3232

33+
# https://miniaud.io/docs/manual/index.html
34+
# The macOS build should compile cleanly without the need to download any dependencies
35+
# nor link to any libraries or frameworks.
36+
# The iOS build needs to be compiled as Objective-C and will need to link the relevant frameworks
37+
# but should compile cleanly out of the box with Xcode.
38+
# Compiling through the command line requires linking to -lpthread and -lm.
39+
40+
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "iOS" OR IOS)
41+
add_library(miniaudio STATIC ${miniaudio_SOURCE_DIR}/miniaudio.c)
42+
target_include_directories(miniaudio PUBLIC ${miniaudio_SOURCE_DIR})
43+
set_source_files_properties(${miniaudio_SOURCE_DIR}/miniaudio.c PROPERTIES LANGUAGE OBJC)
44+
target_link_libraries(miniaudio PUBLIC
45+
"-framework AudioToolbox"
46+
"-framework AVFoundation"
47+
"-framework CoreAudio"
48+
"-framework CoreFoundation"
49+
"-framework CoreGraphics"
50+
"-framework CoreMedia"
51+
"-framework Foundation"
52+
"-framework MediaPlayer"
53+
"-framework OpenGLES"
54+
"-framework QuartzCore"
55+
"-framework UIKit"
56+
pthread
57+
m
58+
)
59+
endif()
60+
3361
setup_geode_mod(${PROJECT_NAME})

0 commit comments

Comments
 (0)