Skip to content

Conversation

perazz
Copy link
Member

@perazz perazz commented Aug 31, 2025

This PR adds support for specifying a custom build/ folder for build outputs in fpm. Users can now configure the build directory using either the --build-dir command-line option or the FPM_BUILD_DIR environment variable.

So, builds with different CLI/environment features (i.e. compilers, etc.) can have their own folder, avoiding overwrites.

Example:

fpm build --build-dir build_gcc
fpm install --build-dir build_gcc --prefix=/gcc_packages/

Closes #1137.

@perazz perazz requested a review from Copilot September 4, 2025 17:27
Copy link
Contributor

@Copilot 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 implements support for custom build directories in the fpm (Fortran Package Manager) to allow users to specify different output locations for build artifacts. This enables parallel builds with different configurations without overwrites.

  • Adds --build-dir command-line option and FPM_BUILD_DIR environment variable support
  • Updates the fpm model to track and validate custom build directory paths
  • Implements validation to prevent conflicts with reserved source directory names

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/fpm_model.f90 Adds build_dir field to model type with serialization support
src/fpm_command_line.f90 Implements CLI parsing and validation for build directory option
src/fpm_backend_output.f90 Updates build progress tracking to use custom build directory
src/fpm_backend.F90 Passes build directory to progress initialization
src/fpm/dependency.f90 Updates dependency tree to use custom build directory
src/fpm/cmd/update.f90 Modifies update command to respect custom build directory
src/fpm/cmd/export.f90 Updates export command for custom build directory support
src/fpm.f90 Integrates build directory into main build model logic
ci/test_custom_build_dir.sh Comprehensive test suite for custom build directory functionality
ci/run_tests.sh Integrates custom build directory tests into CI pipeline

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

@perazz perazz merged commit 4c52f46 into fortran-lang:main Sep 6, 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.

Allow cli option to specify a directory for the build other than build/
1 participant