blob: ae8503015828f303e81407dc4eb44b4f110ad327 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
#!/bin/bash
# This file is part of the 64k demo project.
# Builds the final production binary with all stripping enabled.
# Usage: ./scripts/build_final.sh
set -e # Exit on error
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
BUILD_DIR="$PROJECT_ROOT/build_final"
echo "========================================"
echo " Building FINAL Production Binary"
echo "========================================"
echo ""
echo "This build uses:"
echo " - DEMO_FINAL_STRIP=ON (removes ALL error checking)"
echo " - DEMO_STRIP_ALL=ON (removes debug features)"
echo " - DEMO_SIZE_OPT=ON (maximum size optimization)"
echo ""
# Clean previous final build
if [ -d "$BUILD_DIR" ]; then
echo "Cleaning previous final build..."
rm -rf "$BUILD_DIR"
fi
# Create fresh build directory
mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR"
# Configure with FINAL_STRIP
echo "Configuring with FINAL_STRIP..."
cmake "$PROJECT_ROOT" \
-DDEMO_FINAL_STRIP=ON \
-DDEMO_SIZE_OPT=ON \
-DCMAKE_BUILD_TYPE=Release
# Build demo64k
echo ""
echo "Building demo64k..."
cmake --build . --target demo64k -j8
# Show result
echo ""
echo "========================================"
echo " Final Build Complete!"
echo "========================================"
echo ""
echo "Binary location:"
ls -lh "$BUILD_DIR/demo64k"
echo ""
# Optional: Compare with stripped build (if exists)
STRIP_BUILD="$PROJECT_ROOT/build_strip"
if [ -f "$STRIP_BUILD/demo64k" ]; then
FINAL_SIZE=$(stat -f%z "$BUILD_DIR/demo64k" 2>/dev/null || stat -c%s "$BUILD_DIR/demo64k")
STRIP_SIZE=$(stat -f%z "$STRIP_BUILD/demo64k" 2>/dev/null || stat -c%s "$STRIP_BUILD/demo64k")
SAVED=$((STRIP_SIZE - FINAL_SIZE))
echo "Size comparison:"
echo " STRIP_ALL build: $STRIP_SIZE bytes"
echo " FINAL_STRIP build: $FINAL_SIZE bytes"
echo " Saved: $SAVED bytes"
echo ""
fi
echo "To run: $BUILD_DIR/demo64k"
echo ""
echo "⚠️ WARNING: This build has NO error checking!"
echo " Use only for final release, not for development/testing."
|