|
| 1 | +class FortranStdlib < Formula |
| 2 | + desc "Fortran Standard Library" |
| 3 | + homepage "https://stdlib.fortran-lang.org" |
| 4 | + url "https://github.com/fortran-lang/stdlib/archive/refs/tags/v0.7.0.tar.gz" |
| 5 | + sha256 "07615b1fd0d9c78f04ec5a26234d091cb7e359933ba2caee311dcd6f58d87af0" |
| 6 | + license "MIT" |
| 7 | + |
| 8 | + depends_on "cmake" => [:build, :test] |
| 9 | + depends_on "fypp" => :build |
| 10 | + depends_on "gcc" # for gfortran |
| 11 | + |
| 12 | + def install |
| 13 | + system "cmake", "-S", ".", "-B", "build", *std_cmake_args |
| 14 | + system "cmake", "--build", "build" |
| 15 | + system "cmake", "--install", "build" |
| 16 | + pkgshare.install "example" |
| 17 | + end |
| 18 | + |
| 19 | + test do |
| 20 | + cp pkgshare/"example/version/example_version.f90", testpath |
| 21 | + |
| 22 | + (testpath/"CMakeLists.txt").write <<~CMAKE |
| 23 | + cmake_minimum_required(VERSION 3.14) |
| 24 | + project(test LANGUAGES Fortran) |
| 25 | +
|
| 26 | + find_package(fortran_stdlib REQUIRED) |
| 27 | +
|
| 28 | + add_executable(test example_version.f90) |
| 29 | + target_link_libraries(test PRIVATE fortran_stdlib::fortran_stdlib) |
| 30 | + CMAKE |
| 31 | + |
| 32 | + system "cmake", "-S", "." |
| 33 | + system "cmake", "--build", "." |
| 34 | + system "./test" |
| 35 | + end |
| 36 | +end |
0 commit comments