Unified the C# mod and the Rust compiler into a monorepo

This commit is contained in:
2025-11-26 16:02:00 -07:00
parent 346b6e49e6
commit 353dc16944
34 changed files with 253 additions and 14 deletions

View File

@@ -2,21 +2,46 @@
set -e
RUST_DIR="rust_compiler"
CSHARP_DIR="csharp_mod"
RELEASE_DIR="release"
export RUSTFLAGS="--remap-path-prefix=${PWD}=. --remap-path-prefix=${HOME}/.cargo=~/.cargo"
# -- Build for Native (Linux x86-64) --
echo "Building native (Linux x86-64) executable..."
cargo build --release --target=x86_64-unknown-linux-gnu
echo "Native build complete."
echo "--------------------"
cd "$RUST_DIR"
echo "Building native Rust binaries and libs"
# -- Build for Native (Linux x86-64) --
cargo build --release --target=x86_64-unknown-linux-gnu
# -- Build for Windows (x86-64) --
echo "Building Windows (x86-64) dll and executable..."
cargo build --release --target=x86_64-pc-windows-gnu
echo "Windows build successful."
cd ..
echo "--------------------"
echo "All builds successful"
echo "Linux executable at target/x86_64-unknown-linux-gnu/release/slang"
echo "Windows .exe at target/x86_64-pc-windows-gnu/release/slang.exe"
echo "Windows .dll at target/x86_64-pc-windows-gnu/release/slang.dll"
echo "Building C# mod"
echo "--------------------"
cd "$CSHARP_DIR"
dotnet build -c Release
cd ..
echo "--------------------"
echo "Copying Release files to output directory"
echo "--------------------"
RUST_WIN_EXE="$RUST_DIR/target/x86_64-pc-windows-gnu/release/slang.exe"
RUST_LINUX_BIN="$RUST_DIR/target/x86_64-unknown-linux-gnu/release/slang"
CHARP_DLL="$CSHARP_DIR/bin/Release/net46/StationeersSlang.dll"
# Check if the release dir exists, if not: create it.
if [[ ! -d "$RELEASE_DIR" ]]; then
mkdir "$RELEASE_DIR"
fi
cp "$RUST_WIN_EXE" "$RELEASE_DIR/slang.exe"
cp "$RUST_LINUX_BIN" "$RELEASE_DIR/slang"
cp "$CHARP_DLL" "$RELEASE_DIR/StationeersSlang.dll"