#!/bin/bash # Development Environment Setup Script # This script sets up the build environment for both local and container development set -e # Exit on any error # Change to project root directory cd "$(dirname "$0")/.." || exit 1 echo "๐Ÿš€ Setting up webserv development environment..." # Detect environment if [ "$(whoami)" = "vscode" ]; then BUILD_DIR="build-container" ENVIRONMENT="Dev Container" else BUILD_DIR="build-local" ENVIRONMENT="Local" fi echo "๐Ÿ“ Environment detected: $ENVIRONMENT" echo "๐Ÿ”ง Using build directory: $BUILD_DIR" # Clean old build directories if they exist echo "๐Ÿงน Cleaning old build artifacts..." rm -rf build build-* 2>/dev/null || true # Create fresh build directory echo "๐Ÿ“ Creating build directory: $BUILD_DIR" cmake -B "$BUILD_DIR" \ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ -DCMAKE_BUILD_TYPE=Release # Create symlink for compile_commands.json at workspace root for clangd if [ -f "$BUILD_DIR/compile_commands.json" ]; then echo "๐Ÿ”— Creating compile_commands.json symlink for clangd..." ln -sf "$BUILD_DIR/compile_commands.json" compile_commands.json fi echo "โœ… Environment setup complete!" echo "" echo "Next steps:" echo " โ€ข Run 'make all' to build the project" echo " โ€ข Run 'make run' to start the server" echo " โ€ข Use VS Code tasks (Ctrl+Shift+P > Tasks: Run Task) for build operations"