summaryrefslogtreecommitdiff
path: root/gui/gtk/cbuild.sh
diff options
context:
space:
mode:
Diffstat (limited to 'gui/gtk/cbuild.sh')
-rwxr-xr-xgui/gtk/cbuild.sh90
1 files changed, 90 insertions, 0 deletions
diff --git a/gui/gtk/cbuild.sh b/gui/gtk/cbuild.sh
new file mode 100755
index 0000000..cf3aeaf
--- /dev/null
+++ b/gui/gtk/cbuild.sh
@@ -0,0 +1,90 @@
+#!/bin/bash
+
+# Butchunker GTK Build Script
+# Usage: ./cbuild.sh [build|clean|run|rebuild|env]
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+BUILD_DIR="$SCRIPT_DIR/build"
+
+function setup_environment() {
+ echo "Setting up environment and generating .clangd configuration..."
+ "$SCRIPT_DIR/scripts/_entry.sh"
+}
+
+function build_project() {
+ echo "Building Butchunker GTK..."
+
+ # Setup environment first
+ setup_environment
+
+ # Create build directory if it doesn't exist
+ mkdir -p "$BUILD_DIR"
+
+ # Run CMake and make
+ cd "$BUILD_DIR"
+ if cmake .. && make; then
+ echo "Build successful!"
+ return 0
+ else
+ echo "Build failed!"
+ return 1
+ fi
+}
+
+function clean_project() {
+ echo "Cleaning build directory..."
+ rm -rf "$BUILD_DIR"
+ echo "Clean complete!"
+}
+
+function run_project() {
+ echo "Running Butchunker GTK..."
+
+ # Setup environment first
+ setup_environment
+
+ # Check if executable exists
+ if [ -f "$BUILD_DIR/bin/butckg" ]; then
+ "$BUILD_DIR/bin/butckg"
+ else
+ echo "Error: Executable not found. Run './cbuild.sh build' first."
+ return 1
+ fi
+}
+
+function rebuild_project() {
+ clean_project
+ build_project
+}
+
+# Main script logic
+case "${1:-}" in
+ "build")
+ build_project
+ ;;
+ "clean")
+ clean_project
+ ;;
+ "run")
+ run_project
+ ;;
+ "rebuild")
+ rebuild_project
+ ;;
+ "env")
+ setup_environment
+ ;;
+ *)
+ echo "Usage: $0 [build|clean|run|rebuild|env]"
+ echo ""
+ echo "Commands:"
+ echo " build - Build the project"
+ echo " clean - Clean build directory"
+ echo " run - Build and run the project"
+ echo " rebuild - Clean and rebuild the project"
+ echo " env - Setup environment and generate .clangd config"
+ exit 1
+ ;;
+esac
+
+exit $?