build: Add option to use the GTK file picker instead of portals on Linux

Fixes #882
This commit is contained in:
WerWolv
2023-01-13 20:11:27 +01:00
parent 45492365be
commit 0c302da0db
2 changed files with 7 additions and 1 deletions

View File

@@ -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)

View File

@@ -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)