aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fpm.f905
-rw-r--r--src/fpm/manifest/build.f9016
-rw-r--r--src/fpm_compiler.f904
-rw-r--r--src/fpm_model.f9010
-rw-r--r--src/fpm_targets.f9010
5 files changed, 37 insertions, 8 deletions
diff --git a/src/fpm.f90 b/src/fpm.f90
index 805132c..5e86498 100644
--- a/src/fpm.f90
+++ b/src/fpm.f90
@@ -51,6 +51,7 @@ subroutine build_model(model, settings, package, error)
allocate(model%include_dirs(0))
allocate(model%link_libraries(0))
+ allocate(model%external_modules(0))
call new_dependency_tree(model%deps, cache=join_path("build", "cache.toml"))
call model%deps%add(package, error)
@@ -174,6 +175,10 @@ subroutine build_model(model, settings, package, error)
if (allocated(dependency%build%link)) then
model%link_libraries = [model%link_libraries, dependency%build%link]
end if
+
+ if (allocated(dependency%build%external_modules)) then
+ model%external_modules = [model%external_modules, dependency%build%external_modules]
+ end if
end associate
end do
if (allocated(error)) return
diff --git a/src/fpm/manifest/build.f90 b/src/fpm/manifest/build.f90
index d96974f..c9b3f44 100644
--- a/src/fpm/manifest/build.f90
+++ b/src/fpm/manifest/build.f90
@@ -34,6 +34,9 @@ module fpm_manifest_build
!> Libraries to link against
type(string_t), allocatable :: link(:)
+ !> External modules to use
+ type(string_t), allocatable :: external_modules(:)
+
contains
!> Print information on this instance
@@ -87,6 +90,9 @@ contains
call get_value(table, "link", self%link, error)
if (allocated(error)) return
+ call get_value(table, "external-modules", self%external_modules, error)
+ if (allocated(error)) return
+
end subroutine new_build_config
@@ -110,7 +116,7 @@ contains
do ikey = 1, size(list)
select case(list(ikey)%key)
- case("auto-executables", "auto-examples", "auto-tests", "link")
+ case("auto-executables", "auto-examples", "auto-tests", "link", "external-modules")
continue
case default
@@ -135,7 +141,7 @@ contains
!> Verbosity of the printout
integer, intent(in), optional :: verbosity
- integer :: pr, ilink
+ integer :: pr, ilink, imod
character(len=*), parameter :: fmt = '("#", 1x, a, t30, a)'
if (present(verbosity)) then
@@ -156,6 +162,12 @@ contains
write(unit, fmt) " - " // self%link(ilink)%s
end do
end if
+ if (allocated(self%external_modules)) then
+ write(unit, fmt) " - external modules"
+ do imod = 1, size(self%external_modules)
+ write(unit, fmt) " - " // self%external_modules(imod)%s
+ end do
+ end if
end subroutine info
diff --git a/src/fpm_compiler.f90 b/src/fpm_compiler.f90
index 75bd3be..ca0f4d7 100644
--- a/src/fpm_compiler.f90
+++ b/src/fpm_compiler.f90
@@ -130,7 +130,6 @@ subroutine get_release_compile_flags(id, flags)
& -reentrancy threaded&
& -nogen-interfaces&
& -assume byterecl&
- & -coarray=single&
&'
case(id_intel_classic_mac)
flags = '&
@@ -150,7 +149,6 @@ subroutine get_release_compile_flags(id, flags)
& /reentrancy:threaded&
& /nogen-interfaces&
& /assume:byterecl&
- & /Qcoarray:single&
&'
case(id_intel_llvm_nix, id_intel_llvm_unknown)
flags = '&
@@ -161,7 +159,6 @@ subroutine get_release_compile_flags(id, flags)
& -reentrancy threaded&
& -nogen-interfaces&
& -assume byterecl&
- & -coarray=single&
&'
case(id_intel_llvm_windows)
flags = '&
@@ -171,7 +168,6 @@ subroutine get_release_compile_flags(id, flags)
& /reentrancy:threaded&
& /nogen-interfaces&
& /assume:byterecl&
- & /Qcoarray:single&
&'
case(id_nag)
flags = ' &
diff --git a/src/fpm_model.f90 b/src/fpm_model.f90
index 5c575fc..b8a4143 100644
--- a/src/fpm_model.f90
+++ b/src/fpm_model.f90
@@ -132,6 +132,9 @@ type :: fpm_model_t
!> Native libraries to link against
type(string_t), allocatable :: link_libraries(:)
+ !> External modules used
+ type(string_t), allocatable :: external_modules(:)
+
!> Project dependencies
type(dependency_tree_t) :: deps
@@ -279,6 +282,13 @@ function info_model(model) result(s)
if (i < size(model%link_libraries)) s = s // ", "
end do
s = s // "]"
+ ! type(string_t), allocatable :: external_modules(:)
+ s = s // ", external_modules=["
+ do i = 1, size(model%external_modules)
+ s = s // '"' // model%external_modules(i)%s // '"'
+ if (i < size(model%external_modules)) s = s // ", "
+ end do
+ s = s // "]"
! type(dependency_tree_t) :: deps
! TODO: print `dependency_tree_t` properly, which should become part of the
! model, not imported from another file
diff --git a/src/fpm_targets.f90 b/src/fpm_targets.f90
index 7a06877..c247232 100644
--- a/src/fpm_targets.f90
+++ b/src/fpm_targets.f90
@@ -123,7 +123,7 @@ subroutine targets_from_sources(targets,model,error)
call build_target_list(targets,model)
- call resolve_module_dependencies(targets,error)
+ call resolve_module_dependencies(targets,model%external_modules,error)
if (allocated(error)) return
call resolve_target_linking(targets,model)
@@ -348,8 +348,9 @@ end subroutine add_dependency
!> a source file in the package of the correct scope, then a __fatal error__
!> is returned by the procedure and model construction fails.
!>
-subroutine resolve_module_dependencies(targets,error)
+subroutine resolve_module_dependencies(targets,external_modules,error)
type(build_target_ptr), intent(inout), target :: targets(:)
+ type(string_t), intent(in) :: external_modules(:)
type(error_t), allocatable, intent(out) :: error
type(build_target_ptr) :: dep
@@ -367,6 +368,11 @@ subroutine resolve_module_dependencies(targets,error)
cycle
end if
+ if (targets(i)%ptr%source%modules_used(j)%s .in. external_modules) then
+ ! Dependency satisfied in system-installed module
+ cycle
+ end if
+
if (any(targets(i)%ptr%source%unit_scope == &
[FPM_SCOPE_APP, FPM_SCOPE_EXAMPLE, FPM_SCOPE_TEST])) then
dep%ptr => &