From 20335955e3290f00b431672938541c51cbb78c37 Mon Sep 17 00:00:00 2001 From: OatmealDome Date: Thu, 5 Mar 2026 23:05:30 -0500 Subject: [PATCH 1/2] CMakeLists: Add APPIMAGE option to force Dolphin to find resources relative to the executable --- CMakeLists.txt | 9 +++++++++ Source/Core/Common/FileUtil.cpp | 6 ++++-- Source/Core/DolphinQt/Translation.cpp | 3 +++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ffe18889b..481d3659d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -150,6 +150,9 @@ if(UNIX) # Builds a relocatable binary on Linux. # The Sys folder will need to be copied to the Binaries folder. option(LINUX_LOCAL_DEV "Enable relocatable binary" OFF) + # Builds for AppImage on Linux. + # Dolphin will find all resources using relative paths to the binary. + option(APPIMAGE "Builds for AppImage" OFF) endif() list(APPEND CMAKE_MODULE_PATH @@ -388,8 +391,14 @@ if(ENABLE_LTO) endif() if(UNIX) + if(LINUX_LOCAL_DEV AND APPIMAGE) + message(FATAL_ERROR "Can only specify one of LINUX_LOCAL_DEV and APPIMAGE") + endif() + if(LINUX_LOCAL_DEV) add_definitions(-DLINUX_LOCAL_DEV) + elseif(APPIMAGE) + add_definitions(-DAPPIMAGE) endif() endif() diff --git a/Source/Core/Common/FileUtil.cpp b/Source/Core/Common/FileUtil.cpp index 1dbbb4ac41..b337ad6466 100644 --- a/Source/Core/Common/FileUtil.cpp +++ b/Source/Core/Common/FileUtil.cpp @@ -759,7 +759,9 @@ std::string GetExeDirectory() static std::string CreateSysDirectoryPath() { -#if defined(_WIN32) || defined(LINUX_LOCAL_DEV) +#ifdef APPIMAGE +#define SYSDATA_DIR "../share/dolphin-emu/sys" +#elif defined(_WIN32) || defined(LINUX_LOCAL_DEV) #define SYSDATA_DIR "Sys" #elif defined __APPLE__ #define SYSDATA_DIR "Contents/Resources/Sys" @@ -773,7 +775,7 @@ static std::string CreateSysDirectoryPath() #if defined(__APPLE__) const std::string sys_directory = GetBundleDirectory() + DIR_SEP SYSDATA_DIR DIR_SEP; -#elif defined(_WIN32) || defined(LINUX_LOCAL_DEV) +#elif defined(_WIN32) || defined(LINUX_LOCAL_DEV) || defined(APPIMAGE) const std::string sys_directory = GetExeDirectory() + DIR_SEP SYSDATA_DIR DIR_SEP; #elif defined ANDROID const std::string sys_directory = s_android_sys_directory + DIR_SEP; diff --git a/Source/Core/DolphinQt/Translation.cpp b/Source/Core/DolphinQt/Translation.cpp index 1b93536ac9..b13b73302e 100644 --- a/Source/Core/DolphinQt/Translation.cpp +++ b/Source/Core/DolphinQt/Translation.cpp @@ -280,6 +280,9 @@ static bool TryInstallTranslator(const QString& exact_language_code) #elif defined __APPLE__ fmt::format("{}/Contents/Resources/{}.lproj/dolphin-emu.mo", File::GetBundleDirectory(), lang) +#elif defined APPIMAGE + fmt::format("{}/../share/locale/{}/LC_MESSAGES/dolphin-emu.mo", File::GetExeDirectory(), + lang) #elif defined LINUX_LOCAL_DEV fmt::format("{}/../Source/Core/DolphinQt/{}/dolphin-emu.mo", File::GetExeDirectory(), lang) #else From 1028d1bf20c16aebd70f74dad1558b92dab28686 Mon Sep 17 00:00:00 2001 From: OatmealDome Date: Thu, 5 Mar 2026 23:06:27 -0500 Subject: [PATCH 2/2] CMakeLists: Use relative paths when marking some resources for installation on Linux --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 481d3659d3..4b0a36880f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -862,11 +862,11 @@ endif() if(CMAKE_SYSTEM_NAME MATCHES "Linux|FreeBSD|OpenBSD") # Install the application icon and menu item install(FILES Data/dolphin-emu.svg - DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps) + DESTINATION share/icons/hicolor/scalable/apps) install(FILES Data/dolphin-emu.png - DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/256x256/apps) + DESTINATION share/icons/hicolor/256x256/apps) install(FILES Data/dolphin-emu.desktop - DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications) + DESTINATION share/applications) # Install manpages install(FILES Data/dolphin-emu.6 DESTINATION ${CMAKE_INSTALL_MANDIR}/man6)