2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-25 11:19:52 +01:00

Added submodules demonstrator to demos/fortran.

Its only built if gfortran is used at least with version 6.
This commit is contained in:
Harald Klimach 2018-12-21 23:14:19 +01:00
parent e0254f7a75
commit 9ff9eb73ad
5 changed files with 69 additions and 0 deletions

View File

@ -0,0 +1,13 @@
submodule (parent) container
implicit none
contains
module function parent_weight(p) result(w)
type(parent_type), intent(in) :: p
real :: w
w = p%mother**2 + p%father**2
end function parent_weight
end submodule container

View File

@ -0,0 +1,13 @@
submodule (parent:container) helper
implicit none
contains
module function parent_distance(pa, pb) result(dist)
type(parent_type), intent(in) :: pa, pb
real :: dist
dist = sqrt(parent_weight(pa) + parent_weight(pb))
end function parent_distance
end submodule helper

View File

@ -0,0 +1,21 @@
module parent
implicit none
type parent_type
real :: mother
real :: father
end type parent_type
interface
module function parent_weight(p) result(w)
type(parent_type), intent(in) :: p
real :: w
end function parent_weight
module function parent_distance(pa, pb) result(dist)
type(parent_type), intent(in) :: pa, pb
real :: dist
end function parent_distance
end interface
end module parent

View File

@ -0,0 +1,20 @@
#! /usr/bin/env python
top = '.'
out = 'build'
def options(opt):
opt.load('compiler_c')
opt.load('compiler_fc')
def configure(conf):
conf.load('compiler_c')
conf.load('compiler_fc')
def build(bld):
bld(
features = 'fc fcshlib',
source = 'parent.f90 container.f90 helper.f90',
target = 'fudge',
)

View File

@ -78,3 +78,5 @@ def build(bld):
target = 'mod/two_mods') target = 'mod/two_mods')
bld.recurse('typemap') bld.recurse('typemap')
if bld.env.FC_NAME == 'GFORTRAN' and int(bld.env.FC_VERSION[0]) >= 6:
bld.recurse('submodules')