-
Notifications
You must be signed in to change notification settings - Fork 118
feat: custom module install directory #1170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1960157
add `module-dir` to the `install` table
perazz 6455ce4
manifest: add test
perazz 388108d
installer: use `moduledir` for modules
perazz 01872bd
add example package
perazz f01f9cb
add CI test
perazz 42ca4d0
do not use slash in test (windows compliant)
perazz a4b2679
Merge branch 'main' into custom_module_path
perazz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # Custom Module Directory Example | ||
|
|
||
| This example demonstrates the use of a custom module directory in the `[install]` section of `fpm.toml`. | ||
|
|
||
| ## Features | ||
|
|
||
| - Two simple Fortran modules: `greeting` and `math_utils` | ||
| - Custom module installation directory specified as `custom_modules` | ||
| - Shows how modules can be installed to a different location than headers | ||
|
|
||
| ## Configuration | ||
|
|
||
| In `fpm.toml`: | ||
|
|
||
| ```toml | ||
| [install] | ||
| library = true | ||
| module-dir = "custom_modules" | ||
| ``` | ||
|
|
||
| This configuration will install compiled `.mod` files to the `custom_modules` directory instead of the default `include` directory. | ||
|
|
||
| ## Testing | ||
|
|
||
| To test this example: | ||
|
|
||
| ```bash | ||
| cd example_packages/custom_module_dir | ||
| fpm build | ||
| fpm install --prefix /tmp/test_install | ||
| # Check that .mod files are in /tmp/test_install/custom_modules/ | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| name = "custom-module-dir" | ||
| install.library = true | ||
| install.module-dir = "custom_modules" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| module greeting | ||
| implicit none | ||
| private | ||
| public :: say_hello | ||
|
|
||
| contains | ||
|
|
||
| subroutine say_hello(name) | ||
| character(len=*), intent(in) :: name | ||
| print *, 'Hello, ' // name // '!' | ||
| end subroutine say_hello | ||
|
|
||
| end module greeting |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| module math_utils | ||
| implicit none | ||
| private | ||
| public :: add_numbers, multiply_numbers | ||
|
|
||
| contains | ||
|
|
||
| function add_numbers(a, b) result(sum) | ||
| integer, intent(in) :: a, b | ||
| integer :: sum | ||
| sum = a + b | ||
| end function add_numbers | ||
|
|
||
| function multiply_numbers(a, b) result(product) | ||
| integer, intent(in) :: a, b | ||
| integer :: product | ||
| product = a * b | ||
| end function multiply_numbers | ||
|
|
||
| end module math_utils |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.