Using CMake template
This commit is contained in:
1 parent
e878bdaf5a
commit
fe6a77de83
47 files changed
+5357
-2192
No files matched your search
+26
-4
@@ -1,5 +1,27 @@
|
||||
mkdir -p build
|
||||
cd build
|
||||
#!/usr/bin/env bash
|
||||
# Configure (if needed) and build the project with Ninja.
|
||||
#
|
||||
# Usage (from the project root):
|
||||
# scripts/build.sh [BUILD_TYPE]
|
||||
#
|
||||
# BUILD_TYPE Debug|Release|RelWithDebInfo|MinSizeRel (default: Release)
|
||||
#
|
||||
# Set BUILD_DIR to build somewhere other than out/build (see Configuration.cmake).
|
||||
set -euo pipefail
|
||||
|
||||
cmake ..
|
||||
cmake --build .
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
cd "$SCRIPT_DIR/.."
|
||||
|
||||
BUILD_DIR="${BUILD_DIR:-out/build}"
|
||||
BUILD_TYPE="${1:-Release}"
|
||||
|
||||
command -v cmake >/dev/null 2>&1 || { echo "error: cmake not found on PATH." >&2; exit 1; }
|
||||
command -v ninja >/dev/null 2>&1 || { echo "error: ninja not found on PATH." >&2; exit 1; }
|
||||
|
||||
echo "==> Configuring (${BUILD_TYPE}) into ${BUILD_DIR}/"
|
||||
cmake -G Ninja -S . -B "${BUILD_DIR}" -DCMAKE_BUILD_TYPE="${BUILD_TYPE}"
|
||||
|
||||
echo "==> Building"
|
||||
cmake --build "${BUILD_DIR}"
|
||||
|
||||
echo "==> Done. Run a module with: scripts/run.sh <target-name>"
|
||||
Reference in new issue
Block a user