diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c5a1464..0c43481 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f7f3d3..49c2529 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/src/libretro/CMakeLists.txt b/src/libretro/CMakeLists.txt index 7dff6ac..13022d3 100644 --- a/src/libretro/CMakeLists.txt +++ b/src/libretro/CMakeLists.txt @@ -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 () \ No newline at end of file +endif ()