Merge pull request #10462 from OatmealDome/steam-runtime

DolphinQt: Add support for a Steam Runtime build
This commit is contained in:
JMC47 2022-06-06 20:18:06 -04:00 committed by GitHub
commit daf8e3ddde
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 66 additions and 6 deletions

View file

@ -50,6 +50,7 @@ if(NOT ANDROID)
endif()
option(USE_SHARED_ENET "Use shared libenet if found rather than Dolphin's soon-to-compatibly-diverge version" OFF)
option(USE_SHARED_LIBPNG "Use shared libpng if found" ON)
option(USE_UPNP "Enables UPnP port mapping support" ON)
option(ENABLE_NOGUI "Enable NoGUI frontend" ON)
option(ENABLE_QT "Enable Qt (Default)" ON)
@ -64,6 +65,7 @@ option(ENABLE_VULKAN "Enables vulkan video backend" ON)
option(USE_DISCORD_PRESENCE "Enables Discord Rich Presence, show the current game on Discord" ON)
option(USE_MGBA "Enables GBA controllers emulation using libmgba" ON)
option(ENABLE_AUTOUPDATE "Enables support for automatic updates" ON)
option(STEAM "Creates a build for Steam" ON)
# Maintainers: if you consider blanket disabling this for your users, please
# consider the following points:
@ -405,6 +407,9 @@ if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
find_library(IOB_LIBRARY IOBluetooth)
find_library(IOK_LIBRARY IOKit)
find_library(OPENGL_LIBRARY OpenGL)
# We don't want to use shared libpng.
set(USE_SHARED_LIBPNG OFF)
endif()
if(ENABLE_LTO)
@ -420,9 +425,11 @@ if(ENABLE_LTO)
endif()
endif()
if(UNIX AND LINUX_LOCAL_DEV)
if(UNIX)
if(LINUX_LOCAL_DEV OR (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND STEAM))
add_definitions(-DLINUX_LOCAL_DEV)
endif()
endif()
# BSDs put packages in /usr/local instead of /usr, so we need to
# force CMake to look in those directories by default, too.
@ -776,7 +783,7 @@ else()
set(LZO lzo2)
endif()
if(NOT APPLE)
if(USE_SHARED_LIBPNG)
check_lib(PNG libpng png png.h QUIET)
endif()
if (PNG_FOUND)
@ -930,6 +937,10 @@ else()
message(STATUS "libsystemd not found, disabling traversal server watchdog support")
endif()
if(STEAM)
add_definitions(-DSTEAM)
endif()
if (WIN32)
include_directories(Externals/WIL/include)
include_directories(Externals/OpenAL/include)

View file

@ -13,7 +13,11 @@
typedef GLXContext (*PFNGLXCREATECONTEXTATTRIBSPROC)(Display*, GLXFBConfig, GLXContext, Bool,
const int*);
#ifndef GLX_EXT_swap_control
typedef void (*PFNGLXSWAPINTERVALEXTPROC)(Display*, GLXDrawable, int);
#endif
typedef int (*PFNGLXSWAPINTERVALMESAPROC)(unsigned int);
static PFNGLXCREATECONTEXTATTRIBSPROC glXCreateContextAttribs = nullptr;

View file

@ -552,16 +552,20 @@ ResultCode HostFileSystem::Rename(Uid uid, Gid gid, const std::string& old_path,
}
}
// Finally, remove the child from the old parent and move it to the new parent.
FstEntry* new_entry = GetFstEntryForPath(new_path);
new_entry->name = split_new_path.file_name;
// Finally, remove the child from the old parent and move it to the new parent.
const auto it = std::find_if(old_parent->children.begin(), old_parent->children.end(),
GetNamePredicate(split_old_path.file_name));
if (it != old_parent->children.end())
{
*new_entry = *it;
new_entry->data = it->data;
new_entry->children = it->children;
old_parent->children.erase(it);
}
new_entry->name = split_new_path.file_name;
SaveFst();
return ResultCode::Success;

View file

@ -606,6 +606,47 @@ else()
install(TARGETS dolphin-emu RUNTIME DESTINATION ${bindir})
endif()
if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND STEAM)
# Set that we want ORIGIN in FLAGS.
# We also want RPATH, not RUNPATH, so disable the new tags.
target_link_options(dolphin-emu
PRIVATE
LINKER:-z,origin
LINKER:--disable-new-dtags
)
# For Steam Runtime builds, our Qt shared libraries will be in a "lib" folder.
set_target_properties(dolphin-emu PROPERTIES
BUILD_WITH_INSTALL_RPATH true
INSTALL_RPATH "\$ORIGIN/lib"
)
add_custom_command(TARGET dolphin-emu POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/lib"
COMMAND cp -P "${QT_DIR}/../../*.so*" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/lib"
COMMAND ${CMAKE_COMMAND} -E copy_directory "${QT_DIR}/../../../plugins/platforms" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/platforms"
)
# Copy qt.conf
target_sources(dolphin-emu PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/qt.conf")
add_custom_command(TARGET dolphin-emu POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/qt.conf" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/qt.conf"
)
# Mark all data files as resources
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/Data/Sys")
file(GLOB_RECURSE resources RELATIVE "${CMAKE_SOURCE_DIR}/Data" "${CMAKE_SOURCE_DIR}/Data/Sys/*")
foreach(res ${resources})
target_sources(dolphin-emu PRIVATE "${CMAKE_SOURCE_DIR}/Data/${res}")
source_group("Resources" FILES "${CMAKE_SOURCE_DIR}/Data/${res}")
endforeach()
# Copy Sys folder
add_custom_command(TARGET dolphin-emu POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_SOURCE_DIR}/Data/Sys" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Sys"
)
endif()
if(USE_MGBA)
target_sources(dolphin-emu PRIVATE
GBAHost.cpp