2022-03-06 20:53:27 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Variables
|
2023-11-24 23:37:08 +00:00
|
|
|
MODE="$(echo "$1" | tr '[:upper:]' '[:lower:]')"
|
|
|
|
ARCH="$(echo "$2" | tr '[:upper:]' '[:lower:]')"
|
2022-03-06 20:53:27 +00:00
|
|
|
shift 2
|
|
|
|
|
|
|
|
# Verify Mode
|
|
|
|
if [ "${MODE}" != "client" ] && [ "${MODE}" != "server" ]; then
|
|
|
|
echo "Invalid Mode: ${MODE}" > /dev/stderr
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2023-12-26 22:45:53 +00:00
|
|
|
# Find Toolchain
|
|
|
|
toolchain_file="$(pwd)/cmake/toolchain/${ARCH}-toolchain.cmake"
|
|
|
|
if [ ! -f "${toolchain_file}" ]; then
|
|
|
|
echo "Invalid Architecture: ${ARCH}" > /dev/stderr
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Create Build Dir
|
|
|
|
rm -rf "build/${MODE}-${ARCH}"
|
|
|
|
mkdir -p "build/${MODE}-${ARCH}"
|
|
|
|
cd "build/${MODE}-${ARCH}"
|
|
|
|
|
|
|
|
# Server Build
|
|
|
|
server_mode='OFF'
|
|
|
|
if [ "${MODE}" = "server" ]; then
|
|
|
|
server_mode='ON'
|
|
|
|
fi
|
2024-01-16 06:45:52 +00:00
|
|
|
|
|
|
|
# Build Components
|
|
|
|
cmake -GNinja -DCMAKE_TOOLCHAIN_FILE="${toolchain_file}" -DMCPI_SERVER_MODE="${server_mode}" "$@" ../../
|
2023-12-26 22:45:53 +00:00
|
|
|
|
|
|
|
# Exit
|
|
|
|
cd ../../
|