Skip to content

Commit

Permalink
* convert to buildtype - changes release optimization from 2 to 3
Browse files Browse the repository at this point in the history
  • Loading branch information
jdhughes-usgs committed May 4, 2024
1 parent 59ddbe6 commit a71c3d5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 26 deletions.
6 changes: 2 additions & 4 deletions .vscode/build_vscode.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@
if os.environ["BUILD_PARALLEL_MF6"] == '1':
arg_parallel = "-Dparallel=true"

if args.buildtype == "release":
setup_flag = ["-Ddebug=false", "-Doptimization=2"]
elif args.buildtype == "debug":
setup_flag = ["-Ddebug=true", "-Doptimization=0"]
setup_flag = [f"-Dbuildtype={args.buildtype}"]

if args.action == "rebuild":
setup_flag += ["--wipe"]

if args.action == "rebuild":
shutil.rmtree(builddir)
command = [
"meson",
"setup",
Expand Down
29 changes: 7 additions & 22 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,13 @@ project(
license: 'CC0',
meson_version: '>= 1.1.0',
default_options : [
'buildtype=release',
'b_vscrt=static_from_buildtype', # Link runtime libraries statically on Windows
'optimization=2',
'debug=false',
'fortran_std=f2008',
])

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)
build_type = get_option('buildtype')
message('The build type is:', build_type)

# parse compiler options
fc = meson.get_compiler('fortran')
Expand All @@ -43,11 +34,11 @@ if fc_id == 'gcc'
'-Wno-uninitialized',
]

# Options specific to profile
if profile == 'release'
compile_args += ['-ffpe-summary=overflow', '-ffpe-trap=overflow,zero,invalid']
elif profile == 'develop'
# Options specific to build_type
if build_type.startswith('debug')
compile_args += ['-fcheck=all', '-ffpe-trap=overflow,zero,invalid']
else
compile_args += ['-ffpe-summary=overflow', '-ffpe-trap=overflow,zero,invalid']
endif

# Define OS with gfortran for OS specific code
Expand All @@ -74,12 +65,6 @@ if fc_id == 'intel-cl'
'/Qdiag-disable:5268', # Line too long
'/Qdiag-disable:10448',# ifort deprecation warning
]
# add the correct C/C++ CRT runtime on Windows based on profile
if profile == 'release'
compile_args += '/MT'
else
compile_args += '/MTd'
endif
link_args += ['/ignore:4217', # access through ddlimport might be inefficient
'/ignore:4286' # same as 4217, but more general
]
Expand Down

0 comments on commit a71c3d5

Please sign in to comment.