firefly/build-all.sh
2025-04-10 21:50:41 -05:00

59 lines
1.4 KiB
Bash

#!/bin/bash
configuration="Release"
baseOutputPath="./artifacts"
# Detect platform
if [[ "$OSTYPE" == "darwin"* ]]; then
currentPlatform="osx-x64"
else
currentPlatform="linux-x64"
fi
echo "Building for current platform: $currentPlatform"
# Create output directories
exeOutputPath="$baseOutputPath/exe"
nativeOutputPath="$baseOutputPath/native"
mkdir -p "$exeOutputPath"
mkdir -p "$nativeOutputPath"
# Build executable
echo "Building executable..."
dotnet publish \
-c $configuration \
-r $currentPlatform \
--self-contained true \
-p:PublishDir=$exeOutputPath
if [ $? -ne 0 ]; then
echo "Executable build failed. Check the error messages above."
exit 1
fi
# Build native shared library
echo "Building native shared library..."
dotnet publish \
-c $configuration \
-r $currentPlatform \
--self-contained true \
-p:BuildType=lib \
-p:PublishDir=$nativeOutputPath
if [ $? -ne 0 ]; then
echo "Library build failed. Check the error messages above."
exit 1
fi
echo "Build complete. Outputs available at:"
echo "Executable: $exeOutputPath"
echo "Native library: $nativeOutputPath"
# Make the outputs executable
if [[ "$currentPlatform" == "linux-x64" ]]; then
chmod +x "$exeOutputPath/Firefly"
chmod +x "$nativeOutputPath/Firefly.so"
elif [[ "$currentPlatform" == "osx-x64" ]]; then
chmod +x "$exeOutputPath/Firefly"
chmod +x "$nativeOutputPath/Firefly.dylib"
fi