Skip to content

Alternatives to CMake

vmagnin edited this page Apr 23, 2022 · 5 revisions

The Fortran Package Manager fpm

gtk-fortran (>=4.2) can be used as a fpm dependency. See the tutorial How to use fpm to build a gtk-fortran project. This is the easiest way to discover gtk-fortran.

The alt_build_test.sh script

You can alternatively use the src/alt_build_test.sh bash script to compile and run the gtk-fortran files and examples, using GFortran by default. It uses the directory build/byscript/

To use another compiler, use the following syntax: $ FC='mycompiler' ./alt_build_test.sh

Limitations

  • This script was tested in Ubuntu, but you may have to adapt it to your distribution.
  • It does not substitute the @..@ strings in gtkf-sketcher.f90, and gtk-fortran.f90, unlike CMake.
  • It does not build the PLplot examples.

Direct compilation

If you know which gtk-fortran files are needed, you can also simply compile and run each example as follow, from the src/ directory:

$ gfortran glib-auto.f90 cairo-auto.f90 gdk-auto.f90 gdk-pixbuf-auto.f90 gtk.f90 ../examples/julia_pixbuf.f90 $(pkg-config --cflags --libs gtk4)
$ ./a.out

For GTK 3, it's --libs gtk+-3.0

Clone this wiki locally