diff --git a/.vscode/build_vscode.py b/.vscode/build_vscode.py index b889869562a..11fe1ab3c6f 100644 --- a/.vscode/build_vscode.py +++ b/.vscode/build_vscode.py @@ -2,6 +2,7 @@ import os import argparse import shutil +import shlex parser = argparse.ArgumentParser() parser.add_argument("--compiler", type=str) @@ -12,25 +13,30 @@ os.environ["FC"] = args.compiler builddir = f"builddir_{args.compiler}_{args.buildtype}" - 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 = ["-Doptimization=0"] if not os.path.isdir(builddir): + command = [ + "meson", + "setup", + builddir, + "--prefix", + os.getcwd(), + "--libdir", + "bin", + ] + setup_flag + print("Run:", shlex.join(command)) subprocess.run( - ["meson", "setup", builddir, "--prefix", os.getcwd(), "--libdir", "bin"] - + setup_flag, + command, check=True, ) -subprocess.run(["meson", "compile", "-C", builddir], check=True) - # Remove all files from bin folder bin_dir = os.path.join(os.getcwd(), "bin") if os.path.isdir(bin_dir): @@ -39,4 +45,6 @@ if os.path.isfile(path): os.remove(path) -subprocess.run(["meson", "install", "-C", builddir], check=True) +command = ["meson", "install", "-C", builddir] +print("Run:", shlex.join(command)) +subprocess.run(command, check=True)