diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 33fc1e55e10..d07ced23089 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -373,6 +373,7 @@ jobs: run: | pixi run setup builddir pixi run build builddir + pixi run test builddir - name: Show build log if: failure() diff --git a/.vscode/build_vscode.py b/.vscode/build_vscode.py index 208d0fdc538..26c4d9194f0 100644 --- a/.vscode/build_vscode.py +++ b/.vscode/build_vscode.py @@ -19,15 +19,13 @@ if os.environ["BUILD_PARALLEL_MF6"] == '1': arg_parallel = "-Dparallel=true" -if args.action == "rebuild" and os.path.isdir(builddir): - shutil.rmtree(builddir) - -if args.buildtype == "release": - setup_flag = ["-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 not os.path.isdir(builddir): +if args.action == "rebuild": + shutil.rmtree(builddir) command = [ "meson", "setup", @@ -44,14 +42,16 @@ check=True, ) -# Remove all files from bin folder -bin_dir = os.path.join(os.getcwd(), "bin") -if os.path.isdir(bin_dir): - for dir_entry in os.scandir(bin_dir): - path = dir_entry.path - if os.path.isfile(path): - os.remove(path) - -command = ["meson", "install", "-C", builddir] -print("Run:", shlex.join(command)) -subprocess.run(command, check=True) +if args.action == "rebuild" or args.action == "build": + # Remove all files from bin folder + bin_dir = os.path.join(os.getcwd(), "bin") + if os.path.isdir(bin_dir): + for dir_entry in os.scandir(bin_dir): + path = dir_entry.path + if os.path.isfile(path): + os.remove(path) + + command = ["meson", "install", "-C", builddir] + print("Run:", shlex.join(command)) + subprocess.run(command, check=True) + diff --git a/meson.build b/meson.build index 0da78223a9e..a3fef84274e 100644 --- a/meson.build +++ b/meson.build @@ -5,27 +5,18 @@ 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') fc_id = fc.get_id() -message('The fc_id is:', fc_id) +message('Fortran compiler id:', fc_id) compile_args = [] link_args = [] @@ -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 @@ -102,7 +93,6 @@ elif fc_id == 'intel-llvm-cl' link_args += ['/ignore:4217', # access through ddlimport might be inefficient '/ignore:4286' # same as 4217, but more general ] - endif # parallel build options @@ -240,6 +230,7 @@ if with_mpi if mpiexec.found() test('Parallel version command line test', mpiexec, args : ['-n', '2', mf6exe, '-v', '-p'], is_parallel : false) test('Parallel compiler command line test', mpiexec, args : ['-n', '2', mf6exe, '-c', '-p'], is_parallel : false) + test('Parallel compiler options command line test', mpiexec, args : ['-n', '2', mf6exe, '-co', '-p'], is_parallel : false) test('Serial simulation test', mf6exe, workdir : testdir, is_parallel : false) test('Parallel simulation test - 1 core', mpiexec, workdir : testdir, args : ['-n', '1', mf6exe, '-p'], is_parallel : false) test('Parallel simulation test - 2 cores', mpiexec, workdir : testdir, args : ['-n', '2', mf6exe, '-p'], is_parallel : false) @@ -247,6 +238,7 @@ if with_mpi else test('Version command line test', mf6exe, args : ['-v',]) test('Compiler command line test', mf6exe, args : ['-c',]) + test('Compiler options command line test', mf6exe, args : ['-co',]) test('Test installation help', mf6exe, args : ['-h',]) test('Serial simulation test', mf6exe, workdir : testdir) endif