vak: (Житель планеты Узм)
[personal profile] vak
Фортран доразвился до современного менеджера пакетов: называется fpm. Напоминает утилиту cargo из Rust. Устанавливаем на маке:
$ brew tap fortran-lang/fortran
$ brew install fpm
Создаём простой пример:
$ fpm new first_steps
Появится проект из нескольких файлов:
$ tree first_steps 
first_steps
├── README.md
├── app
│ └── main.f90
├── fpm.toml
├── src
│ └── first_steps.f90
└── test
└── check.f90

4 directories, 5 files
Компилируем и запускаем:
$ cd first_steps
$ fpm run
+ mkdir -p build/dependencies
first_steps.f90 done.
libfirst_steps.a done.
main.f90 done.
first_steps done.
[100%] Project compiled successfully.
Hello, first_steps!

$ fpm test
check.f90 done.
check done.
[100%] Project compiled successfully.
Put some tests in here!
Смотрим содержимое файлов. Современный фортран, поддержка модулей, все дела.
$ cat app/main.f90
program main
use first_steps, only: say_hello
implicit none

call say_hello()
end program main

$ cat src/first_steps.f90
module first_steps
implicit none
private

public :: say_hello
contains
subroutine say_hello
print *, "Hello, first_steps!"
end subroutine say_hello
end module first_steps

$ cat test/check.f90
program check
implicit none

print *, "Put some tests in here!"
end program check
This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org