diff --git a/compile.sh b/compile.sh old mode 100644 new mode 100755 index 2151319..d993528 --- a/compile.sh +++ b/compile.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash ############################################################### # File: compile.sh # Creation Date: 10/11/2022 (DD/MM/YYYY) @@ -9,26 +9,33 @@ # Copyright: LNH team (c) 2022, all rights reserved ################################################################ +set -euo pipefail +# change directory to the one containing the source code project +cd "$(dirname "$(realpath "$0")")" + +# check available CMake version echo "[>] Configuring project with CMake.." # Clean previous build/ folders if they exist -rm -rf build/ -mkdir build - -# Export the SDK Path before running CMAKE -export PICO_SDK_PATH=../pico-sdk +rm -rf build/ || true +mkdir -p build # Specify CMAKE where we want the build tree to be at. # In our case, the build/ directory. # The source directory will be . (the current directory, # where the CMakeLists.txt is located). -cmake -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo -B build/ . +PICO_SDK_PATH=../pico-sdk \ +CMAKE_POLICY_VERSION_MINIMUM=3.5 \ + cmake -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \ + -B build/ . echo "[>] Building FIRMWARE: " # Go and build the firmware -cd build -make +PICO_SDK_PATH=../pico-sdk \ +CMAKE_POLICY_VERSION_MINIMUM=3.5 \ +CMAKE_BUILD_PARALLEL_LEVEL="$(nproc)" \ + cmake --build build echo "[>] Build completed. Find the DSpico.uf2 file inside build/ folder"