-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·65 lines (55 loc) · 1.7 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·65 lines (55 loc) · 1.7 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
#!/bin/bash
#################################################################################
# build.sh - Sample build script for Mahogany using CMake
#################################################################################
# This script demonstrates how to build Mahogany with various configurations.
# Modify the variables below to suit your environment.
set -e # Exit on error
# Configuration variables
BUILD_TYPE=${BUILD_TYPE:-Release}
BUILD_SHARED=${BUILD_SHARED:-OFF}
ENABLE_PYTHON=${ENABLE_PYTHON:-ON}
ENABLE_SSL=${ENABLE_SSL:-ON}
BUILD_TESTS=${BUILD_TESTS:-ON}
INSTALL_PREFIX=${INSTALL_PREFIX:-/usr/local}
# Build directory
BUILD_DIR=build
echo "=== Mahogany CMake Build Script ==="
echo "Build type: $BUILD_TYPE"
echo "Shared libs: $BUILD_SHARED"
echo "Python support: $ENABLE_PYTHON"
echo "SSL support: $ENABLE_SSL"
echo "Build tests: $BUILD_TESTS"
echo "Install prefix: $INSTALL_PREFIX"
echo ""
# Clean build directory if requested
if [ "$1" = "clean" ]; then
echo "Cleaning build directory..."
rm -rf $BUILD_DIR
echo "Clean complete."
exit 0
fi
# Create build directory
mkdir -p $BUILD_DIR
cd $BUILD_DIR
# Configure with CMake
echo "Configuring with CMake..."
cmake .. \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DBUILD_SHARED_LIBS=$BUILD_SHARED \
-DENABLE_PYTHON=$ENABLE_PYTHON \
-DENABLE_SSL=$ENABLE_SSL \
-DBUILD_TESTS=$BUILD_TESTS \
-DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX
# Build
echo "Building..."
make -j$(nproc)
# Run tests if enabled
if [ "$BUILD_TESTS" = "ON" ]; then
echo "Running tests..."
ctest --output-on-failure
fi
echo ""
echo "=== Build Complete ==="
echo "To install: cd $BUILD_DIR && make install"
echo "To package: cd $BUILD_DIR && make package"