From daa01413843572e553bcc095fc7db9c04f7f5c1a Mon Sep 17 00:00:00 2001 From: XavierChanth Date: Mon, 23 Dec 2024 09:45:47 -0500 Subject: [PATCH] chore: add justfile --- .gitignore | 2 + just.template.env | 3 ++ justfile | 97 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 102 insertions(+) create mode 100644 just.template.env create mode 100644 justfile diff --git a/.gitignore b/.gitignore index 8a9aa662..ca5ae862 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ .DS_Store +just.env + CMakeFiles/ CMakeCache.txt CMakeFiles diff --git a/just.template.env b/just.template.env new file mode 100644 index 00000000..8bb9ba38 --- /dev/null +++ b/just.template.env @@ -0,0 +1,3 @@ +FIRST_ATSIGN="" +SECOND_ATSIGN="" +C_COMPILER=gcc diff --git a/justfile b/justfile new file mode 100644 index 00000000..5cd4c8c9 --- /dev/null +++ b/justfile @@ -0,0 +1,97 @@ +alias build := build-debug +alias test := test-all +alias unit := test-unit +alias func := test-func + +set dotenv-filename := "just.env" +set dotenv-load + +setup: configure-debug configure-test-func + ln -s $PWD/build/debug/compile_commands.json $PWD + ln -s $PWD/build/test-func/compile_commands.json $PWD/tests + +clean: + rm -rf $PWD/build + rm $PWD/compile_commands.json + rm $PWD/tests/compile_commands.json + +install: build-debug + cmake: --build $PWD/build/debug --target install + +build-debug: configure-debug + cmake --build $PWD/build/debug + +build-release: configure-release + cmake --build $PWD/build/release + +build-test-unit: configure-test-unit + cmake --build $PWD/build/test-unit + +build-test-func: configure-test-func + cmake --build $PWD/build/test-func + +build-test-all: configure-test-all + cmake --build $PWD/build/test-all + +test-unit: build-test-unit + ctest --test-dir $PWD/build/test-unit + +test-func: build-test-func + ctest --test-dir $PWD/build/test-func + +test-all: build-test-all + ctest --test-dir $PWD/build/test-all + +configure-debug: + cmake -B $PWD/build/debug -S $PWD \ + -DCMAKE_INSTALL_PREFIX="$HOME/.local/" \ + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_C_COMPILER=$C_COMPILER \ + -DCMAKE_C_FLAGS="-std=c99 -Wno-error" \ + -DATSDK_BUILD_TESTS=OFF \ + -DATSDK_BUILD_UNIT_TESTS=OFF \ + -DATSDK_BUILD_FUNCTIONAL_TESTS=OFF + +configure-release: + cmake -B $PWD/build/release -S $PWD \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_C_COMPILER=$C_COMPILER \ + -DCMAKE_C_FLAGS="-std=c99 -Wno-error" \ + -DATSDK_BUILD_TESTS=OFF \ + -DATSDK_BUILD_UNIT_TESTS=OFF \ + -DATSDK_BUILD_FUNCTIONAL_TESTS=OFF + +configure-test-unit: + cmake -B $PWD/build/test-unit -S $PWD \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_C_COMPILER=$C_COMPILER \ + -DCMAKE_C_FLAGS="-std=c99 -Wno-error" \ + -DATSDK_BUILD_TESTS=OFF \ + -DATSDK_BUILD_UNIT_TESTS=ON \ + -DATSDK_BUILD_FUNCTIONAL_TESTS=OFF + +configure-test-func: + cmake -B $PWD/build/test-func -S $PWD \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_C_COMPILER=$C_COMPILER \ + -DCMAKE_C_FLAGS="-std=c99 -Wno-error" \ + -DATSDK_BUILD_TESTS=OFF \ + -DATSDK_BUILD_UNIT_TESTS=OFF \ + -DATSDK_BUILD_FUNCTIONAL_TESTS=ON \ + -DFIRST_ATSIGN="\"$FIRST_ATSIGN\"" \ + -DSECOND_ATSIGN="\"$SECOND_ATSIGN\"" + +configure-test-all: + cmake -B $PWD/build/test-all -S $PWD \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_C_COMPILER=$C_COMPILER \ + -DCMAKE_C_FLAGS="-std=c99 -Wno-error" \ + -DATSDK_BUILD_TESTS=ON \ + -DFIRST_ATSIGN="\"$FIRST_ATSIGN\"" \ + -DSECOND_ATSIGN="\"$SECOND_ATSIGN\"" + +show-env: + echo "$FIRST_ATSIGN" + echo "$SECOND_ATSIGN" + echo "$C_COMPILER"