Files
CSE4303H2/compile.sh
2026-02-16 12:26:36 -06:00

30 lines
709 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
mkdir -p bin
# add libssl-dev if needed
# apt-get update && apt-get install -y --no-install-recommends libssl-dev
# Adjust flags as you like
CXXFLAGS="-std=c++17 -O2 -Wall -Wextra -pedantic"
OPENSSL_LIBS="-lssl -lcrypto"
g++ ${CXXFLAGS} server.cpp -o bin/server ${OPENSSL_LIBS}
g++ ${CXXFLAGS} client.cpp -o bin/client ${OPENSSL_LIBS}
echo "Built:"
file bin/server bin/client || true
chmod a+x bin/server bin/client
# stop the containers and free up network resources
docker compose down --remove-orphans || true
docker network rm net-hw2 >/dev/null 2>&1 || true
# start the containers
docker compose up -d server
docker compose run --rm -it client
echo "Done."