Skip to content

Commit

Permalink
Merge pull request #10462 from OatmealDome/steam-runtime
Browse files Browse the repository at this point in the history
DolphinQt: Add support for a Steam Runtime build
  • Loading branch information
JMC47 committed Jun 7, 2022
2 parents 86fc13f + 2648837 commit daf8e3d
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 6 deletions.
17 changes: 14 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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:
Expand Down Expand Up @@ -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)
Expand All @@ -420,8 +425,10 @@ if(ENABLE_LTO)
endif()
endif()

if(UNIX AND LINUX_LOCAL_DEV)
add_definitions(-DLINUX_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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions Source/Core/Common/GL/GLInterface/GLX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 7 additions & 3 deletions Source/Core/Core/IOS/FS/HostBackend/FS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
41 changes: 41 additions & 0 deletions Source/Core/DolphinQt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit daf8e3d

Please sign in to comment.