Skip to content

Conversation

@perazz
Copy link
Member

@perazz perazz commented Aug 30, 2025

Summary

This PR extends fpm to support installing compiled module files (.mod) to a custom directory separate from headers, providing better organization. Close #1157.

Changes

Manifest

  • New optional module-dir field to [install] section
  • Default: fallback to "include" directory (backward compatible)

Installer

  • Extended installer_t with moduledir field and install_module() method (now separate from headers)

Example & Testing:

  • Added example_packages/custom_module_dir/ demonstrating the feature
  • Integrated internal and CI tests

Usage Example

[install]
library = true
module-dir = "custom/modules"  # Optional: defaults to "include"

@perazz perazz requested a review from Copilot September 2, 2025 17:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for installing compiled Fortran module files (.mod) to a custom directory separate from headers, enhancing project organization and providing more flexible installation options.

  • Added a new optional module-dir field to the [install] section of fpm.toml
  • Extended the installer with a separate install_module() method and moduledir field
  • Maintained backward compatibility by defaulting to the "include" directory when not specified

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/fpm/manifest/install.f90 Added module_dir field to install configuration with parsing and validation
src/fpm/installer.f90 Extended installer with moduledir field and separate install_module() method
src/fpm/cmd/install.f90 Updated to use new module installation method instead of header installation
test/fpm_test/test_manifest.f90 Added unit test for module directory configuration parsing
test/fpm_test/test_installer.f90 Added unit test for custom module directory installation
example_packages/custom_module_dir/* Created example package demonstrating the new feature
ci/run_tests.sh Added CI test to verify custom module directory functionality

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@perazz perazz merged commit 265cbee into fortran-lang:main Sep 3, 2025
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for separate module directory and building static and dynamic libs at the same tim

1 participant