I’m super busy until at least next tuesday, too much to think about this kind of problems
But I’ll try to look at this with a clear head at the end of next week.
(I’m in the process of applying for a career advancement, and it’s taking a lot of effort to write my application).
I don’t see this as a problem to be honest. The fact is that this does not prevent gmic-qt to be linked with a shared libgmic, as I will do for next G’MIC release 3.0.1 (planned tomorrow).
By the way, I’m not using the CMakeFile way, but the provided Makefile in src/.
Don’t ask me how to do it with cmake, I don’t know
well the include “gmic.cpp” means that code is basically compiled twice. (once for libgmic once into gmic-qt) so if it ends up in the object file then it might almost not be needed to link libgmic.
patched cmake to also install CImg.h into libgmic-devel
try to build the krita’s version gmic-qt against the sytem copy of gmic
fails with
In file included from /home/abuild/rpmbuild/BUILD/krita-5.0.2/3rdparty/gmic-qt/src/FilterSelector/FiltersModelReader.cpp:41:
/usr/include/gmic.h:194:21: fatal error: gmic.cpp: No such file or directory
194 | #define cimg_plugin "gmic.cpp"
so I would need to ship the gmic.cpp file in the devel package. which feels wrong.
I have time today to discuss about that.
A few notes :
The ‘Krita’ target fror G’MIC is not needed anymore, as Krita 5 now ships the G’MIC plug-in by default. The krita target from the G’MIC source is then now deprecated, and only useful for Krita 4. It will be probably removed in a few versions.
The macro cimg_plugin used in gmic.cpp should be only defined when you compile libgmic, but none of its interface.
If you really need cimg_plugin to be defined for something else than building libgmic (but honestly, that’s weird ), then note that the value of cimg_plugin must be a path to the gmic.cpp file, relative to the path of CImg.h. In the original G’MIC sources, CImg.h and gmic.cpp are located in the same folder, that’s why the value of cimg_plugin is just "gmic.cpp". You can also let this value as it is and set the -I/path_to_gmic_cpp_folder/ flag when compiling.
/home/abuild/rpmbuild/BUILD/gmic-3.0.1/gmic-qt/src/CroppedImageListProxy.cpp: In static member function 'static void GmicQt::CroppedImageListProxy::update(double, double, double, double, GmicQt::InputMode, double)':
/home/abuild/rpmbuild/BUILD/gmic-3.0.1/gmic-qt/src/CroppedImageListProxy.cpp:65:52: error: 'struct cimg_library::CImgList<float>' has no member named 'size'
65 | for (unsigned int i = 0; i < _cachedImageList->size(); ++i) {
| ^~~~
/home/abuild/rpmbuild/BUILD/gmic-3.0.1/gmic-qt/src/CroppedImageListProxy.cpp:67:13: error: 'struct cimg_library::CImg<float>' has no member named 'resize'
67 | image.resize(std::round(image.width() * zoom), std::round(image.height() * zoom), 1, -100, 1);
| ^~~~~~
/home/abuild/rpmbuild/BUILD/gmic-3.0.1/gmic-qt/src/CroppedImageListProxy.cpp:67:37: error: 'struct cimg_library::CImg<float>' has no member named 'width'; did you mean '_width'?
67 | image.resize(std::round(image.width() * zoom), std::round(image.height() * zoom), 1, -100, 1);
| ^~~~~
| _width
/home/abuild/rpmbuild/BUILD/gmic-3.0.1/gmic-qt/src/CroppedImageListProxy.cpp:67:71: error: 'struct cimg_library::CImg<float>' has no member named 'height'; did you mean '_height'?
67 | image.resize(std::round(image.width() * zoom), std::round(image.height() * zoom), 1, -100, 1);
| ^~~~~~
| _height
/home/abuild/rpmbuild/BUILD/gmic-3.0.1/gmic-qt/src/CroppedImageListProxy.cpp: In static member function 'static void GmicQt::CroppedImageListProxy::clear()':
/home/abuild/rpmbuild/BUILD/gmic-3.0.1/gmic-qt/src/CroppedImageListProxy.cpp:74:27: error: no matching function for call to 'cimg_library::CImgList<float>::assign()'
74 | _cachedImageList->assign();
| ~~~~~~~~~~~~~~~~~~~~~~~~^~
In file included from /home/abuild/rpmbuild/BUILD/gmic-3.0.1/gmic-qt/src/CroppedImageListProxy.cpp:31:
/home/abuild/rpmbuild/BUILD/gmic-3.0.1/src/gmic.h:151:19: note: candidate: 'cimg_library::CImgList<T>& cimg_library::CImgList<T>::assign(unsigned int) [with T = float]'
151 | gmic_list<T>& assign(const unsigned int n);
| ^~~~~~
/home/abuild/rpmbuild/BUILD/gmic-3.0.1/src/gmic.h:151:19: note: candidate expects 1 argument, 0 provided
/home/abuild/rpmbuild/BUILD/gmic-3.0.1/gmic-qt/src/CroppedImageListProxy.cpp:75:28: error: no matching function for call to 'cimg_library::CImgList<char>::assign()'
75 | _cachedImageNames->assign();
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~
In file included from /home/abuild/rpmbuild/BUILD/gmic-3.0.1/gmic-qt/src/CroppedImageListProxy.cpp:31:
/home/abuild/rpmbuild/BUILD/gmic-3.0.1/src/gmic.h:151:19: note: candidate: 'cimg_library::CImgList<T>& cimg_library::CImgList<T>::assign(unsigned int) [with T = char]'
151 | gmic_list<T>& assign(const unsigned int n);
| ^~~~~~
/home/abuild/rpmbuild/BUILD/gmic-3.0.1/src/gmic.h:151:19: note: candidate expects 1 argument, 0 provided
OK, but be aware that the code of the Krita 5 G’MIC plug-in is not available in the G’MIC source code, but only in the Krita repository. We only have the version for Krita 4.
Maybe yes, if you plan to build G’MIC-Qt from the libgmic.so file, then gmic_build is probably not needed.
Right. gmic.cpp should be not needed to build gmic-qt if you want to use a dependency to the shared libgmic.so
In that case, that means “CImg.h” is not included anymore by G’MIC-Qt when gmic_build is undefined.
You may try to include it before gmic.h to fix the thing.