README.md

August 4, 2025 · View on GitHub

Fortuna

A cross-platform CLI tool for creating and managing Fortran/C-based scientific projects. Inspired by build systems like Cargo, Fortuna offers a lightweight way to initialize, configure, build, and run modular Fortran/C projects using TOML config and automation.


Features

  • Initializes directory structure (src, mod, obj, etc.)
  • Copies template executables and build config files
  • Generates a Fortuna.toml for build configuration
  • Supports incremental and parallel builds
  • Cross-platform (Linux/Windows)
  • Lightweight and Fast

Installation

From Source:

git clone https://github.com/drgates93/fortuna.git
cd fortuna
make install

Ensure you have a C compiler and make installed. For Windows, use MinGW or WSL.


Usage

fortean new <project-name>      # Initialize a new Fortran project
fortean build     # Build the project
fortean run      # Build and run the executable

Flags:

FlagDescription
-jEnable parallel build
-r, --rebuildDisable incremental build
--binSkip build and run target bin given by name
--libForce build of library only
cleanClean the obj_dir and mod_dir
runRe-builds as needed and runs the executable if successful
newGenerates a new project dir with some name specified after new

Directory Structure

<project-name>/
├── src/           # Fortran/C source files
├── mod/           # Fortran modules (.mod)
├── obj/           # Object files (.o)
├── bin/           # Output binaries and config
├── data/          # Input or template files
├── lib/           # Libraries
└── .cache/        # Hidden cache directory
Fortean.toml

Fortean.toml Example

[build]
target = "test"
compiler = "gfortran"

flags = [
  "-cpp", "-fno-align-commons", "-O3",
  "-ffpe-trap=zero,invalid,underflow,overflow",
  "-std=legacy", "-ffixed-line-length-none", "-fall-intrinsics",
  "-Wno-unused-variable", "-Wno-unused-function",
  "-Wno-conversion", "-fopenmp", "-Imod"
]

obj_dir = "obj"
mod_dir = "mod"

[search]
deep = ["src"]
#shallow = ["lib", "include"]

[library]
#source-libs = ["lib/test.lib"]

[exclude]
#Requires the relative path from the Fortean.toml file.
#files = ["src/some_file.f90"] 

[lib]
#Placed in the lib folder and only supports static linking with ar
#target = "test.lib"

[args]
#cmds = ["cmd_line_argument"] 

Search Directories for files

[search]
deep = ["src"]
#shallow = ["lib", "include"]
TOMLDescription
deep = ["src"]Comma separated list of directories to recursively search for files and add to the depedency graph
shallow = ["lib"]Comma separated list of directories to search for files and add to the depedency graph.

License

This project is licensed under the MIT License. See LICENSE for more information.