This commit is contained in:
leo60228 2024-04-10 21:43:44 +02:00 committed by GitHub
commit 31a3280c0a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 111 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 287 KiB

View File

@ -0,0 +1,14 @@
{
"images" : [
{
"filename" : "AppIcon.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -25,7 +25,7 @@ option(REMOVE_ABSOLUTE_PATHS "If supported by the compiler, replace all absolute
# Architecture Flags
if(APPLE)
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
# 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)
if(NOT CMAKE_OSX_SYSROOT)
@ -38,6 +38,8 @@ if(APPLE)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.9)
link_directories(/usr/local/lib)
add_compile_options(-Werror=partial-availability)
elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS")
set(CMAKE_OSX_DEPLOYMENT_TARGET 12.0) # SDL goes back to iOS 8.0, but modern Xcode doesn't
endif()
project(VVVVVV)
@ -48,7 +50,10 @@ endif()
# RPATH
if(NOT WIN32)
if(APPLE)
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
set(BIN_LIBROOT "Frameworks")
set(BIN_RPATH "@executable_path/Frameworks")
elseif(APPLE)
set(BIN_LIBROOT "osx")
set(BIN_RPATH "@executable_path/osx")
elseif(CMAKE_SIZEOF_VOID_P MATCHES "8")
@ -125,12 +130,39 @@ endif()
if(GOG)
list(APPEND VVV_SRC src/GOGNetwork.c)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
list(APPEND VVV_SRC src/SDL_uikit_main.c)
endif()
# Executable information
if(WIN32)
add_executable(VVVVVV WIN32 ${VVV_SRC} icon.rc)
elseif(ANDROID)
add_library(VVVVVV SHARED ${VVV_SRC})
elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS")
file(GLOB_RECURSE REPO_RESOURCES "fonts/*" "lang/*")
add_executable(VVVVVV MACOSX_BUNDLE ${VVV_SRC} ${DATA_ZIP} AppIcon.xcassets ${REPO_RESOURCES})
set_target_properties(VVVVVV PROPERTIES
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "com.distractionware.vvvvvvmobile"
XCODE_ATTRIBUTE_PRODUCT_NAME "VVVVVV"
XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2" # iPhone, iPad
XCODE_ATTRIBUTE_CURRENT_PROJECT_VERSION "2.4"
XCODE_ATTRIBUTE_MARKETING_VERSION "2.4"
XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME AppIcon
XCODE_ATTRIBUTE_GENERATE_INFOPLIST_FILE YES
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist"
XCODE_ATTRIBUTE_INFOPLIST_KEY_LSSupportsOpeningDocumentsInPlace YES
XCODE_ATTRIBUTE_INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents YES
RESOURCE "${DATA_ZIP};AppIcon.xcassets"
)
foreach(REPO_FILE ${REPO_RESOURCES})
file(RELATIVE_PATH REPO_FILE_REL "${CMAKE_CURRENT_SOURCE_DIR}" ${REPO_FILE})
get_filename_component(REPO_FILE_DIR ${REPO_FILE_REL} DIRECTORY)
set_property(SOURCE ${REPO_FILE} PROPERTY MACOSX_PACKAGE_LOCATION "Resources/${REPO_FILE_DIR}")
source_group("Resources/${REPO_FILE_DIR}" FILES "${REPO_FILE}")
endforeach()
else()
add_executable(VVVVVV ${VVV_SRC})
endif()
@ -426,6 +458,15 @@ elseif (EMSCRIPTEN)
target_compile_options(faudio-static PUBLIC -sUSE_SDL=2)
target_link_libraries(faudio-static -sUSE_SDL=2)
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()
# Only try to autodetect if both SDL2 variables aren't explicitly set
find_package(SDL2 CONFIG)

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIFileSharingEnabled</key>
<true/>
</dict>
</plist>

View File

@ -1330,6 +1330,19 @@ static int PLATFORM_getOSDirectory(char* output, const size_t output_size)
}
SDL_snprintf(output, output_size, "%s/", externalStoragePath);
return 1;
#elif defined(TARGET_OS_IPHONE)
// (ab)use SDL APIs to get the path to the Documents folder without needing Objective-C
const char* prefsPath = SDL_GetPrefPath("", "");
if (prefsPath == NULL)
{
vlog_error(
"Could not get OS directory: %s",
SDL_GetError()
);
return 0;
}
SDL_snprintf(output, output_size, "%s/../../Documents/", prefsPath);
return 1;
#else
const char* prefDir = PHYSFS_getPrefDir("distractionware", "VVVVVV");
if (prefDir == NULL)

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: */

View File

@ -3,8 +3,9 @@
#include <stdarg.h>
#include <stdio.h>
#ifdef __ANDROID__
#if defined(__ANDROID__) || defined(TARGET_OS_IPHONE)
// forward to SDL logging on Android, since stdout/stderr are /dev/null
// they exist on iOS, but just get forwarded to the system log anyway, so might as well provide proper metadata
#define VLOG_USE_SDL 1
#endif

View File

@ -562,6 +562,8 @@ int main(int argc, char *argv[])
/* We already do the button swapping in ButtonGlyphs, disable SDL's swapping */
SDL_SetHintWithPriority(SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS, "0", SDL_HINT_OVERRIDE);
SDL_SetHintWithPriority(SDL_HINT_ORIENTATIONS, "LandscapeLeft LandscapeRight", SDL_HINT_OVERRIDE);
if(!FILESYSTEM_init(argv[0], baseDir, assetsPath, langDir, fontsDir))
{
vlog_error("Unable to initialize filesystem!");