From c9ff9a13735010a6d3937a05e8ce9f00f9fab3ac Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Mon, 9 Mar 2026 22:45:24 +0800 Subject: Add GTK GUI build system for Unix platforms --- gui/gtk/cbuild.sh | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100755 gui/gtk/cbuild.sh (limited to 'gui/gtk/cbuild.sh') 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 $? -- cgit