-
Notifications
You must be signed in to change notification settings - Fork 104
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
Problem using build-script to use gtk-fortran as a dependency #351
Comments
Hi Vincent @vmagnin, thanks for reporting. Unfortunately the I have been able to build I'm quite excited to be able to use |
Hi Laurence @LKedward ! Great news that you have built gtk-fortran with fpm! I will give a try to your method. Concerning CMake, it's a powerful tool. Two years ago I made an attempt to migrate to Meson because I feared it will be complicated to adapt CMake to GTK 4, and because GTK itself is now using Meson. But finally it was simple with CMake, and Meson is not yet installing correctly the .mod Fortran files: Finally the only thing I don't like with CMake is its verbose syntax. My neurons can't even remember I also read here some discussions about work on fpm detecting automatically the projects using CMake. |
I report progress and problem using gtk-fortran as a fpm dependency, using fpm 0.5.0 and GFortran 11.2.0 under Ubuntu 21.10:
Let's now talk about the problem concerning the mswindowsonly-auto.f90 file: in GTK there is some functions whose names are specific to Windows or Unix and in gtk-fortran some are in mswindowsonly-auto.f90 and unixonly-auto.f90. Those two files contain the same module In CMake, we have those lines to deal with it: if (CMAKE_HOST_WIN32)
set(sources ${sources} "mswindowsonly-auto.f90")
else()
set(sources ${sources} "unixonly-auto.f90" "unix-print-auto.f90")
endif() Maybe I can think about it on the gtk-fortran side (I am not sure these few functions are still useful with nowadays Windows versions; I will investigate). But on the fpm side, is it possible or will it be possible to deal with that problem ? Or have you any idea to get around ? |
Concerning the But being able to choose the files to compile depending on the OS is probably an expected feature in a package manager. |
There have been discussions in a few places (#611 (comment), #623, #609) about including conditional logic or optional dependencies. Unfortunately, nothing concrete yet. The only solution I can think of currently is to defer the logic to the preprocessor built in to the compiler. E.g. something like: ! gtk_os_dependent.f90
#if WINDOWS
include "mswindows-auto.inc"
#else
include "unixonly-auto.inc"
include "unixprint-auto.inc"
#endif Then you should pass a |
Thanks @ivan-pi, |
I have now fixed the problem in the |
I have a question concerning the For the moment, in the [build]
link = [
"gtk-4",
"gio-2.0",
"gobject-2.0"] It works perfectly with Ubuntu, Fedora and MSYS2/Windows 10. Can I be sure that the name of these libraries will be the same on all systems? (needed if I put them in the fpm.toml of gtk-fortran). |
I have now put the |
It runs fine on Ubuntu 21.10, Fedora 35, FreeBSD 13.0, MSYS2/Windows 10, macOS 10.15.7. |
The two But before, in the |
Hi Vincent @vmagnin, thanks for sharing your progress on this and apologies for the late response! It's really exciting that gtk-fortran is moving towards supporting fpm! I think your experience documented here will be really useful for informing future directions for fpm. I hope to test out your experimental branch soon. |
Hi Laurence @LKedward , The |
@LKedward |
For such heavy duty libraries, a local dependency might be more suitable. I imagine this similar to Intel MKL oneAPI, i.e. you only want to download the compiler toolchain and SDK's once, and then use Unfortunately it's not entirely clear to me, how would this work together with the current package distribution model. |
Sure. But a great force of fpm is that it makes so easy to test and discover Fortran projects: with three lines ( If you use it in only one, two or three directories, it can probably be acceptable to use it as a dependency, whatever the size. |
Indeed, ideally, you'd have a way to do both. I was also thinking about some closed systems (e.g. in an industrial environment or institute) where you can't |
By local dependency, did you mean "fpm local dependency"?
instead of cloning it multiple times. Yes, it runs. If we are already in the good branch of gtk-fortran. |
I have just succeeded running a gtk-fortran PLplot example, by putting in the fpm.toml:
and running with: $ fpm run --flag '$(pkg-config --cflags --libs plplot plplot-fortran)' Any comment? |
Yes, that's what I meant. It's one way to cut down on git traffic. Sorry, I'm not familiar enough to comment about the |
The gtk-fortran
|
This step is automatic, just create a release and wait for the conda-forge bots to do the work (as long as you keep CMake as primary build system). |
Wow, that's magic @awvwgk ! Yes CMake remains the primary build system. fpm is for the moment only for using gtk-fortran as a fpm dependency. Maybe we will need to remove https://github.com/conda-forge/gtk-4-fortran-feedstock/blob/main/recipe/cmake.patch |
@awvwgk , typically, how long can it take? For the moment nothing seemed to happen: And I read:
|
Hi,
For some days, I am playing with fpm 0.1.3 alpha on Linux Kubuntu 20.10. I have especially tested the
[dependencies]
killing feature and it runs smoothly with the helloff.git example in the doc. I am now interested by thebuild-script
variable, which is the true killing feature! I have begun testing it with my gtk-fortran project, which is CMake based. I will now present the details of the steps I have made and the problem:build.sh
script there, that basically just do classical things :cd .. ; mkdir build ; cd build ; cmake .. ; make -j
:Reading those warnings (that does not appear using CMake) and the final error, I suspect that the building is not made by my build.sh script, but directly by fpm. Note also that gtkenums-auto.f90 is not a module but a file that is included in the source code of the gtk-auto.90 module via an INCLUDE statement (that's probably why fpm failed).
Therefore, the https://github.com/vmagnin/gtk-fortran/blob/gtk3/fpm.toml file is probably not correct. Can you please guide me to obtain a correct fpm.toml ? I tried some modifications on the local version on my machine but without success.
The text was updated successfully, but these errors were encountered: