Merge pull request #1344 from guibou/gtk3

Use gtk3 for nativefiledialog
This commit is contained in:
Connor McLaughlin 2020-12-30 00:56:11 +10:00 committed by GitHub
commit f8dcfabc44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 6 deletions

View File

@ -146,7 +146,7 @@ jobs:
shell: bash shell: bash
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get -y install cmake ninja-build ccache libsdl2-dev libgtk2.0-dev qtbase5-dev qtbase5-dev-tools qtbase5-private-dev qt5-default qttools5-dev sudo apt-get -y install cmake ninja-build ccache libsdl2-dev libgtk-3-dev qtbase5-dev qtbase5-dev-tools qtbase5-private-dev qt5-default qttools5-dev
- name: Compile build - name: Compile build
shell: bash shell: bash

View File

@ -172,7 +172,8 @@ Requirements:
Requirements (Debian/Ubuntu package names): Requirements (Debian/Ubuntu package names):
- CMake (`cmake`) - CMake (`cmake`)
- SDL2 (`libsdl2-dev`) - SDL2 (`libsdl2-dev`)
- GTK2.0 for file selector (`libgtk2.0-dev`) - GTK3.0 for file selector (`libgtk-3-dev`)
- pkgconfig (`pkg-config`)
- Qt 5 (`qtbase5-dev`, `qtbase5-private-dev`, `qtbase5-dev-tools`, `qttools5-dev`) - Qt 5 (`qtbase5-dev`, `qtbase5-private-dev`, `qtbase5-dev-tools`, `qttools5-dev`)
- git (`git`) (Note: needed to clone the repository and at build time) - git (`git`) (Note: needed to clone the repository and at build time)
- Optional for faster building: Ninja (`ninja-build`) - Optional for faster building: Ninja (`ninja-build`)

View File

@ -14,12 +14,13 @@ if(WIN32)
elseif(APPLE) elseif(APPLE)
target_sources(nativefiledialog PRIVATE src/nfd_cocoa.m) target_sources(nativefiledialog PRIVATE src/nfd_cocoa.m)
else() else()
find_package(GTK2 2.6 COMPONENTS gtk) FIND_PACKAGE(PkgConfig REQUIRED)
if(GTK2_FOUND) PKG_CHECK_MODULES(GTK3 REQUIRED gtk+-3.0)
if(GTK3_FOUND)
message("Using GTK for nativefiledialog") message("Using GTK for nativefiledialog")
target_sources(nativefiledialog PRIVATE src/nfd_gtk.c) target_sources(nativefiledialog PRIVATE src/nfd_gtk.c)
target_include_directories(nativefiledialog PRIVATE ${GTK2_INCLUDE_DIRS}) target_include_directories(nativefiledialog PRIVATE ${GTK3_INCLUDE_DIRS})
target_link_libraries(nativefiledialog PRIVATE ${GTK2_LIBRARIES}) target_link_libraries(nativefiledialog PRIVATE ${GTK3_LIBRARIES})
else() else()
message(WARNING "Unknown platform for nativefiledialog") message(WARNING "Unknown platform for nativefiledialog")
endif() endif()