Skip to content

Commit

Permalink
Merge pull request #483 from atsign-foundation/justfile
Browse files Browse the repository at this point in the history
chore: add justfile
  • Loading branch information
XavierChanth authored Dec 23, 2024
2 parents 28bd78b + daa0141 commit 3509124
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.DS_Store

just.env

CMakeFiles/
CMakeCache.txt
CMakeFiles
Expand Down
3 changes: 3 additions & 0 deletions just.template.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FIRST_ATSIGN=""
SECOND_ATSIGN=""
C_COMPILER=gcc
97 changes: 97 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 3509124

Please sign in to comment.