From 516b5bbefbd58c32535cddb5e63ab1809a22c315 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Mon, 11 Oct 2021 16:20:49 -0700 Subject: [PATCH] Fix static linking on Windows (#199) --- .github/workflows/build.yaml | 5 ++++- bin/package | 15 +++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 1ac8f4c6..9ae41da8 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -31,15 +31,18 @@ jobs: include: - target: x86_64-apple-darwin os: macos-latest + rustflags: --deny warnings - target: x86_64-pc-windows-msvc os: windows-latest + rustflags: --deny warnings --codegen=target-feature=+crt-static - target: x86_64-unknown-linux-gnu os: ubuntu-latest + rustflags: --deny warnings runs-on: ${{ matrix.os }} env: - RUSTFLAGS: "--deny warnings" + RUSTFLAGS: ${{ matrix.rustflags }} steps: - uses: actions/checkout@v2 diff --git a/bin/package b/bin/package index 5b03db3e..d74f3259 100755 --- a/bin/package +++ b/bin/package @@ -9,17 +9,12 @@ BIN=agora echo "Packaging $BIN $VERSION for $TARGET..." echo "Building $BIN..." +cargo build --bin $BIN --target $TARGET --release +EXECUTABLE=target/$TARGET/release/$BIN -case $OS in - ubuntu-latest | macos-latest) - cargo build --bin $BIN --target $TARGET --release - EXECUTABLE=target/$TARGET/release/$BIN - ;; - windows-latest) - cargo rustc --bin $BIN --target $TARGET --release -- --codegen target-feature="+crt-static" - EXECUTABLE=target/$TARGET/release/$BIN.exe - ;; -esac +if [[ $OS == windows-latest ]]; then + EXECUTABLE=$EXECUTABLE.exe +fi echo "Copying release files..." mkdir dist