diff --git a/CMakeLists.txt b/CMakeLists.txt index a75b52109e..6ed9a414e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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,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 @@ -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) diff --git a/Source/Core/Common/GL/GLInterface/GLX.cpp b/Source/Core/Common/GL/GLInterface/GLX.cpp index 930994a992..b04296d096 100644 --- a/Source/Core/Common/GL/GLInterface/GLX.cpp +++ b/Source/Core/Common/GL/GLInterface/GLX.cpp @@ -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; diff --git a/Source/Core/Core/IOS/FS/HostBackend/FS.cpp b/Source/Core/Core/IOS/FS/HostBackend/FS.cpp index ef1e983b2a..27daeeafb1 100644 --- a/Source/Core/Core/IOS/FS/HostBackend/FS.cpp +++ b/Source/Core/Core/IOS/FS/HostBackend/FS.cpp @@ -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; diff --git a/Source/Core/DolphinQt/CMakeLists.txt b/Source/Core/DolphinQt/CMakeLists.txt index 4867d30e9d..6b24b3e68a 100644 --- a/Source/Core/DolphinQt/CMakeLists.txt +++ b/Source/Core/DolphinQt/CMakeLists.txt @@ -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