Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gimp: Add experimental support for GIMP 3 #104

Merged
merged 3 commits into from
Mar 24, 2021
Merged

Conversation

jtojnar
Copy link
Contributor

@jtojnar jtojnar commented Mar 16, 2021

Fixes: #90

@jtojnar jtojnar marked this pull request as ready for review March 16, 2021 06:14
@jtojnar
Copy link
Contributor Author

jtojnar commented Mar 16, 2021

Confirmed it builds and works with both GIMP 2.10.22 and 2.99.5 (0ef5d672). (Tried applying Aurora filter on an image with a single layer.) More testing appreciated.

@jtojnar
Copy link
Contributor Author

jtojnar commented Mar 24, 2021

@c-koi Any chance of getting this in in?

@dtschump
Copy link
Collaborator

Yes, we are definitely interested by this.
But this requires to be in a reasonable working condition.
Have you been able to test a little more thoroughly to see if it works properly?

@jtojnar
Copy link
Contributor Author

jtojnar commented Mar 24, 2021

I now tested several more random filters and all input settings and all output settings and everything seems to work fine. But it would still be nice to get someone familiar with GMic test it or tell me if there is something specific I should check.

@dtschump
Copy link
Collaborator

I'd be happy to test. Do you know if there is any "easy" way to install GIMP 3 (on Ubuntu 20.04), or do I have to compile it by myself from scratch ?

@jtojnar
Copy link
Contributor Author

jtojnar commented Mar 24, 2021

It can be installed through flatpak: https://www.gimp.org/downloads/devel/

Not sure if it can be used for building plug-ins though.

Alternately, you can use Nix package manager. For example, running nix-build 'https://github.com/jtojnar/nixpkgs/archive/gimp-meson.tar.gz' -A gimp-with-plugins will get you GIMP 3 with gmic-qt built from this branch.

@dtschump
Copy link
Collaborator

Trying the nix approach. Compilation looks ok, but then : how to run the dev-version of GIMP ?
I've tried a lot of different things but got only the 2.10.22 version of GIMP.
I'm a total noob with nix btw :)

@dtschump
Copy link
Collaborator

Nevermind, found it!

@dtschump
Copy link
Collaborator

OK, some after a few tests, I can say it looks really cool and stable.
I did tests with filters that take one or several input layers, as well as filters that generate several output layers. So far, everything's fine.
@c-koi : I'm definitely in favor of accepting this PR.
gmic_gimp299

@c-koi
Copy link
Owner

c-koi commented Mar 24, 2021

Thanks!

@c-koi c-koi merged commit 48e18cd into c-koi:master Mar 24, 2021
@jtojnar jtojnar deleted the gimp-3 branch March 24, 2021 18:56
@jtojnar
Copy link
Contributor Author

jtojnar commented Mar 24, 2021

I wanted to avoid the cleaner solution using IMPORTED_TARGET since it is only available in CMake 3.6+ and we are currently targeting 3.1. But it turns out target_link_directories used in the verbose solution requires even newer CMake 3.13.

Unfortunately, Ubuntu Xenial (16.04 LTS) on CI only has CMake 3.5 so we can either revert 585ef87, or switch CI to Ubuntu Bionic (18.04 LTS), which has CMake 3.10 and use the simplified linking:

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,7 +2,7 @@ project(gmic-qt)
 
 message(STATUS "Using CMake version: ${CMAKE_VERSION}")
 
-cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.6.0 FATAL_ERROR)
 LIST (APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
 include(FeatureSummary)
 include(FindPkgConfig)
@@ -525,19 +525,17 @@ if (${GMIC_QT_HOST} STREQUAL "gimp" OR ${GMIC_QT_HOST} STREQUAL "gimp3")
     endif()
 
     find_package(PkgConfig REQUIRED)
-    pkg_check_modules(GIMP REQUIRED gimp-${TARGET_GIMP_VERSION}.0)
+    pkg_check_modules(GIMP REQUIRED gimp-${TARGET_GIMP_VERSION}.0 IMPORTED_TARGET)
     # CMake does not support passing --define-variable through pkg_get_variable.
     execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} gimp-${TARGET_GIMP_VERSION}.0 --define-variable=prefix=${CMAKE_INSTALL_PREFIX} --variable gimplibdir OUTPUT_VARIABLE GIMP_PKGLIBDIR OUTPUT_STRIP_TRAILING_WHITESPACE)
 
     set (gmic_qt_SRCS ${gmic_qt_SRCS} src/Host/Gimp/host_gimp.cpp)
     add_definitions(-DGMIC_HOST=gimp -DGIMP_DISABLE_DEPRECATED)
     add_executable(gmic_gimp_qt ${gmic_qt_SRCS} ${gmic_qt_QRC} ${qmic_qt_QM})
-    target_include_directories(gmic_gimp_qt PRIVATE ${GIMP_INCLUDE_DIRS})
-    target_link_directories(gmic_gimp_qt PRIVATE ${GIMP_LIBRARY_DIRS})
     target_link_libraries(
       gmic_gimp_qt
       PRIVATE
-      ${GIMP_LIBRARIES}
+      PkgConfig::GIMP
       ${gmic_qt_LIBRARIES}
       )
     install(TARGETS gmic_gimp_qt RUNTIME DESTINATION "${GIMP_PKGLIBDIR}/plug-ins/gmic_gimp_qt")

It should not be much of a problem since Xenial has EOL in April.

@dtschump
Copy link
Collaborator

  • On the G'MIC website, we actually distribute .deb packages only for 18.04+. I'm not even sure G'MIC-Qt compiles with the old Qt version available on 16.04.
  • I'll add your name to the lis of contributors on the website. This is really great work, thank you again!

@jtojnar jtojnar mentioned this pull request Mar 24, 2021
@jtojnar
Copy link
Contributor Author

jtojnar commented Mar 24, 2021

Okay, opened #106 to fix the CI.

@chris-morgan
Copy link
Contributor

As someone just trying this out now (via patching the AUR gimp-plugin-gmic-git package to use the directory /usr/lib/gimp/2.99/plug-ins/gmic_gimp_qt/ instead of /usr/lib/gimp/2.0/plug-ins/, and to pass HOST=gimp3 instead of HOST=gimp), I was confused to find this failing to link, with ApplicationName and ApplicationShortname undefined. Turned out the reason for that was I was using the QMake build process, but this PR only covered building with CMake. Dunno if that’s significant or not, or if one is on the way out in favour of the other, but I figured I’d at least mention it here so it’s recorded.

(Subsequent to that I got compiler errors on activeLayerID >= 0 and active_layer_id >= 0 comparisons in host_gimp.cpp, #114 is a patch that at least makes it build, whether it’s correct or not.)

@jtojnar
Copy link
Contributor Author

jtojnar commented Jun 28, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for Gimp 2.99 / 3.0
4 participants