chore: commit untracked UE/scaffold files (repo cleanup triage 20260707)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
251
scripts/build/package_build.sh
Executable file
251
scripts/build/package_build.sh
Executable file
@@ -0,0 +1,251 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Script Name: package_build.sh
|
||||
# Description: Package Dubai Metaverse project for distribution
|
||||
# Usage: ./package_build.sh [options]
|
||||
# Author: Dubai Metaverse Team
|
||||
# Date: 2024
|
||||
# Version: 1.0
|
||||
#
|
||||
# Exit codes:
|
||||
# 0: Success
|
||||
# 1: General error
|
||||
# 2: Invalid arguments
|
||||
# 3: Missing dependencies
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Configuration
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
LOG_FILE="${LOG_FILE:-$PROJECT_ROOT/logs/package_build.log}"
|
||||
|
||||
# Colors
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m'
|
||||
|
||||
# Logging
|
||||
log() {
|
||||
local level="${1:-INFO}"
|
||||
shift
|
||||
local message="$*"
|
||||
local timestamp=$(date +'%Y-%m-%d %H:%M:%S')
|
||||
echo "[$timestamp] [$level] $message" | tee -a "$LOG_FILE"
|
||||
}
|
||||
|
||||
error_exit() {
|
||||
log "ERROR" "$*"
|
||||
exit 1
|
||||
}
|
||||
|
||||
warning() {
|
||||
log "WARNING" "$*"
|
||||
}
|
||||
|
||||
success() {
|
||||
log "SUCCESS" "$*"
|
||||
}
|
||||
|
||||
# Parse arguments
|
||||
BUILD_CONFIG="Shipping"
|
||||
PLATFORM="Windows"
|
||||
OUTPUT_DIR="${PROJECT_ROOT}/Builds"
|
||||
DRY_RUN=false
|
||||
VERBOSE=false
|
||||
|
||||
usage() {
|
||||
cat << EOF
|
||||
Usage: $0 [OPTIONS]
|
||||
|
||||
Package Dubai Metaverse project for distribution.
|
||||
|
||||
Options:
|
||||
-h, --help Show this help message
|
||||
-c, --config CONFIG Build configuration (Development/Shipping) [default: Shipping]
|
||||
-p, --platform PLAT Platform (Windows/Linux) [default: Windows]
|
||||
-o, --output DIR Output directory [default: Builds/]
|
||||
-d, --dry-run Perform dry run without packaging
|
||||
-v, --verbose Enable verbose output
|
||||
|
||||
Examples:
|
||||
$0 --config Shipping --platform Windows
|
||||
$0 --dry-run
|
||||
$0 --output /path/to/output
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
parse_args() {
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
-c|--config)
|
||||
BUILD_CONFIG="$2"
|
||||
shift 2
|
||||
;;
|
||||
-p|--platform)
|
||||
PLATFORM="$2"
|
||||
shift 2
|
||||
;;
|
||||
-o|--output)
|
||||
OUTPUT_DIR="$2"
|
||||
shift 2
|
||||
;;
|
||||
-d|--dry-run)
|
||||
DRY_RUN=true
|
||||
shift
|
||||
;;
|
||||
-v|--verbose)
|
||||
VERBOSE=true
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
error_exit "Unknown option: $1. Use --help for usage."
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
# Validate prerequisites
|
||||
validate_prerequisites() {
|
||||
log "INFO" "Validating prerequisites..."
|
||||
|
||||
# Check for Unreal Engine
|
||||
if [ -z "${UE_ROOT:-}" ]; then
|
||||
if [ -d "$HOME/UnrealEngine" ]; then
|
||||
export UE_ROOT="$HOME/UnrealEngine"
|
||||
elif [ -d "/opt/UnrealEngine" ]; then
|
||||
export UE_ROOT="/opt/UnrealEngine"
|
||||
else
|
||||
error_exit "Unreal Engine not found. Set UE_ROOT environment variable or install UE5.4"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check for project file
|
||||
local project_file=$(find "$PROJECT_ROOT" -name "*.uproject" | head -1)
|
||||
if [ -z "$project_file" ]; then
|
||||
error_exit "Project file (.uproject) not found in $PROJECT_ROOT"
|
||||
fi
|
||||
|
||||
export PROJECT_FILE="$project_file"
|
||||
log "INFO" "Using project file: $PROJECT_FILE"
|
||||
log "INFO" "Using Unreal Engine: $UE_ROOT"
|
||||
}
|
||||
|
||||
# Clean build artifacts
|
||||
clean_build() {
|
||||
log "INFO" "Cleaning build artifacts..."
|
||||
|
||||
if [ "$DRY_RUN" = true ]; then
|
||||
log "INFO" "[DRY RUN] Would clean: Binaries/, Intermediate/, Saved/"
|
||||
return
|
||||
fi
|
||||
|
||||
cd "$PROJECT_ROOT"
|
||||
|
||||
# Remove build artifacts
|
||||
[ -d "Binaries" ] && rm -rf Binaries
|
||||
[ -d "Intermediate" ] && rm -rf Intermediate
|
||||
[ -d "Saved" ] && rm -rf Saved
|
||||
|
||||
success "Build artifacts cleaned"
|
||||
}
|
||||
|
||||
# Validate assets
|
||||
validate_assets() {
|
||||
log "INFO" "Validating assets..."
|
||||
|
||||
if [ "$DRY_RUN" = true ]; then
|
||||
log "INFO" "[DRY RUN] Would validate assets"
|
||||
return
|
||||
fi
|
||||
|
||||
# Run asset validation
|
||||
if [ -f "$SCRIPT_DIR/validate_assets.sh" ]; then
|
||||
"$SCRIPT_DIR/validate_assets.sh" || warning "Asset validation found issues"
|
||||
else
|
||||
warning "Asset validation script not found, skipping"
|
||||
fi
|
||||
}
|
||||
|
||||
# Package project
|
||||
package_project() {
|
||||
log "INFO" "Packaging project..."
|
||||
log "INFO" "Configuration: $BUILD_CONFIG"
|
||||
log "INFO" "Platform: $PLATFORM"
|
||||
log "INFO" "Output: $OUTPUT_DIR"
|
||||
|
||||
if [ "$DRY_RUN" = true ]; then
|
||||
log "INFO" "[DRY RUN] Would package to: $OUTPUT_DIR"
|
||||
log "INFO" "[DRY RUN] Command: UnrealEditor -run=Cook -targetplatform=$PLATFORM -project=$PROJECT_FILE"
|
||||
return
|
||||
fi
|
||||
|
||||
# Create output directory
|
||||
mkdir -p "$OUTPUT_DIR"
|
||||
|
||||
# Determine UnrealEditor path
|
||||
local editor_path
|
||||
if [ "$PLATFORM" = "Windows" ]; then
|
||||
editor_path="$UE_ROOT/Engine/Binaries/Win64/UnrealEditor.exe"
|
||||
else
|
||||
editor_path="$UE_ROOT/Engine/Binaries/Linux/UnrealEditor"
|
||||
fi
|
||||
|
||||
if [ ! -f "$editor_path" ]; then
|
||||
error_exit "UnrealEditor not found at: $editor_path"
|
||||
fi
|
||||
|
||||
log "INFO" "Starting packaging process..."
|
||||
log "INFO" "This may take 30-60 minutes depending on project size..."
|
||||
|
||||
# Package using UnrealEditor command line
|
||||
# Note: This is a simplified version. Full implementation would use
|
||||
# UnrealEditor's packaging system with proper parameters
|
||||
|
||||
log "WARNING" "Full packaging implementation requires Unreal Editor command line"
|
||||
log "INFO" "For now, use Unreal Editor GUI: File > Package Project"
|
||||
log "INFO" "Or use Unreal Automation Tool (UAT) for advanced packaging"
|
||||
|
||||
# Placeholder for actual packaging command
|
||||
# "$editor_path" "$PROJECT_FILE" -run=Cook -targetplatform="$PLATFORM" -project="$PROJECT_FILE" || error_exit "Packaging failed"
|
||||
|
||||
success "Packaging complete (placeholder - use Unreal Editor GUI for actual packaging)"
|
||||
}
|
||||
|
||||
# Main function
|
||||
main() {
|
||||
log "INFO" "Starting package_build.sh"
|
||||
|
||||
# Create log directory
|
||||
mkdir -p "$(dirname "$LOG_FILE")"
|
||||
|
||||
# Parse arguments
|
||||
parse_args "$@"
|
||||
|
||||
# Validate prerequisites
|
||||
validate_prerequisites
|
||||
|
||||
# Clean build
|
||||
clean_build
|
||||
|
||||
# Validate assets
|
||||
validate_assets
|
||||
|
||||
# Package project
|
||||
package_project
|
||||
|
||||
success "Build packaging process complete"
|
||||
log "INFO" "Output directory: $OUTPUT_DIR"
|
||||
log "INFO" "Log file: $LOG_FILE"
|
||||
}
|
||||
|
||||
# Run main if executed directly
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
main "$@"
|
||||
fi
|
||||
295
scripts/build/setup_pixel_streaming.sh
Executable file
295
scripts/build/setup_pixel_streaming.sh
Executable file
@@ -0,0 +1,295 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Script Name: setup_pixel_streaming.sh
|
||||
# Description: Set up Pixel Streaming for Dubai Metaverse project
|
||||
# Usage: ./setup_pixel_streaming.sh [options]
|
||||
# Author: Dubai Metaverse Team
|
||||
# Date: 2024
|
||||
# Version: 1.0
|
||||
#
|
||||
# Exit codes:
|
||||
# 0: Success
|
||||
# 1: General error
|
||||
# 2: Invalid arguments
|
||||
# 3: Missing dependencies
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Configuration
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
LOG_FILE="${LOG_FILE:-$PROJECT_ROOT/logs/setup_pixel_streaming.log}"
|
||||
|
||||
# Colors
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m'
|
||||
|
||||
# Logging
|
||||
log() {
|
||||
local level="${1:-INFO}"
|
||||
shift
|
||||
local message="$*"
|
||||
local timestamp=$(date +'%Y-%m-%d %H:%M:%S')
|
||||
echo "[$timestamp] [$level] $message" | tee -a "$LOG_FILE"
|
||||
}
|
||||
|
||||
error_exit() {
|
||||
log "ERROR" "$*"
|
||||
exit 1
|
||||
}
|
||||
|
||||
warning() {
|
||||
log "WARNING" "$*"
|
||||
}
|
||||
|
||||
success() {
|
||||
log "SUCCESS" "$*"
|
||||
}
|
||||
|
||||
# Parse arguments
|
||||
PORT=8888
|
||||
SIGNALING_SERVER_PORT=8888
|
||||
DRY_RUN=false
|
||||
VERBOSE=false
|
||||
|
||||
usage() {
|
||||
cat << EOF
|
||||
Usage: $0 [OPTIONS]
|
||||
|
||||
Set up Pixel Streaming for Dubai Metaverse project.
|
||||
|
||||
Options:
|
||||
-h, --help Show this help message
|
||||
-p, --port PORT Streaming port [default: 8888]
|
||||
-s, --signaling PORT Signaling server port [default: 8888]
|
||||
-d, --dry-run Perform dry run without making changes
|
||||
-v, --verbose Enable verbose output
|
||||
|
||||
Examples:
|
||||
$0 --port 8888
|
||||
$0 --dry-run
|
||||
$0 --port 8080 --signaling 8081
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
parse_args() {
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
-p|--port)
|
||||
PORT="$2"
|
||||
shift 2
|
||||
;;
|
||||
-s|--signaling)
|
||||
SIGNALING_SERVER_PORT="$2"
|
||||
shift 2
|
||||
;;
|
||||
-d|--dry-run)
|
||||
DRY_RUN=true
|
||||
shift
|
||||
;;
|
||||
-v|--verbose)
|
||||
VERBOSE=true
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
error_exit "Unknown option: $1. Use --help for usage."
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
# Validate prerequisites
|
||||
validate_prerequisites() {
|
||||
log "INFO" "Validating prerequisites..."
|
||||
|
||||
# Check for Node.js (required for signaling server)
|
||||
if ! command -v node &> /dev/null; then
|
||||
warning "Node.js not found. Pixel Streaming signaling server requires Node.js"
|
||||
warning "Install Node.js: https://nodejs.org/"
|
||||
else
|
||||
local node_version=$(node --version)
|
||||
log "INFO" "Node.js version: $node_version"
|
||||
fi
|
||||
|
||||
# Check for Unreal Engine
|
||||
if [ -z "${UE_ROOT:-}" ]; then
|
||||
if [ -d "$HOME/UnrealEngine" ]; then
|
||||
export UE_ROOT="$HOME/UnrealEngine"
|
||||
elif [ -d "/opt/UnrealEngine" ]; then
|
||||
export UE_ROOT="/opt/UnrealEngine"
|
||||
else
|
||||
error_exit "Unreal Engine not found. Set UE_ROOT environment variable"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check for Pixel Streaming plugin
|
||||
local ps_plugin="$UE_ROOT/Engine/Plugins/Media/PixelStreaming"
|
||||
if [ ! -d "$ps_plugin" ]; then
|
||||
warning "Pixel Streaming plugin not found at: $ps_plugin"
|
||||
warning "Pixel Streaming is included with UE5.4, verify installation"
|
||||
else
|
||||
log "INFO" "Pixel Streaming plugin found"
|
||||
fi
|
||||
|
||||
# Check for project file
|
||||
local project_file=$(find "$PROJECT_ROOT" -name "*.uproject" | head -1)
|
||||
if [ -z "$project_file" ]; then
|
||||
error_exit "Project file (.uproject) not found in $PROJECT_ROOT"
|
||||
fi
|
||||
|
||||
export PROJECT_FILE="$project_file"
|
||||
log "INFO" "Using project file: $PROJECT_FILE"
|
||||
}
|
||||
|
||||
# Enable Pixel Streaming plugin
|
||||
enable_plugin() {
|
||||
log "INFO" "Enabling Pixel Streaming plugin..."
|
||||
|
||||
if [ "$DRY_RUN" = true ]; then
|
||||
log "INFO" "[DRY RUN] Would enable Pixel Streaming plugin in project"
|
||||
return
|
||||
fi
|
||||
|
||||
# Note: Plugin should be enabled in .uproject file
|
||||
# This script provides instructions
|
||||
log "INFO" "Ensure Pixel Streaming plugin is enabled in $PROJECT_FILE"
|
||||
log "INFO" "Add to Plugins array if not present:"
|
||||
log "INFO" ' { "Name": "PixelStreaming", "Enabled": true }'
|
||||
}
|
||||
|
||||
# Configure project settings
|
||||
configure_settings() {
|
||||
log "INFO" "Configuring Pixel Streaming settings..."
|
||||
|
||||
if [ "$DRY_RUN" = true ]; then
|
||||
log "INFO" "[DRY RUN] Would configure Pixel Streaming settings"
|
||||
return
|
||||
fi
|
||||
|
||||
log "INFO" "Configure Pixel Streaming in Project Settings:"
|
||||
log "INFO" " Edit > Project Settings > Plugins > Pixel Streaming"
|
||||
log "INFO" " - Enable Pixel Streaming"
|
||||
log "INFO" " - Set Streaming Port: $PORT"
|
||||
log "INFO" " - Configure encoder settings"
|
||||
}
|
||||
|
||||
# Setup signaling server
|
||||
setup_signaling_server() {
|
||||
log "INFO" "Setting up Pixel Streaming signaling server..."
|
||||
|
||||
local signaling_dir="$PROJECT_ROOT/PixelStreamingSignalingServer"
|
||||
|
||||
if [ "$DRY_RUN" = true ]; then
|
||||
log "INFO" "[DRY RUN] Would set up signaling server in: $signaling_dir"
|
||||
return
|
||||
fi
|
||||
|
||||
# Check if Node.js is available
|
||||
if ! command -v node &> /dev/null; then
|
||||
warning "Node.js not found. Cannot set up signaling server automatically"
|
||||
warning "Install Node.js and run setup manually"
|
||||
return
|
||||
fi
|
||||
|
||||
# Copy signaling server from UE5
|
||||
local ue_signaling="$UE_ROOT/Engine/Source/Programs/PixelStreamingInfrastructure"
|
||||
if [ -d "$ue_signaling" ]; then
|
||||
log "INFO" "Copying signaling server files..."
|
||||
mkdir -p "$signaling_dir"
|
||||
cp -r "$ue_signaling"/* "$signaling_dir/" 2>/dev/null || warning "Could not copy signaling server files"
|
||||
|
||||
# Install dependencies if package.json exists
|
||||
if [ -f "$signaling_dir/package.json" ]; then
|
||||
log "INFO" "Installing signaling server dependencies..."
|
||||
cd "$signaling_dir"
|
||||
npm install || warning "Failed to install dependencies"
|
||||
fi
|
||||
else
|
||||
warning "Signaling server source not found at: $ue_signaling"
|
||||
warning "Use Unreal Engine's built-in signaling server or set up manually"
|
||||
fi
|
||||
}
|
||||
|
||||
# Create startup script
|
||||
create_startup_script() {
|
||||
log "INFO" "Creating startup script..."
|
||||
|
||||
local script_path="$PROJECT_ROOT/start_pixel_streaming.sh"
|
||||
|
||||
if [ "$DRY_RUN" = true ]; then
|
||||
log "INFO" "[DRY RUN] Would create startup script: $script_path"
|
||||
return
|
||||
fi
|
||||
|
||||
cat > "$script_path" << 'EOF'
|
||||
#!/bin/bash
|
||||
# Pixel Streaming Startup Script
|
||||
|
||||
UE_ROOT="${UE_ROOT:-$HOME/UnrealEngine}"
|
||||
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_FILE=$(find "$PROJECT_ROOT" -name "*.uproject" | head -1)
|
||||
PORT="${PORT:-8888}"
|
||||
|
||||
echo "Starting Pixel Streaming..."
|
||||
echo "Project: $PROJECT_FILE"
|
||||
echo "Port: $PORT"
|
||||
|
||||
# Start Unreal Editor with Pixel Streaming
|
||||
"$UE_ROOT/Engine/Binaries/Linux/UnrealEditor" "$PROJECT_FILE" \
|
||||
-AudioMixer \
|
||||
-PixelStreamingIP=0.0.0.0 \
|
||||
-PixelStreamingPort=$PORT \
|
||||
-game \
|
||||
-log
|
||||
|
||||
EOF
|
||||
|
||||
chmod +x "$script_path"
|
||||
success "Startup script created: $script_path"
|
||||
}
|
||||
|
||||
# Main function
|
||||
main() {
|
||||
log "INFO" "Starting setup_pixel_streaming.sh"
|
||||
|
||||
# Create log directory
|
||||
mkdir -p "$(dirname "$LOG_FILE")"
|
||||
|
||||
# Parse arguments
|
||||
parse_args "$@"
|
||||
|
||||
# Validate prerequisites
|
||||
validate_prerequisites
|
||||
|
||||
# Enable plugin
|
||||
enable_plugin
|
||||
|
||||
# Configure settings
|
||||
configure_settings
|
||||
|
||||
# Setup signaling server
|
||||
setup_signaling_server
|
||||
|
||||
# Create startup script
|
||||
create_startup_script
|
||||
|
||||
success "Pixel Streaming setup complete"
|
||||
log "INFO" "Next steps:"
|
||||
log "INFO" " 1. Configure Pixel Streaming in Project Settings"
|
||||
log "INFO" " 2. Start signaling server: cd PixelStreamingSignalingServer && npm start"
|
||||
log "INFO" " 3. Launch project with Pixel Streaming: ./start_pixel_streaming.sh"
|
||||
log "INFO" " 4. Access via browser: http://localhost:$PORT"
|
||||
log "INFO" "See docs/PIXEL_STREAMING.md for detailed instructions"
|
||||
}
|
||||
|
||||
# Run main if executed directly
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
main "$@"
|
||||
fi
|
||||
Reference in New Issue
Block a user