From 0c302da0dbf7584e90aa4ee33cb01b4613424489 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Fri, 13 Jan 2023 20:11:27 +0100 Subject: [PATCH] build: Add option to use the GTK file picker instead of portals on Linux Fixes #882 --- CMakeLists.txt | 1 + cmake/build_helpers.cmake | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 39e1f485a..6aa1b99d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,7 @@ option(IMHEX_OFFLINE_BUILD "Enable offline build" OFF) option(IMHEX_IGNORE_BAD_CLONE "Disable the bad clone prevention checks" OFF) option(IMHEX_PATTERNS_PULL_MASTER "Download latest files from master branch of the ImHex-Patterns repo" OFF) option(IMHEX_IGNORE_BAD_COMPILER "Allow compiling with an unsupported compiler" OFF) +option(IMHEX_USE_GTK_FILE_PICKER "Use GTK file picker instead of xdg-desktop-portals" OFF) # Basic compiler and cmake configurations set(CMAKE_CXX_STANDARD 23) diff --git a/cmake/build_helpers.cmake b/cmake/build_helpers.cmake index 358e8f49d..1314d6bfd 100644 --- a/cmake/build_helpers.cmake +++ b/cmake/build_helpers.cmake @@ -433,8 +433,13 @@ macro(addBundledLibraries) set(FMT_LIBRARIES fmt::fmt) endif() + if (IMHEX_USE_GTK_FILE_PICKER) + set(NFD_PORTAL OFF CACHE BOOL "Use Portals for Linux file dialogs" FORCE) + else () + set(NFD_PORTAL ON CACHE BOOL "Use GTK for Linux file dialogs" FORCE) + endif () + if (NOT USE_SYSTEM_NFD) - set(NFD_PORTAL ON CACHE BOOL "Use Portals for Linux file dialogs" FORCE) add_subdirectory(${EXTERN_LIBS_FOLDER}/nativefiledialog EXCLUDE_FROM_ALL) set_target_properties(nfd PROPERTIES POSITION_INDEPENDENT_CODE ON) set(NFD_LIBRARIES nfd)