mirror of
https://gitlab.com/ita1024/waf.git
synced 2024-11-21 17:35:55 +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:
parent
e0254f7a75
commit
9ff9eb73ad
13
demos/fortran/submodules/container.f90
Normal file
13
demos/fortran/submodules/container.f90
Normal 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
|
13
demos/fortran/submodules/helper.f90
Normal file
13
demos/fortran/submodules/helper.f90
Normal 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
|
21
demos/fortran/submodules/parent.f90
Normal file
21
demos/fortran/submodules/parent.f90
Normal 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
|
20
demos/fortran/submodules/wscript
Normal file
20
demos/fortran/submodules/wscript
Normal 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',
|
||||
)
|
@ -78,3 +78,5 @@ def build(bld):
|
||||
target = 'mod/two_mods')
|
||||
|
||||
bld.recurse('typemap')
|
||||
if bld.env.FC_NAME == 'GFORTRAN' and int(bld.env.FC_VERSION[0]) >= 6:
|
||||
bld.recurse('submodules')
|
||||
|
Loading…
Reference in New Issue
Block a user