Skip to content

Commit 2612d9a

Browse files
authored
Merge pull request #239 from urbanjost/runner
Add --runner option to Fortran fpm to match Haskell fpm
2 parents c4ce73e + 03fec87 commit 2612d9a

File tree

7 files changed

+138
-70
lines changed

7 files changed

+138
-70
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ decisions. This is the workflow that we follow:
7777
one person disagrees.
7878
At this stage, the scope of the fix/feature, its behavior, and API if
7979
applicable should be defined.
80-
Only when you have community concensus on these items you should proceed to
80+
Only when you have community consensus on these items you should proceed to
8181
writing code and opening a PR.
8282
**When actively working on code towards a PR, please assign yourself to the
8383
issue on GitHub.**

PACKAGING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ Based on the output of `fpm build`, *fpm* first ran `gfortran` to emit the
177177
binary object (`math_constants.o`) and module (`math_constants.mod`) files.
178178
Then it ran `ar` to create a static library archive `math_constants.a`.
179179
`build/debug/library` is thus both your include and library path, should you
180-
want to compile and link an exteranl program with this library.
180+
want to compile and link an external program with this library.
181181

182182
For modules in the top-level (`src`) directory, *fpm* requires that:
183183

@@ -585,7 +585,7 @@ And now, `fpm run` will output the following:
585585
```
586586

587587
Additionally, any users of your library will now automatically depend on your
588-
dependencies too. So if you don’t need that depedency for the library, like in
588+
dependencies too. So if you don’t need that dependency for the library, like in
589589
the above example, then you can specify it for the specific executable like
590590
below. Then fpm will still fetch and compile it when building your executable,
591591
but users of your library won’t have to.
@@ -677,7 +677,7 @@ the build script:
677677
* `FC` – The Fortran compiler to be used.
678678
* `FFLAGS` – The flags that should be passed to the Fortran compiler.
679679
* `BUILD_DIR` – Where the compiled files should be placed.
680-
* `INCLUDE_DIRS` – The folders where any dependencies can be found, space seperated.
680+
* `INCLUDE_DIRS` – The folders where any dependencies can be found, space separated.
681681
It is then the responsibility of the build script to generate the appropriate
682682
include flags.
683683

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ with the following contents and initialized as a git repository.
6363

6464
* `fpm.toml` – with your project’s name and some default standard meta-data
6565
* `README.md` – with your project’s name
66-
* `.gitgnore`
66+
* `.gitignore`
6767
* `src/project_name.f90` – with a simple hello world subroutine
6868
* `app/main.f90` (if `--with-executable` flag used) – a program that calls the subroutine
6969
* `test/main.f90` (if `--with-test` flag used) – an empty test program

fpm/fpm.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ tag = "v0.2.1"
1212

1313
[dependencies.M_CLI2]
1414
git = "https://github.com/urbanjost/M_CLI2.git"
15-
rev = "649075aceb97f997665a1a4656514fd2e9b4becc"
15+
rev = "893cac0ce374bf07a70ffb9556439c7390e58131"
1616

1717
[[test]]
1818
name = "cli-test"

fpm/src/fpm.f90

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ subroutine add_dependencies(dependency_list)
8484
character(:), allocatable :: dependency_path
8585

8686
do i=1,size(dependency_list)
87-
87+
8888
if (dependency_list(i)%name .in. package_list) then
8989
cycle
9090
end if
@@ -99,7 +99,7 @@ subroutine add_dependencies(dependency_list)
9999
end if
100100

101101
else if (allocated(dependency_list(i)%path)) then
102-
102+
103103
dependency_path = join_path(package_root,dependency_list(i)%path)
104104

105105
end if
@@ -120,11 +120,11 @@ subroutine add_dependencies(dependency_list)
120120
dependency%library%source_dir = "src"
121121
end if
122122

123-
123+
124124
call add_libsources_from_package(sources,link_libraries,package_list,dependency, &
125125
package_root=dependency_path, &
126126
dev_depends=.false., error=error)
127-
127+
128128
if (allocated(error)) then
129129
error%message = 'Error while processing sources for dependency package "'//&
130130
new_line('a')//dependency%name//'"'//&
@@ -322,7 +322,7 @@ subroutine cmd_run(settings,test)
322322
exe_source => exe_target%dependencies(1)%ptr%source
323323

324324
if (exe_source%unit_scope == &
325-
merge(FPM_SCOPE_TEST,FPM_SCOPE_APP,test)) then
325+
merge(FPM_SCOPE_TEST,FPM_SCOPE_APP,test)) then
326326

327327
col_width = max(col_width,len(basename(exe_target%output_file))+2)
328328

@@ -336,7 +336,7 @@ subroutine cmd_run(settings,test)
336336
do j=1,size(settings%name)
337337

338338
if (trim(settings%name(j))==exe_source%exe_name) then
339-
339+
340340
found(j) = .true.
341341
exe_cmd%s = exe_target%output_file
342342
executables = [executables, exe_cmd]
@@ -346,7 +346,7 @@ subroutine cmd_run(settings,test)
346346
end do
347347

348348
end if
349-
349+
350350
end if
351351

352352
end if
@@ -379,14 +379,14 @@ subroutine cmd_run(settings,test)
379379
do i=1,size(model%targets)
380380

381381
exe_target => model%targets(i)%ptr
382-
382+
383383
if (exe_target%target_type == FPM_TARGET_EXECUTABLE .and. &
384384
allocated(exe_target%dependencies)) then
385385

386386
exe_source => exe_target%dependencies(1)%ptr%source
387387

388388
if (exe_source%unit_scope == &
389-
merge(FPM_SCOPE_TEST,FPM_SCOPE_APP,test)) then
389+
merge(FPM_SCOPE_TEST,FPM_SCOPE_APP,test)) then
390390

391391
write(stderr,'(A)',advance=(merge("yes","no ",modulo(j,nCol)==0))) &
392392
& [character(len=col_width) :: basename(exe_target%output_file)]
@@ -415,9 +415,13 @@ subroutine cmd_run(settings,test)
415415
if (settings%list) then
416416
write(stderr,*) executables(i)%s
417417
else
418-
418+
419419
if (exists(executables(i)%s)) then
420-
call run(executables(i)%s//" "//settings%args)
420+
if(settings%runner .ne. ' ')then
421+
call run(settings%runner//' '//executables(i)%s//" "//settings%args)
422+
else
423+
call run(executables(i)%s//" "//settings%args)
424+
endif
421425
else
422426
write(stderr,*)'fpm::run<ERROR>',executables(i)%s,' not found'
423427
stop 1

0 commit comments

Comments
 (0)