Skip to content

Commit

Permalink
Add static Windows support
Browse files Browse the repository at this point in the history
Emit additional link values to environment in build.rs.
Run static build check and test.
Differentiate original Windows build check and test by adding keyword "dynamic" to names.
  • Loading branch information
Iain Laird authored and otavio committed Sep 9, 2021
1 parent ee5e63e commit 8c47729
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
33 changes: 30 additions & 3 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,22 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install libarchive
- name: Install libarchive dynamic
uses: lukka/run-vcpkg@v7.4
with:
vcpkgArguments: libarchive
vcpkgTriplet: x64-windows
vcpkgGitCommitId: 7dbc05515b44bf54d2a42b4da9d1e1f910868b86 # master
useShell: true

- name: Install libarchive static
uses: lukka/run-vcpkg@v7.4
with:
vcpkgArguments: libarchive
vcpkgTriplet: x64-windows-static
vcpkgGitCommitId: 7dbc05515b44bf54d2a42b4da9d1e1f910868b86 # master
useShell: true

- name: Install ${{ matrix.version }}
uses: actions-rs/toolchain@v1
with:
Expand Down Expand Up @@ -60,7 +68,7 @@ jobs:
path: target
key: ${{ matrix.version }}-x86_64-pc-windows-msvc-cargo-build-trimmed-${{ hashFiles('**/Cargo.lock') }}

- name: Check build
- name: Check dynamic build
uses: actions-rs/cargo@v1
env:
OPENSSL_ROOT_DIR: "D:\\a\\compress-tools\\vcpkg\\installed\\x64-windows"
Expand All @@ -69,7 +77,16 @@ jobs:
command: check
args: --release --all --bins --examples --tests

- name: Tests
- name: Check static build
uses: actions-rs/cargo@v1
env:
RUSTFLAGS: "-C target-feature=+crt-static"
OPENSSL_ROOT_DIR: "D:\\a\\compress-tools\\vcpkg\\installed\\x64-windows-static"
with:
command: check
args: --release --all --bins --examples --tests

- name: Test dynamic
uses: actions-rs/cargo@v1
timeout-minutes: 10
env:
Expand All @@ -78,3 +95,13 @@ jobs:
with:
command: test
args: --release --all --all-features --no-fail-fast -- --nocapture

- name: Test static
uses: actions-rs/cargo@v1
timeout-minutes: 10
env:
RUSTFLAGS: "-C target-feature=+crt-static"
OPENSSL_ROOT_DIR: "D:\\a\\compress-tools\\vcpkg\\installed\\x64-windows-static"
with:
command: test
args: --release --all --all-features --no-fail-fast -- --nocapture
4 changes: 4 additions & 0 deletions src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ fn find_libarchive() {
vcpkg::Config::new()
.find_package("libarchive")
.expect("Unable to find libarchive");

println!("cargo:rustc-link-lib=static=archive");
println!("cargo:rustc-link-lib=User32");
println!("cargo:rustc-link-lib=Crypt32");
}

0 comments on commit 8c47729

Please sign in to comment.