summaryrefslogtreecommitdiff
path: root/gui/gtk/scripts/_entry.sh
diff options
context:
space:
mode:
Diffstat (limited to 'gui/gtk/scripts/_entry.sh')
-rwxr-xr-xgui/gtk/scripts/_entry.sh90
1 files changed, 90 insertions, 0 deletions
diff --git a/gui/gtk/scripts/_entry.sh b/gui/gtk/scripts/_entry.sh
new file mode 100755
index 0000000..a80788e
--- /dev/null
+++ b/gui/gtk/scripts/_entry.sh
@@ -0,0 +1,90 @@
+#!/bin/bash
+
+# Butchunker GTK Entry Script
+# This script sets up the environment and generates .clangd configuration
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
+
+# Get GTK include paths
+GTK_INCLUDE_PATHS=""
+if pkg-config --exists gtk+-3.0; then
+ # Get include paths from pkg-config and split them
+ GTK_INCLUDE_PATHS=$(pkg-config --cflags-only-I gtk+-3.0)
+fi
+
+# Get Rust library include path
+RUST_INCLUDE_PATH="$PROJECT_ROOT/../../.temp/target/release"
+
+# Generate .clangd configuration file
+CLANGD_CONTENT="CompileFlags:
+ CompilationDatabase: build/
+ Add:
+ - -I\${workspaceFolder}/include"
+
+# Add GTK include paths
+if [ -n "$GTK_INCLUDE_PATHS" ]; then
+ # Process each -I flag separately
+ for flag in $GTK_INCLUDE_PATHS; do
+ if [[ "$flag" == -I* ]]; then
+ path="${flag#-I}"
+ CLANGD_CONTENT="$CLANGD_CONTENT
+ - -I$path"
+ fi
+ done
+fi
+
+# Add Rust include path
+CLANGD_CONTENT="$CLANGD_CONTENT
+ - -I\${workspaceFolder}/../../.temp/target/release
+ Remove: []
+
+Diagnostics:
+ ClangTidy:
+ Add:
+ - \"*\"
+ Remove:
+ - modernize-use-trailing-return-type
+ UnusedIncludes: Strict
+
+Index:
+ Background: Build
+"
+
+# Write .clangd file
+CLANGD_PATH="$PROJECT_ROOT/.clangd"
+echo "$CLANGD_CONTENT" > "$CLANGD_PATH"
+echo "Generated .clangd configuration at: $CLANGD_PATH"
+
+# Source common functions if exists
+if [ -f "$SCRIPT_DIR/_common.sh" ]; then
+ source "$SCRIPT_DIR/_common.sh"
+fi
+
+# Default action
+ACTION="${1:-help}"
+
+case "$ACTION" in
+ "build")
+ echo "Building Butchunker GTK..."
+ "$SCRIPT_DIR/build.sh"
+ ;;
+ "clean")
+ echo "Cleaning Butchunker GTK..."
+ "$SCRIPT_DIR/clean.sh"
+ ;;
+ "run")
+ echo "Running Butchunker GTK..."
+ "$SCRIPT_DIR/run.sh"
+ ;;
+ "help"|*)
+ echo "Butchunker GTK Build System"
+ echo "Usage: $0 [build|clean|run]"
+ echo ""
+ echo "Commands:"
+ echo " build - Build the project"
+ echo " clean - Clean build directory"
+ echo " run - Run the application"
+ exit 0
+ ;;
+esac