iOS/tvOS: Build as shared library instead of module, to satisfy App Store

This commit is contained in:
Eric Warmenhoven 2024-05-20 10:20:06 -04:00 committed by Jesse Talavera
parent 3102748b13
commit 7158502b59
3 changed files with 13 additions and 4 deletions

View File

@ -135,7 +135,7 @@ libretro-build-ios-arm64:
- .libretro-ios-cmake-arm64
- .core-defs
variables:
CORE_ARGS: --toolchain ./cmake/toolchain/ios.toolchain.cmake -DPLATFORM=OS64 -DDEPLOYMENT_TARGET=13
CORE_ARGS: --toolchain ./cmake/toolchain/ios.toolchain.cmake -DPLATFORM=OS64 -DDEPLOYMENT_TARGET=13 -DBUILD_AS_SHARED_LIBRARY=ON
IOS_MINVER: "13.0"
CXXFLAGS: -Wno-deprecated-declarations -Wno-unknown-attributes
@ -145,6 +145,6 @@ libretro-build-tvos-arm64:
- .libretro-tvos-cmake-arm64
- .core-defs
variables:
CORE_ARGS: --toolchain ./cmake/toolchain/ios.toolchain.cmake -DPLATFORM=TVOS -DDEPLOYMENT_TARGET=13
CORE_ARGS: --toolchain ./cmake/toolchain/ios.toolchain.cmake -DPLATFORM=TVOS -DDEPLOYMENT_TARGET=13 -DBUILD_AS_SHARED_LIBRARY=ON
IOS_MINVER: "13.0"
CXXFLAGS: -Wno-deprecated-declarations -Wno-unknown-attributes

View File

@ -100,6 +100,9 @@ option(ENABLE_THREADED_RENDERER "Enable the threaded software renderer." ON)
option(BUILD_TESTING "Build test suite." OFF)
include(CTest)
# iOS/tvOS want the library built SHARED, other platforms have been happy with MODULE
option(BUILD_AS_SHARED_LIBRARY "Allow for both linking and loading" OFF)
add_subdirectory(src/libretro)
include(cmake/GenerateAttributions.cmake)

View File

@ -3,7 +3,13 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
include(embed-binaries)
add_library(melondsds_libretro MODULE
if (BUILD_AS_SHARED_LIBRARY)
set(LIBRARY_TYPE SHARED)
else ()
set(LIBRARY_TYPE MODULE)
endif ()
add_library(melondsds_libretro ${LIBRARY_TYPE}
buffer.cpp
buffer.hpp
config/config.hpp
@ -254,4 +260,4 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug")
message(STATUS "Defining DEBUG in melondsds_libretro and libretro-common targets")
target_compile_definitions(melondsds_libretro PUBLIC DEBUG)
target_compile_definitions(libretro-common PUBLIC DEBUG)
endif ()
endif ()