Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 12 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ include:
- project: 'libretro-infrastructure/ci-templates'
file: '/tvos-cmake.yml'

################################## CONSOLES ################################
# Nintendo Switch 2
- project: 'libretro-infrastructure/ci-templates'
file: '/libounce-cmake.yml'

################################## MISC ####################################
# webOS aarch64
- project: 'libretro-infrastructure/ci-templates'
Expand Down Expand Up @@ -149,6 +154,13 @@ libretro-build-tvos-arm64:
CMAKE_ADDL_COMP_FLAGS: ""
MINVER: 14.0

################################### CONSOLES #################################
# Nintendo Switch 2
libretro-build-libounce-aarch64:
extends:
- .libretro-libounce-cmake-aarch64
- .core-defs

################################## MISC ####################################
# webOS aarch64
libretro-build-webos-aarch64:
Expand Down
24 changes: 22 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ set(CMAKE_CXX_SCAN_FOR_MODULES OFF)

project(dolphin-emu)

if(LIBRETRO AND SWITCH2)
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)
set(CMAKE_C_STANDARD_LIBRARIES "-lgcc")
set(CMAKE_CXX_STANDARD_LIBRARIES "-lgcc")
add_compile_options(-mtls-dialect=trad -ftls-model=global-dynamic
$<$<COMPILE_LANGUAGE:CXX>:-fuse-cxa-atexit>)
endif()

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake)

# Support functions
Expand Down Expand Up @@ -121,6 +129,7 @@ option(ENABLE_AUTOUPDATE "Enables support for automatic updates" ON)
option(USE_RETRO_ACHIEVEMENTS "Enables integration with retroachievements.org" ON)
option(ENABLE_CCACHE "Enables CCache compiler cache" OFF)
option(LIBRETRO "Build as a libretro library" OFF)
option(SWITCH2 "Build for the libretro core for the Switch platform" OFF)

# Maintainers: if you consider blanket disabling this for your users, please
# consider the following points:
Expand All @@ -140,6 +149,10 @@ if (MSVC)
set(CMAKE_CXX_FLAGS_RELEASE "/MT")
endif()

if(SWITCH2)
add_compile_definitions(__SWITCH2__=1)
endif()

# TODO: Add DSPSpy
option(DSPTOOL "Build dsptool" OFF)

Expand Down Expand Up @@ -532,6 +545,13 @@ if(LIBRETRO)
endif()
set(USE_SYSTEM_CURL OFF CACHE BOOL "" FORCE)
endif()
if(SWITCH2)
set(ENABLE_EGL OFF CACHE BOOL "" FORCE)
set(ENABLE_HWDB OFF CACHE BOOL "" FORCE)
set(ENABLE_EVDEV OFF CACHE BOOL "" FORCE)
set(ENABLE_X11 OFF CACHE BOOL "" FORCE)
set(USE_MGBA OFF CACHE BOOL "" FORCE)
endif()
endif()

if(ENABLE_HEADLESS)
Expand Down Expand Up @@ -780,7 +800,7 @@ if(ENABLE_CUBEB)
add_definitions(-DHAVE_CUBEB)
endif()

if(NOT ANDROID AND NOT IOS AND NOT WEBOS)
if(NOT ANDROID AND NOT IOS AND NOT WEBOS AND NOT SWITCH2)
dolphin_find_optional_system_library(LibUSB Externals/libusb)
add_definitions(-D__LIBUSB__)
endif()
Expand All @@ -801,7 +821,7 @@ dolphin_find_optional_system_library(MBEDTLS Externals/mbedtls 2.28)

dolphin_find_optional_system_library(CURL Externals/curl)

if(NOT ANDROID AND NOT IOS)
if(NOT ANDROID AND NOT IOS AND NOT SWITCH2)
dolphin_find_optional_system_library(HIDAPI Externals/hidapi)
endif()

Expand Down
30 changes: 30 additions & 0 deletions Externals/SFML/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,36 @@ target_compile_features(sfml-system PUBLIC cxx_std_20)
target_compile_definitions(sfml-system PUBLIC SFML_STATIC)
target_include_directories(sfml-system PUBLIC SFML/include PRIVATE SFML/src)
target_include_directories(sfml-network PUBLIC SFML/include PRIVATE SFML/src)

if(LIBRETRO AND SWITCH2)
set(sfml_config "${CMAKE_CURRENT_SOURCE_DIR}/SFML/include/SFML/Config.hpp")
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${sfml_config}")
file(READ "${sfml_config}" sfml_config_contents)

set(sfml_platform_branch "#elif defined(__unix__)")
string(FIND "${sfml_config_contents}" "${sfml_platform_branch}" sfml_platform_offset)
if(sfml_platform_offset EQUAL -1)
message(FATAL_ERROR "SFML Config.hpp platform detection has changed")
endif()

set(sfml_switch_platform [=[
#elif defined(__LIBRETRO__) && defined(__SWITCH2__)

#define SFML_SYSTEM_SWITCH

#elif defined(__unix__)
]=])
string(STRIP "${sfml_switch_platform}" sfml_switch_platform)
string(REPLACE "${sfml_platform_branch}" "${sfml_switch_platform}"
sfml_config_contents "${sfml_config_contents}")

file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/include/SFML")
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/include/SFML/Config.hpp" "${sfml_config_contents}")

target_include_directories(sfml-system BEFORE PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/include")
target_include_directories(sfml-network BEFORE PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/include")
endif()

target_link_libraries(sfml-network PUBLIC sfml-system)
dolphin_disable_warnings(sfml-network)
dolphin_disable_warnings(sfml-system)
4 changes: 4 additions & 0 deletions Externals/imgui/imgui_user_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@
#define IM_ASSERT(_EXPR) ASSERT(_EXPR)

#define IMGUI_DISABLE_DEMO_WINDOWS

#if defined(__LIBRETRO__) && defined(__SWITCH2__)
#define IMGUI_DISABLE_DEFAULT_SHELL_FUNCTIONS
#endif
13 changes: 13 additions & 0 deletions Externals/implot/implot_isnan_fix.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,16 @@
#include <cmath>

using std::isnan;

#if defined(__LIBRETRO__) && defined(__SWITCH2__)
#include <chrono>
#include <ctime>

inline time_t timegm(struct tm* value)
{
using namespace std::chrono;
const auto date = sys_days{year{value->tm_year + 1900} / January / 1 + months{value->tm_mon}};
return duration_cast<seconds>((date + days{value->tm_mday - 1}).time_since_epoch()).count() +
value->tm_hour * 3600 + value->tm_min * 60 + value->tm_sec;
}
#endif
Loading
Loading