Add the cmake option for flatpak.

This commit is contained in:
Dario 2025-05-03 19:37:07 -03:00
parent 3d7be14a17
commit fe8412b9d2
2 changed files with 8 additions and 2 deletions

View file

@ -25,6 +25,10 @@ if (APPLE)
enable_language(OBJC OBJCXX)
endif()
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
option(RECOMP_FLATPAK "Configure the build for Flatpak compatibility." OFF)
endif()
# Avoid warning about DOWNLOAD_EXTRACT_TIMESTAMP in CMake 3.24:
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
cmake_policy(SET CMP0135 NEW)
@ -41,6 +45,10 @@ set(RT64_STATIC TRUE)
set(RT64_SDL_WINDOW_VULKAN TRUE)
add_compile_definitions(HLSL_CPU)
if (RECOMP_FLATPAK)
add_compile_definitions(RECOMP_FLATPAK)
endif()
add_subdirectory(${CMAKE_SOURCE_DIR}/lib/rt64 ${CMAKE_BINARY_DIR}/rt64)
# set(BUILD_SHARED_LIBS_SAVED "${BUILD_SHARED_LIBS}")

View file

@ -602,14 +602,12 @@ int main(int argc, char** argv) {
SDL_setenv("SDL_AUDIODRIVER", "wasapi", true);
#endif
#if 0
#if defined(__linux__) && defined(RECOMP_FLATPAK)
// When using Flatpak, applications tend to launch from the home directory by default.
// Mods might use the current working directory to store the data, so we switch it to a directory
// with persistent data storage and write permissions under Flatpak to ensure it works.
std::error_code ec;
std::filesystem::current_path("/var/data", ec);
#endif
#endif
// Initialize SDL audio and set the output frequency.