Skip to content
Open
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ include(CompilerFlags)
# Registers build options that are exposed to cmake
include(CMakeOptions.txt)

if ("${PLATFORM}" STREQUAL "iOS")
enable_language(OBJC)
endif()

if (UNIX AND NOT APPLE AND NOT "${PLATFORM}" MATCHES "DRM" AND NOT "${PLATFORM}" MATCHES "Web" AND NOT "${PLATFORM}" MATCHES "SDL")
if (NOT GLFW_BUILD_WAYLAND AND NOT GLFW_BUILD_X11)
message(FATAL_ERROR "Cannot disable both Wayland and X11")
Expand Down
2 changes: 1 addition & 1 deletion CMakeOptions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if(EMSCRIPTEN)
# When configuring web builds with "emcmake cmake -B build -S .", set PLATFORM to Web by default
SET(PLATFORM Web CACHE STRING "Platform to build for.")
endif()
enum_option(PLATFORM "Desktop;Win32;Web;WebRGFW;Android;Raspberry Pi;DRM;SDL;RGFW;Memory" "Platform to build for.")
enum_option(PLATFORM "Desktop;Win32;Web;WebRGFW;Android;iOS;Raspberry Pi;DRM;SDL;RGFW;Memory" "Platform to build for.")

enum_option(OPENGL_VERSION "OFF;4.3;3.3;2.1;1.1;ES 2.0;ES 3.0;Software" "Force a specific OpenGL Version?")

Expand Down
18 changes: 18 additions & 0 deletions cmake/LibraryConfigurations.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,24 @@ elseif (${PLATFORM} STREQUAL "Android")
set(LIBS_PRIVATE log android EGL GLESv2 OpenSLES atomic c)
set(LIBS_PUBLIC m)

elseif (${PLATFORM} STREQUAL "iOS")
set(PLATFORM_CPP "PLATFORM_IOS")
set(GRAPHICS "GRAPHICS_API_OPENGL_ES3")

find_library(UIKIT_LIBRARY UIKit)
find_library(QUARTZCORE_LIBRARY QuartzCore)
find_library(OPENGL_ES_LIBRARY OpenGLES)
find_library(COREMOTION_LIBRARY CoreMotion)
find_library(FOUNDATION_LIBRARY Foundation)

set(LIBS_PRIVATE
${UIKIT_LIBRARY}
${QUARTZCORE_LIBRARY}
${OPENGL_ES_LIBRARY}
${COREMOTION_LIBRARY}
${FOUNDATION_LIBRARY}
)

elseif ("${PLATFORM}" STREQUAL "DRM")
set(PLATFORM_CPP "PLATFORM_DRM")

Expand Down
9 changes: 9 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ set(raylib_sources
rtextures.c
)

if (${PLATFORM} STREQUAL "iOS")
list(APPEND raylib_sources platforms/rcore_ios_main.m)
endif()

# Only build raudio if it's enabled
if (NOT DEFINED SUPPORT_MODULE_RAUDIO OR SUPPORT_MODULE_RAUDIO)
list(APPEND raylib_sources raudio.c)
Expand Down Expand Up @@ -112,6 +116,11 @@ target_link_libraries(raylib PUBLIC ${LIBS_PUBLIC})
# and you will be able to select more build options
include(CompileDefinitions)

if (${PLATFORM} STREQUAL "iOS")
target_compile_definitions(raylib PRIVATE GLES_SILENCE_DEPRECATION=1)
target_compile_options(raylib PRIVATE -Wno-deprecated-declarations)
endif()

# Registering include directories
target_include_directories(raylib
PUBLIC
Expand Down
Loading