feat(setup): add setup script for development environment and build directory management
This commit is contained in:
parent
a279e92408
commit
169bcf96c4
@ -15,7 +15,6 @@
|
|||||||
"usernamehw.errorlens",
|
"usernamehw.errorlens",
|
||||||
"llvm-vs-code-extensions.vscode-clangd",
|
"llvm-vs-code-extensions.vscode-clangd",
|
||||||
"ms-vscode.hexeditor",
|
"ms-vscode.hexeditor",
|
||||||
"eamodio.gitlens",
|
|
||||||
"ms-vscode-remote.remote-containers"
|
"ms-vscode-remote.remote-containers"
|
||||||
],
|
],
|
||||||
|
|
||||||
@ -37,7 +36,13 @@
|
|||||||
"files.associations": {
|
"files.associations": {
|
||||||
"*.hpp": "cpp",
|
"*.hpp": "cpp",
|
||||||
"*.tpp": "cpp"
|
"*.tpp": "cpp"
|
||||||
|
},
|
||||||
|
"vscode" : {
|
||||||
|
"settings" : {
|
||||||
|
"remote.SSH.forwardAgent": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -68,7 +73,11 @@
|
|||||||
// Container features
|
// Container features
|
||||||
"features": {
|
"features": {
|
||||||
"ghcr.io/devcontainers/features/git:1": {},
|
"ghcr.io/devcontainers/features/git:1": {},
|
||||||
"ghcr.io/devcontainers/features/github-cli:1": {}
|
"ghcr.io/devcontainers/features/github-cli:1": {},
|
||||||
|
"ghcr.io/devcontainers/features/sshd:1": {
|
||||||
|
"version": "latest",
|
||||||
|
"forwardPorts": [22]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// Mount points for better performance
|
// Mount points for better performance
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,5 +1,7 @@
|
|||||||
*.o
|
*.o
|
||||||
*.a
|
*.a
|
||||||
build
|
build
|
||||||
|
build-*
|
||||||
.cache
|
.cache
|
||||||
webserv.log
|
webserv.log
|
||||||
|
compile_commands.json
|
||||||
|
|||||||
8
.vscode/tasks.json
vendored
8
.vscode/tasks.json
vendored
@ -118,6 +118,14 @@
|
|||||||
"args": ["re"],
|
"args": ["re"],
|
||||||
"group": "build",
|
"group": "build",
|
||||||
"detail": "Full clean and rebuild"
|
"detail": "Full clean and rebuild"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Clean All Environments",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "rm",
|
||||||
|
"args": ["-rf", "build", "build-*"],
|
||||||
|
"group": "build",
|
||||||
|
"detail": "Clean build directories from all environments"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
8
Makefile
8
Makefile
@ -1,5 +1,11 @@
|
|||||||
# Variables
|
# Variables
|
||||||
BUILD_DIR = build
|
# Detect if we're in a dev container or local development
|
||||||
|
ifeq ($(shell whoami),vscode)
|
||||||
|
BUILD_DIR = build-container
|
||||||
|
else
|
||||||
|
BUILD_DIR = build-local
|
||||||
|
endif
|
||||||
|
|
||||||
CMAKE = cmake
|
CMAKE = cmake
|
||||||
CMAKE_BUILD = cmake --build
|
CMAKE_BUILD = cmake --build
|
||||||
CMAKE_FLAGS = -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
|
CMAKE_FLAGS = -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
|
||||||
|
|||||||
43
setup.sh
Executable file
43
setup.sh
Executable file
@ -0,0 +1,43 @@
|
|||||||
|
#!/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
|
||||||
|
|
||||||
|
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"
|
||||||
Loading…
Reference in New Issue
Block a user