| 1 |
|
| 2 |
|
| 3 |
1 |
| 4 |
|
| 5 |
'''Uses Fypp as Fortran preprocessor (.fpp -> .f90). Use this one (instead of |
| 6 |
fypp_preprocessor) if you want to preprocess Fortran sources with Fypp. |
| 7 |
|
| 8 |
You typically trigger the preprocessing via the 'fypp' feature:: |
| 9 |
|
| 10 |
def options(opt): |
| 11 |
opt.load('compiler_c') |
| 12 |
opt.load('compiler_fc') |
| 13 |
opt.load('fypp_fortran') |
| 14 |
|
| 15 |
def configure(conf): |
| 16 |
conf.load('compiler_c') |
| 17 |
conf.load('compiler_fc') |
| 18 |
conf.load('fypp_fortran') |
| 19 |
|
| 20 |
|
| 21 |
def build(bld): |
| 22 |
sources = bld.path.ant_glob('*.fpp') |
| 23 |
|
| 24 |
bld( |
| 25 |
features='fypp fc fcprogram', |
| 26 |
source=sources, |
| 27 |
target='myprog' |
| 28 |
) |
| 29 |
|
| 30 |
Please check the documentation in the fypp_preprocessor module for the |
| 31 |
description of the uselib variables which may be passed to the task generator. |
| 32 |
''' |
| 33 |
|
| 34 |
from waflib import TaskGen |
| 35 |
import fypp_preprocessor |
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
def configure(conf): |
| 43 |
fypp_preprocessor.configure(conf) |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
class fypp_fortran(fypp_preprocessor.fypp_preprocessor): |
| 51 |
|
| 52 |
ext_in = [ '.fpp' ] |
| 53 |
ext_out = [ '.f90' ] |
| 54 |
|
| 55 |
|
| 56 |
@TaskGen.extension('.fpp') |
| 57 |
def fypp_preprocess_fpp(self, node): |
| 58 |
'Preprocess the .fpp files with Fypp.' |
| 59 |
|
| 60 |
f90node = node.change_ext('.f90') |
| 61 |
self.create_task('fypp_fortran', node, [ f90node ]) |
| 62 |
if 'fc' in self.features: |
| 63 |
self.source.append(f90node) |