From e28d407cd7809fe131f2d6bd55f413916d3c9f0c Mon Sep 17 00:00:00 2001 From: Emily Boudreaux Date: Sun, 19 Jan 2025 08:34:21 -0500 Subject: [PATCH] build(meson): added command line options to not build tests meson_options added which includes a build test variable. If this is false (default: true) tests will be build. the mk script can controll this with the --noTest command line argument. --- meson_options.txt | 1 + mk | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 meson_options.txt diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..b9f2fff --- /dev/null +++ b/meson_options.txt @@ -0,0 +1 @@ +option('build_tests', type: 'boolean', value: true, description: 'Build tests') \ No newline at end of file diff --git a/mk b/mk index d9ba04d..4179b41 100755 --- a/mk +++ b/mk @@ -1,9 +1,21 @@ #!/bin/bash -# if build directory is present, remove it +# Check if the build directory is present, and remove it if [ -d "build" ]; then rm -rf build fi -meson setup build -meson compile -C build \ No newline at end of file +# Check for the --noTest flag +if [[ "$1" == "--noTest" ]]; then + meson setup build -Dbuild_tests=false +else + meson setup build -Dbuild_tests=true +fi + +# Compile the project +meson compile -C build + +# If tests are built, run them +if [[ "$1" != "--noTest" ]]; then + meson test -C build +fi