-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·90 lines (80 loc) · 2.57 KB
/
build.sh
File metadata and controls
executable file
·90 lines (80 loc) · 2.57 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/bash
set -e
# ============================================================================
# MUSA Plugin Build Script
# Usage:
# ./build.sh [release|debug]
#
# Examples:
# ./build.sh # Default: release mode
# ./build.sh release # Release mode (optimized)
# ./build.sh debug # Debug mode (kernel timing enabled)
# ============================================================================
# Parse build type from command line argument
BUILD_TYPE="${1:-release}"
BUILD_TYPE=$(echo "$BUILD_TYPE" | tr '[:upper:]' '[:lower:]')
case "$BUILD_TYPE" in
release)
CMAKE_BUILD_TYPE="Release"
MUSA_KERNEL_DEBUG="OFF"
echo "=========================================="
echo "Building MUSA Plugin - RELEASE Mode"
echo "=========================================="
echo "Features:"
echo " • Optimized for performance (-O3)"
echo " • No debug overhead"
echo ""
;;
debug)
CMAKE_BUILD_TYPE="Debug"
MUSA_KERNEL_DEBUG="ON"
echo "=========================================="
echo "Building MUSA Plugin - DEBUG Mode"
echo "=========================================="
echo "Features:"
echo " • Kernel timing instrumentation enabled"
echo " • Use env vars MUSA_TIMING_KERNEL_* to control output"
echo ""
;;
*)
echo "Error: Unknown build type '$BUILD_TYPE'"
echo "Usage: ./build.sh [release|debug]"
echo ""
echo "Options:"
echo " release - Optimized release build (default)"
echo " debug - Enable MUSA kernel debug/timing macros"
exit 1
;;
esac
# Clean previous build if needed
# rm -rf build
mkdir -p build
cd build
echo "Configuring with CMake..."
echo " CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE"
echo ""
cmake .. \
-DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \
-DMUSA_KERNEL_DEBUG=$MUSA_KERNEL_DEBUG \
-DPYTHON_EXECUTABLE=$(which python3) 2>&1 | tee cmake_output.log
echo ""
echo "Building with $(nproc) parallel jobs..."
make -j$(nproc)
# Verify build output
if [ -f "libmusa_plugin.so" ]; then
echo ""
echo "[SUCCESS] Build successful: libmusa_plugin.so"
ls -lh libmusa_plugin.so
else
echo ""
echo "[FAIL] Build failed: libmusa_plugin.so not found"
exit 1
fi
# Post-build information
echo ""
echo "=========================================="
echo "Build Complete!"
echo "=========================================="
echo "Build Type: $BUILD_TYPE"
echo "Plugin: $(pwd)/libmusa_plugin.so"
echo "=========================================="