default: build_and_run

alias c := config
alias b := build
alias r := run
alias br := build_and_run
alias cln := clean
alias v := valgrind

run:
    @echo Running ${BINARY_NAME}
    @./build/${BINARY_NAME}

build:
     time cmake --build build --config ${BUILD_TYPE}

build_and_run: build
    just run

clean:
    rm build -rf

config:
    conan install . --output-folder=build --build=missing -s build_type=${BUILD_TYPE}
    @echo Configuring project with build type: ${BUILD_TYPE}
    cmake -S . -G Ninja -B build \
        -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
        -DCMAKE_EXPORT_COMPILE_COMMANDS=${COMPILE_COMMANDS} \
        -DCMAKE_TOOLCHAIN_FILE=build/conan_toolchain.cmake
#        ; cp build/compile_commands.json .

valgrind: build
    valgrind --track-origins=yes ./build/${BINARY_NAME}
