mono-cpp/install-lnx.sh
2026-03-28 13:11:29 +01:00

61 lines
2.8 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
# ─────────────────────────────────────────────────────────────────────────────
# install-lnx.sh Install build dependencies for polymech-cli on Linux
#
# Tested on: Ubuntu 20.04+ / Debian 11+
# Usage: sudo bash install-lnx.sh
# ─────────────────────────────────────────────────────────────────────────────
set -euo pipefail
echo "── polymech-cli Linux dependency installer ──"
# ── 1. System packages (apt) ─────────────────────────────────────────────────
echo ""
echo "[1/3] Installing system packages via apt …"
apt-get update -qq
apt-get install -y --no-install-recommends \
build-essential \
gcc \
g++ \
git \
libssl-dev \
pkg-config \
snapd
# ── 2. CMake ≥ 3.20 via snap ────────────────────────────────────────────────
# The project requires cmake_minimum_required(VERSION 3.20).
# Ubuntu 20.04 ships cmake 3.16, so we use the snap package instead.
echo ""
echo "[2/3] Installing CMake via snap (≥ 3.20 required) …"
if command -v /snap/bin/cmake &>/dev/null; then
echo " cmake snap already installed: $(/snap/bin/cmake --version | head -1)"
else
snap install cmake --classic
echo " Installed: $(/snap/bin/cmake --version | head -1)"
fi
# ── 3. Node.js (for npm run build:linux) ──────────────────────────────────────
echo ""
echo "[3/3] Checking for Node.js / npm …"
if command -v node &>/dev/null; then
echo " node $(node --version) already installed"
else
echo " Node.js not found. Install via nvm or nodesource, e.g.:"
echo " curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -"
echo " sudo apt-get install -y nodejs"
fi
# ── Summary ──────────────────────────────────────────────────────────────────
echo ""
echo "── Done! ──"
echo ""
echo "All C++ dependencies (CLI11, tomlplusplus, Catch2, asio, concurrentqueue,"
echo "taskflow, curl, lexbor, rapidjson) are fetched automatically by CMake"
echo "FetchContent at build time — no manual installation needed."
echo ""
echo "To build:"
echo " cd $(dirname "$0")"
echo " npm run build:linux"
echo ""
echo "The binary will be placed in: dist/polymech-cli"