-
Notifications
You must be signed in to change notification settings - Fork 8
/
meson.build
95 lines (85 loc) · 3.01 KB
/
meson.build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
project(
'PESTUTILS',
'fortran',
version: '2023.9.21',
meson_version: '>= 1.1.0',
default_options: [
'b_vscrt=static_from_buildtype', # Link runtime libraries statically on Windows
'optimization=2',
])
if get_option('optimization') == '3'
error('Only optimization levels <= 2 are supported')
endif
if get_option('optimization') == '2'
profile = 'release'
else
profile = 'develop'
endif
message('The used profile is:', profile)
# Gather host-system options
system = build_machine.system()
fc = meson.get_compiler('fortran')
fc_id = fc.get_id()
compile_args = []
link_args = []
# Command line options for gfortran
if fc_id == 'gcc'
# General options
compile_args += [
'-cpp',
'-Wcharacter-truncation',
'-Wno-maybe-uninitialized',
'-Wno-unused-label',
'-Wno-unused-variable',
'-fallow-argument-mismatch',
]
# Options specific to profile
if profile == 'release'
compile_args += ['-ffpe-summary=overflow', '-ffpe-trap=overflow,zero,invalid']
elif profile == 'develop'
compile_args += ['-fcheck=all', '-ffpe-trap=overflow,zero,invalid,denormal']
endif
# Define OS with gfortran for OS specific code
# These are identical to pre-defined macros available with ifort
if system == 'linux'
compile_args += '-D__linux__'
elif system == 'darwin'
compile_args += '-D__APPLE__'
elif system == 'windows'
compile_args += '-D_WIN32'
# For "more static" use the following envvar:
# LDFLAGS=-static-libgcc -static-libgfortran -static-libquadmath -Wl,-Bstatic,--whole-archive -lwinpthread -Wl,--no-whole-archive
endif
endif
# Command line options for ifort
if fc_id == 'intel-cl'
# windows
compile_args += ['/fpe:0', # Activate all floating point exceptions
'/heap-arrays:0',
'/traceback',
'/fpp', # Activate preprocessing
'/Qdiag-disable:7416', # f2008 warning
'/Qdiag-disable:7025', # f2008 warning
'/Qdiag-disable:5268', # Line too long
'/c',
'/fpp'
]
link_args += ['/ignore:4217', # access through ddlimport might be inefficient
'/ignore:4286' # same as 4217, but more general
]
elif fc_id == 'intel'
# linux and macOS
compile_args += ['-fpe0', # Activate all floating point exceptions
'-no-heap-arrays',
'-traceback',
'-diag-disable:7416', # f2008 warning
'-diag-disable:7025', # f2008 warning
'-diag-disable:5268', # Line too long
'-c',
'-fpp'
]
link_args += '-static-intel'
endif
add_project_arguments(fc.get_supported_arguments(compile_args), language: 'fortran')
add_project_link_arguments(fc.get_supported_arguments(link_args), language: 'fortran')
subdir('pestutils')