Skip to content

Commit a285130

Browse files
authored
Merge branch 'master' into include-dir
2 parents 6686207 + 9842deb commit a285130

File tree

14 files changed

+891
-506
lines changed

14 files changed

+891
-506
lines changed

README.md

Lines changed: 49 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,63 @@
11
# Fortran Package Manager
22

3-
This is the repository of the Fortran Package Manager (*fpm*). If you are
4-
looking for *fpm – packaging made simple* instead, see
5-
[jordansissel/fpm](https://github.com/jordansissel/fpm).
6-
7-
Fortran Package Manager is an early prototype. You can use it to build and
8-
package your Fortran projects, as well as to include supported Fortran
9-
dependency projects. As a prototype, changes to *fpm*’s behavior and inputs may
10-
occur as development continues. Please follow the
11-
[issues](https://github.com/fortran-lang/fpm/issues) to contribute and/or stay
12-
up to date with the development. As the prototype matures and we enter
13-
production, we will do our best to stay backwards compatible.
14-
15-
To report a bug report or suggest a feature, please read our
16-
[contributor guidelines](CONTRIBUTING.md).
3+
Fortran Package Manager (fpm) is a package manager and build system for Fortran.
4+
Its key goal is to improve the user experience of Fortran programmers.
5+
It does so by making it easier to build your Fortran program or library, run the
6+
executables, tests, and examples, and distribute it as a dependency to other
7+
Fortran projects.
8+
Fpm's user interface is modeled after [Rust's Cargo](https://crates.io/),
9+
so if you're familiar with that tool, you will feel at home with fpm.
10+
Fpm's long term vision is to nurture and grow the ecosystem of modern Fortran
11+
applications and libraries.
12+
13+
Fpm is an early prototype and is evolving rapidly.
14+
You can use it to build and package your Fortran projects, as well as to use
15+
existing fpm packages as dependencies.
16+
Fpm's behavior and user interface may change as it evolves, however as fpm
17+
matures and we enter production, we will aim to stay backwards compatible.
18+
Please follow the [issues](https://github.com/fortran-lang/fpm/issues) to
19+
contribute and/or stay up to date with the development.
20+
Before opening a bug report or a feature suggestion, please read our
21+
[Contributor Guide](CONTRIBUTING.md).
22+
23+
Fortran Package Manager is not to be confused with
24+
[Jordan Sissel's fpm](https://github.com/jordansissel/fpm), a more general,
25+
non-Fortran related package manager.
1726

1827
## Getting started
1928

20-
### Binary download
29+
### Setting up fpm
30+
31+
#### Binary download
2132
`x86-64` binaries are available [to download](https://github.com/fortran-lang/fpm/releases) for Windows, MacOS and Linux.
2233

2334
__Note:__ On Linux and MacOS, you will need to enable executable permission before you can use the binary.
2435

2536
_e.g._ `$ chmod u+x fpm-v0.1.0-linux-x86_64`
2637

27-
__Github actions:__ to setup *fpm* within Github actions for automated testing, you can use the [fortran-lang/setup-fpm](https://github.com/marketplace/actions/setup-fpm) action.
38+
#### Conda
39+
40+
Fpm is available on conda-forge, to add conda-forge to your channels use:
41+
42+
```
43+
conda config --add channels conda-forge
44+
```
45+
46+
Fpm can be installed with:
47+
48+
```
49+
conda create -n fpm fpm
50+
conda activate fpm
51+
```
52+
53+
The conda package manager can be installed from [miniforge](https://github.com/conda-forge/miniforge/releases)
54+
or from [miniconda](https://docs.conda.io/en/latest/miniconda.html).
55+
56+
#### Github Actions
57+
58+
To setup *fpm* within Github actions for automated testing, you can use the [fortran-lang/setup-fpm](https://github.com/marketplace/actions/setup-fpm) action.
59+
60+
#### Bootstraping on other platforms
2861

2962
For other platforms and architectures have a look at the [bootstrapping instructions](#bootstrapping-instructions).
3063

@@ -94,4 +127,3 @@ with itself and run the tests with:
94127
$ cd fpm
95128
$ fpm test
96129
```
97-

ci/run_tests.bat

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ del /q /f build
3939
%fpm_path% build
4040
if errorlevel 1 exit 1
4141

42-
.\build\gfortran_debug\app\hello_world
42+
%fpm_path% run --target hello_world
4343
if errorlevel 1 exit 1
4444

4545
%fpm_path% run
@@ -53,7 +53,7 @@ del /q /f build
5353
%fpm_path% build
5454
if errorlevel 1 exit 1
5555

56-
.\build\gfortran_debug\app\hello_fpm
56+
%fpm_path% run --target hello_fpm
5757
if errorlevel 1 exit 1
5858

5959

@@ -83,16 +83,16 @@ if errorlevel 1 exit 1
8383
%fpm_path% test
8484
if errorlevel 1 exit 1
8585

86-
.\build\gfortran_debug\app\say_Hello
86+
%fpm_path% run --target say_Hello
8787
if errorlevel 1 exit 1
8888

89-
.\build\gfortran_debug\app\say_goodbye
89+
%fpm_path% run --target say_goodbye
9090
if errorlevel 1 exit 1
9191

92-
.\build\gfortran_debug\test\greet_test
92+
%fpm_path% test --target greet_test
9393
if errorlevel 1 exit 1
9494

95-
.\build\gfortran_debug\test\farewell_test
95+
%fpm_path% test --target farewell_test
9696
if errorlevel 1 exit 1
9797

9898

@@ -103,16 +103,16 @@ del /q /f build
103103
%fpm_path% build
104104
if errorlevel 1 exit 1
105105

106-
.\build\gfortran_debug\app\say_hello_world
106+
%fpm_path% run --target say_hello_world
107107
if errorlevel 1 exit 1
108108

109-
.\build\gfortran_debug\app\say_goodbye
109+
%fpm_path% run --target say_goodbye
110110
if errorlevel 1 exit 1
111111

112-
.\build\gfortran_debug\test\greet_test
112+
%fpm_path% test --target greet_test
113113
if errorlevel 1 exit 1
114114

115-
.\build\gfortran_debug\test\farewell_test
115+
%fpm_path% test --target farewell_test
116116

117117

118118
cd ..\with_examples
@@ -122,10 +122,10 @@ del /q /f build
122122
%fpm_path% build
123123
if errorlevel 1 exit 1
124124

125-
.\build\gfortran_debug\example\demo-prog
125+
%fpm_path% run --example --target demo-prog
126126
if errorlevel 1 exit 1
127127

128-
.\build\gfortran_debug\app\demo-prog
128+
%fpm_path% run --target demo-prog
129129
if errorlevel 1 exit 1
130130

131131

@@ -136,15 +136,15 @@ del /q /f build
136136
%fpm_path% build
137137
if errorlevel 1 exit 1
138138

139-
.\build\gfortran_debug\app\auto_discovery_off
139+
%fpm_path% run --target auto_discovery_off
140140
if errorlevel 1 exit 1
141141

142-
.\build\gfortran_debug\test\my_test
142+
%fpm_path% test --target my_test
143143
if errorlevel 1 exit 1
144144

145-
if exist .\build\gfortran_debug\app\unused exit /B 1
145+
if exist .\build\gfortran_*\app\unused exit /B 1
146146

147-
if exist .\build\gfortran_debug\test\unused_test exit /B 1
147+
if exist .\build\gfortran_*\test\unused_test exit /B 1
148148

149149

150150
cd ..\with_c
@@ -154,7 +154,7 @@ del /q /f build
154154
%fpm_path% build
155155
if errorlevel 1 exit 1
156156

157-
.\build\gfortran_debug\app\with_c
157+
%fpm_path% run --target with_c
158158
if errorlevel 1 exit 1
159159

160160

@@ -173,7 +173,7 @@ del /q /f build
173173
%fpm_path% build
174174
if errorlevel 1 exit 1
175175

176-
.\build\gfortran_debug\app\Program_with_module
176+
%fpm_path% run --target Program_with_module
177177
if errorlevel 1 exit 1
178178

179179

@@ -184,7 +184,7 @@ del /q /f build
184184
%fpm_path% build
185185
if errorlevel 1 exit 1
186186

187-
.\build\gfortran_debug\app\gomp_test
187+
%fpm_path% run --target gomp_test
188188
if errorlevel 1 exit 1
189189

190190

ci/run_tests.sh

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ rm -rf ./*/build
3030
cd hello_world
3131

3232
"${f_fpm_path}" build
33-
./build/gfortran_debug/app/hello_world
33+
"${f_fpm_path}" run --target hello_world
3434
"${f_fpm_path}" run
3535

3636
cd ../hello_fpm
3737
"${f_fpm_path}" build
38-
./build/gfortran_debug/app/hello_fpm
38+
"${f_fpm_path}" run --target hello_fpm
3939

4040
cd ../circular_test
4141
"${f_fpm_path}" build
@@ -46,48 +46,48 @@ cd ../circular_example
4646
cd ../hello_complex
4747
"${f_fpm_path}" build
4848
"${f_fpm_path}" test
49-
./build/gfortran_debug/app/say_Hello
50-
./build/gfortran_debug/app/say_goodbye
51-
./build/gfortran_debug/test/greet_test
52-
./build/gfortran_debug/test/farewell_test
49+
"${f_fpm_path}" run --target say_Hello
50+
"${f_fpm_path}" run --target say_goodbye
51+
"${f_fpm_path}" test --target greet_test
52+
"${f_fpm_path}" test --target farewell_test
5353

5454
cd ../hello_complex_2
5555
"${f_fpm_path}" build
56-
./build/gfortran_debug/app/say_hello_world
57-
./build/gfortran_debug/app/say_goodbye
58-
./build/gfortran_debug/test/greet_test
59-
./build/gfortran_debug/test/farewell_test
56+
"${f_fpm_path}" run --target say_hello_world
57+
"${f_fpm_path}" run --target say_goodbye
58+
"${f_fpm_path}" test --target greet_test
59+
"${f_fpm_path}" test --target farewell_test
6060

6161
cd ../with_examples
6262
"${f_fpm_path}" build
63-
./build/gfortran_debug/example/demo-prog
64-
./build/gfortran_debug/app/demo-prog
63+
"${f_fpm_path}" run --example --target demo-prog
64+
"${f_fpm_path}" run --target demo-prog
6565

6666
cd ../auto_discovery_off
6767
"${f_fpm_path}" build
68-
./build/gfortran_debug/app/auto_discovery_off
69-
./build/gfortran_debug/test/my_test
70-
test ! -x ./build/gfortran_debug/app/unused
71-
test ! -x ./build/gfortran_debug/test/unused_test
68+
"${f_fpm_path}" run --target auto_discovery_off
69+
"${f_fpm_path}" test --target my_test
70+
test ! -x ./build/gfortran_*/app/unused
71+
test ! -x ./build/gfortran_*/test/unused_test
7272

7373
cd ../with_c
7474
"${f_fpm_path}" build
75-
./build/gfortran_debug/app/with_c
75+
"${f_fpm_path}" run --target with_c
7676

7777
cd ../submodules
7878
"${f_fpm_path}" build
7979

8080
cd ../program_with_module
8181
"${f_fpm_path}" build
82-
./build/gfortran_debug/app/Program_with_module
82+
"${f_fpm_path}" run --target Program_with_module
8383

8484
cd ../link_external
8585
"${f_fpm_path}" build
86-
./build/gfortran_debug/app/link_external
86+
"${f_fpm_path}" run --target link_external
8787

8888
cd ../link_executable
8989
"${f_fpm_path}" build
90-
./build/gfortran_debug/app/gomp_test
90+
"${f_fpm_path}" run --target gomp_test
9191

9292
cd ../fortran_includes
9393
"${f_fpm_path}" build

example_packages/link_executable/fpm.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
name = "link_executable"
2-
build.auto-executables = false
32

43
[[executable]]
54
name = "gomp_test"

fpm/src/fpm.f90

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module fpm
99
use fpm_model, only: fpm_model_t, srcfile_t, show_model, &
1010
FPM_SCOPE_UNKNOWN, FPM_SCOPE_LIB, FPM_SCOPE_DEP, &
1111
FPM_SCOPE_APP, FPM_SCOPE_EXAMPLE, FPM_SCOPE_TEST
12-
use fpm_compiler, only: add_compile_flag_defaults
12+
use fpm_compiler, only: get_module_flags, is_unknown_compiler
1313

1414

1515
use fpm_sources, only: add_executable_sources, add_sources_from_dir
@@ -59,9 +59,20 @@ subroutine build_model(model, settings, package, error)
5959
model%fortran_compiler = settings%compiler
6060
endif
6161

62+
if (is_unknown_compiler(model%fortran_compiler)) then
63+
write(*, '(*(a:,1x))') &
64+
"<WARN>", "Unknown compiler", model%fortran_compiler, "requested!", &
65+
"Defaults for this compiler might be incorrect"
66+
end if
6267
model%output_directory = join_path('build',basename(model%fortran_compiler)//'_'//settings%build_name)
6368

64-
call add_compile_flag_defaults(settings%build_name, basename(model%fortran_compiler), model)
69+
call get_module_flags(model%fortran_compiler, &
70+
& join_path(model%output_directory,model%package_name), &
71+
& model%fortran_compile_flags)
72+
model%fortran_compile_flags = settings%flag // model%fortran_compile_flags
73+
if(settings%verbose)then
74+
write(*,*)'<INFO>COMPILER OPTIONS: ', model%fortran_compile_flags
75+
endif
6576

6677
allocate(model%packages(model%deps%ndep))
6778

0 commit comments

Comments
 (0)