aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorinit current directory[i] <urbanjost@comcast.net>2020-11-21 18:00:50 -0500
committerinit current directory[i] <urbanjost@comcast.net>2020-11-21 18:00:50 -0500
commit03fec875cfab2e358ab2665d70ce09b64cf7ddbf (patch)
tree35b9ead35a230272230c2e0dede3063335ca2fe8
parentf62bec5f5a500de68a83973aedc3bd76031f4886 (diff)
downloadfpm-03fec875cfab2e358ab2665d70ce09b64cf7ddbf.tar.gz
fpm-03fec875cfab2e358ab2665d70ce09b64cf7ddbf.zip
better examples for --runner and errata per @awvwgk
-rw-r--r--fpm/src/fpm.f9026
-rw-r--r--fpm/src/fpm_command_line.f908
2 files changed, 20 insertions, 14 deletions
diff --git a/fpm/src/fpm.f90 b/fpm/src/fpm.f90
index e15fc49..7f9cbeb 100644
--- a/fpm/src/fpm.f90
+++ b/fpm/src/fpm.f90
@@ -85,7 +85,7 @@ recursive subroutine add_libsources_from_package(sources,link_libraries,package_
character(:), allocatable :: dependency_path
do i=1,size(dependency_list)
-
+
if (dependency_list(i)%name .in. package_list) then
cycle
end if
@@ -100,7 +100,7 @@ recursive subroutine add_libsources_from_package(sources,link_libraries,package_
end if
else if (allocated(dependency_list(i)%path)) then
-
+
dependency_path = join_path(package_root,dependency_list(i)%path)
end if
@@ -121,11 +121,11 @@ recursive subroutine add_libsources_from_package(sources,link_libraries,package_
dependency%library%source_dir = "src"
end if
-
+
call add_libsources_from_package(sources,link_libraries,package_list,dependency, &
package_root=dependency_path, &
dev_depends=.false., error=error)
-
+
if (allocated(error)) then
error%message = 'Error while processing sources for dependency package "'//&
new_line('a')//dependency%name//'"'//&
@@ -358,7 +358,7 @@ subroutine cmd_run(settings,test)
exe_source => exe_target%dependencies(1)%ptr%source
if (exe_source%unit_scope == &
- merge(FPM_SCOPE_TEST,FPM_SCOPE_APP,test)) then
+ merge(FPM_SCOPE_TEST,FPM_SCOPE_APP,test)) then
col_width = max(col_width,len(basename(exe_target%output_file))+2)
@@ -372,7 +372,7 @@ subroutine cmd_run(settings,test)
do j=1,size(settings%name)
if (trim(settings%name(j))==exe_source%exe_name) then
-
+
found(j) = .true.
exe_cmd%s = exe_target%output_file
executables = [executables, exe_cmd]
@@ -382,7 +382,7 @@ subroutine cmd_run(settings,test)
end do
end if
-
+
end if
end if
@@ -415,14 +415,14 @@ subroutine cmd_run(settings,test)
do i=1,size(model%targets)
exe_target => model%targets(i)%ptr
-
+
if (exe_target%target_type == FPM_TARGET_EXECUTABLE .and. &
allocated(exe_target%dependencies)) then
exe_source => exe_target%dependencies(1)%ptr%source
if (exe_source%unit_scope == &
- merge(FPM_SCOPE_TEST,FPM_SCOPE_APP,test)) then
+ merge(FPM_SCOPE_TEST,FPM_SCOPE_APP,test)) then
write(stderr,'(A)',advance=(merge("yes","no ",modulo(j,nCol)==0))) &
& [character(len=col_width) :: basename(exe_target%output_file)]
@@ -451,13 +451,13 @@ subroutine cmd_run(settings,test)
if (settings%list) then
write(stderr,*) executables(i)%s
else
-
+
if (exists(executables(i)%s)) then
- if(settings%runner .ne. ' ')then
+ if(settings%runner .ne. ' ')then
call run(settings%runner//' '//executables(i)%s//" "//settings%args)
- else
+ else
call run(executables(i)%s//" "//settings%args)
- endif
+ endif
else
write(stderr,*)'fpm::run<ERROR>',executables(i)%s,' not found'
stop 1
diff --git a/fpm/src/fpm_command_line.f90 b/fpm/src/fpm_command_line.f90
index 34ec7d0..50a7d25 100644
--- a/fpm/src/fpm_command_line.f90
+++ b/fpm/src/fpm_command_line.f90
@@ -314,7 +314,7 @@ contains
' executables. ', &
' ', &
'SYNOPSIS ', &
- ' fpm run|test --runner CMD ... ', &
+ ' fpm run|test --runner CMD ... -- SUFFIX_OPTIONS ', &
' ', &
'DESCRIPTION ', &
' The --runner option allows specifying a program to launch ', &
@@ -329,6 +329,8 @@ contains
' --runner ''CMD'' quoted command used to launch the fpm(1) executables. ', &
' Available for both the "run" and "test" subcommands. ', &
' ', &
+ ' -- SUFFIX_OPTIONS additional options to suffix the command CMD and executable ', &
+ ' file names with. ', &
'EXAMPLES ', &
' Use cases for ''fpm run|test --runner "CMD"'' include employing ', &
' the following common GNU/Linux and Unix commands: ', &
@@ -361,6 +363,10 @@ contains
' fpm run --runner strip ', &
' fpm run --runner ''cp -t /usr/local/bin'' ', &
' ', &
+ ' # options after executable name can be specified after the -- option ', &
+ ' fpm --runner cp run -- /usr/local/bin/ ', &
+ ' # generates commands of the form "cp $FILENAME /usr/local/bin/" ', &
+ ' ', &
' # bash(1) alias example: ', &
' alias fpm-install="ffpm run --release --runner \ ', &
' ''install -vbp -m 0711 -t ~/.local/bin''" ', &