1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-03 03:23:33 +02:00

build for iOS

This commit is contained in:
leo60228 2024-01-23 17:15:21 -05:00
parent ea8633514d
commit 075c5b0c14
No known key found for this signature in database
GPG Key ID: 6F3EB461799AD95E
2 changed files with 46 additions and 2 deletions

View File

@ -25,7 +25,7 @@ option(REMOVE_ABSOLUTE_PATHS "If supported by the compiler, replace all absolute
# Architecture Flags # Architecture Flags
if(APPLE) if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
# Wow, Apple is a huge jerk these days huh? # Wow, Apple is a huge jerk these days huh?
set(OSX_10_9_SDK_PATH /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk) set(OSX_10_9_SDK_PATH /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk)
if(NOT CMAKE_OSX_SYSROOT) if(NOT CMAKE_OSX_SYSROOT)
@ -47,7 +47,7 @@ if(APPLE)
endif() endif()
# RPATH # RPATH
if(NOT WIN32) if(NOT WIN32 AND NOT CMAKE_SYSTEM_NAME STREQUAL "iOS")
if(APPLE) if(APPLE)
set(BIN_LIBROOT "osx") set(BIN_LIBROOT "osx")
set(BIN_RPATH "@executable_path/osx") set(BIN_RPATH "@executable_path/osx")
@ -125,12 +125,24 @@ endif()
if(GOG) if(GOG)
list(APPEND VVV_SRC src/GOGNetwork.c) list(APPEND VVV_SRC src/GOGNetwork.c)
endif() endif()
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
list(APPEND VVV_SRC src/SDL_uikit_main.c)
endif()
# Executable information # Executable information
if(WIN32) if(WIN32)
add_executable(VVVVVV WIN32 ${VVV_SRC} icon.rc) add_executable(VVVVVV WIN32 ${VVV_SRC} icon.rc)
elseif(ANDROID) elseif(ANDROID)
add_library(VVVVVV SHARED ${VVV_SRC}) add_library(VVVVVV SHARED ${VVV_SRC})
elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS")
add_executable(VVVVVV MACOSX_BUNDLE ${VVV_SRC})
set_target_properties(VVVVVV PROPERTIES
MACOSX_BUNDLE_BUNDLE_NAME "VVVVVV"
MACOSX_BUNDLE_BUNDLE_VERSION "2.4" # TODO: fill out automatically
MACOSX_BUNDLE_SHORT_VERSION_STRING "2.4" # TODO: fill out automatically
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "com.distractionware.vvvvvvmobile"
MACOSX_BUNDLE_GUI_IDENTIFIER "com.distractionware.vvvvvvmobile"
)
else() else()
add_executable(VVVVVV ${VVV_SRC}) add_executable(VVVVVV ${VVV_SRC})
endif() endif()
@ -421,6 +433,15 @@ elseif (EMSCRIPTEN)
target_compile_options(faudio-static PUBLIC -sUSE_SDL=2) target_compile_options(faudio-static PUBLIC -sUSE_SDL=2)
target_link_libraries(faudio-static -sUSE_SDL=2) target_link_libraries(faudio-static -sUSE_SDL=2)
endif() endif()
elseif(DEFINED SDL2_FRAMEWORK)
message(STATUS "Using pre-defined SDL2 variable SDL2_FRAMEWORK")
target_include_directories(VVVVVV SYSTEM PRIVATE "$<BUILD_INTERFACE:${SDL2_FRAMEWORK}/Headers>")
target_link_libraries(VVVVVV ${SDL2_FRAMEWORK})
if(BUNDLE_DEPENDENCIES)
target_include_directories(faudio-static SYSTEM PRIVATE "$<BUILD_INTERFACE:${SDL2_FRAMEWORK}/Headers>")
target_link_libraries(faudio-static ${SDL2_FRAMEWORK})
endif()
set_target_properties(VVVVVV PROPERTIES XCODE_EMBED_FRAMEWORKS ${SDL2_FRAMEWORK})
else() else()
# Only try to autodetect if both SDL2 variables aren't explicitly set # Only try to autodetect if both SDL2 variables aren't explicitly set
find_package(SDL2 CONFIG) find_package(SDL2 CONFIG)

View File

@ -0,0 +1,23 @@
/*
SDL_uikit_main.c, placed in the public domain by Sam Lantinga 3/18/2019
*/
/* Include the SDL main definition header */
#include "SDL_main.h"
#if defined(__IPHONEOS__) || defined(__TVOS__)
#ifndef SDL_MAIN_HANDLED
#ifdef main
#undef main
#endif
int main(int argc, char *argv[])
{
return SDL_UIKitRunApp(argc, argv, SDL_main);
}
#endif /* !SDL_MAIN_HANDLED */
#endif /* __IPHONEOS__ || __TVOS__ */
/* vi: set ts=4 sw=4 expandtab: */