Windows-MSYS2 environment is simple enough to use, Fortran Standard Library can now be easily accessed from MSYS2:
stdlib can be obtained from MSYS2 using the following command:
> pacman -Sy
> pacman -S mingw-w64-x86_64-fortran-stdlib
Use stdlib in Meson
demo.f90
:
program example_gcd
use stdlib_math, only: gcd
implicit none
integer :: a, b, c
a = 48
b = 18
c = gcd(a, b) ! returns 6
print *, c
end program example_gcd
meson.build
:
project(
'demo',
'fortran',
)
executable(
'demo',
'demo.f90',
dependencies: dependency('fortran_stdlib'),
)
Building the code:
> meson setup _build
> meson compile -C _build
> ./_build/demo.exe
6