diff options
author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2024-11-11 09:57:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-11 09:57:49 +0200 |
commit | 814d6d43f0720bda2e74a0ecedb560ad8fcf10a9 (patch) | |
tree | 3db2802f0ab39f2d7b1264e2ac1d3599f1a3bd5a /indra/cmake/NFDE.cmake | |
parent | eccc9057d9d9799d3d5056bdfe255bd9e5e2be6a (diff) | |
parent | 32df877cd73b5b6a3672d0159c982077a4b67a9d (diff) |
Merge pull request #3067 from secondlife/marchcat/c-develop
develop → Maint C sync
Diffstat (limited to 'indra/cmake/NFDE.cmake')
-rw-r--r-- | indra/cmake/NFDE.cmake | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/indra/cmake/NFDE.cmake b/indra/cmake/NFDE.cmake new file mode 100644 index 0000000000..196ba575b2 --- /dev/null +++ b/indra/cmake/NFDE.cmake @@ -0,0 +1,42 @@ +# -*- cmake -*- +if(LINUX) + set(USE_NFDE ON CACHE BOOL "Use Native File Dialog wrapper library") + set(USE_NFDE_PORTAL ON CACHE BOOL "Use NFDE XDG Portals") +endif() + +include_guard() + +add_library(ll::nfde INTERFACE IMPORTED) +if(USE_NFDE) + include(Prebuilt) + use_prebuilt_binary(nfde) + + target_compile_definitions( ll::nfde INTERFACE LL_NFD=1) + + if (WINDOWS) + target_link_libraries( ll::nfde INTERFACE ${ARCH_PREBUILT_DIRS_RELEASE}/nfd.lib) + elseif (DARWIN) + target_link_libraries( ll::nfde INTERFACE ${ARCH_PREBUILT_DIRS_RELEASE}/libnfd.a) + elseif (LINUX) + if(USE_NFDE_PORTAL) + target_link_libraries( ll::nfde INTERFACE ${ARCH_PREBUILT_DIRS_RELEASE}/libnfd_portal.a) + else() + target_link_libraries( ll::nfde INTERFACE ${ARCH_PREBUILT_DIRS_RELEASE}/libnfd_gtk.a) + endif() + endif () + + if (LINUX) + find_package(PkgConfig REQUIRED) + if(NOT USE_NFDE_PORTAL) + pkg_check_modules(GTK3 REQUIRED gtk+-3.0) + target_link_libraries(ll::nfde INTERFACE ${GTK3_LINK_LIBRARIES}) + else() + pkg_check_modules(DBUS REQUIRED dbus-1) + target_link_libraries(ll::nfde INTERFACE ${DBUS_LINK_LIBRARIES}) + endif() + endif() + + target_include_directories( ll::nfde SYSTEM INTERFACE + ${LIBS_PREBUILT_DIR}/include/nfde + ) +endif() |