Module-level caching for FPM builds
This module implements a shared cache for compiled Fortran modules (.mod and .o files) that can be reused across different projects. It follows FPM conventions and integrates with the FPM source model.
The cache structure is:
~/.cache/fortran/modules/
Type for managing module-level caching
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
character(len=:), | public, | allocatable | :: | cache_dir |
Base cache directory |
||
character(len=:), | public, | allocatable | :: | compiler_id |
Compiler identifier for cache segregation |
||
character(len=:), | public, | allocatable | :: | compiler_version |
Compiler version for cache segregation |
||
logical, | public | :: | enabled | = | .true. |
Whether caching is enabled |
procedure, public :: init => cache_init | |
procedure, public :: get_cache_key => cache_get_key | |
procedure, public :: store_module => cache_store_module | |
procedure, public :: retrieve_module => cache_retrieve_module | |
procedure, public :: is_cached => cache_is_cached | |
procedure, public :: get_module_dir => cache_get_module_dir | |
procedure, public :: clean_stale => cache_clean_stale | |
procedure, public :: deep_copy => cache_deep_copy | |
procedure, public :: assign => cache_assign | |
generic, public :: assignment(=) => assign |
Create a new module cache instance
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(compiler_t), | intent(in) | :: | compiler | |||
character(len=*), | intent(in), | optional | :: | compiler_version |
Get the default module cache directory