Skip to content

Commit

Permalink
feat: do not link with windows CRT
Browse files Browse the repository at this point in the history
See BurntSushi/ripgrep#1613 for explanations.
  • Loading branch information
vthib committed Dec 4, 2022
1 parent 93c1462 commit c8981eb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
6 changes: 6 additions & 0 deletions .cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# On Windows MSVC, statically link the C runtime so that the resulting EXE does
# not depend on the vcruntime DLL.
[target.x86_64-pc-windows-msvc]
rustflags = ["-C", "target-feature=+crt-static"]
[target.i686-pc-windows-msvc]
rustflags = ["-C", "target-feature=+crt-static"]
12 changes: 8 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,16 @@ jobs:
vcpkgGitCommitId: '163fe7bd3d67c41200617caaa245b5ba2ba854e6'
runVcpkgInstall: true

- name: Export VCPKGRS_TRIPLET env var
shell: bash
run: echo "VCPKGRS_TRIPLET=${{ matrix.vcpkg_triplet }}" >> $GITHUB_ENV

- run: cargo test --target=${{matrix.target}}

- uses: dtolnay/rust-toolchain@stable
with:
target: ${{matrix.target}}

- run: cargo test --target=${{matrix.target}}

- name: Test build with Openssl
# Ideally, we should run the tests as well. At the moment, this
# does not work as the vcpkg installation does not seem to be very well handled with
Expand All @@ -79,10 +83,10 @@ jobs:
build: [windows, windows32]
include:
- build: windows
vcpkg_triplet: x64-windows-static-md
vcpkg_triplet: x64-windows-static
target: x86_64-pc-windows-msvc
- build: windows32
vcpkg_triplet: x86-windows-static-md
vcpkg_triplet: x86-windows-static
target: i686-pc-windows-msvc

clippy:
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ jobs:
- build: win-msvc
os: windows-2022
target: x86_64-pc-windows-msvc
vcpkg_triplet: x64-windows-static-md
vcpkg_triplet: x64-windows-static
- build: win32-msvc
os: windows-2022
target: i686-pc-windows-msvc
vcpkg_triplet: x86-windows-static-md
vcpkg_triplet: x86-windows-static

steps:
- name: Checkout repository
Expand All @@ -83,6 +83,11 @@ jobs:
vcpkgGitCommitId: '163fe7bd3d67c41200617caaa245b5ba2ba854e6'
runVcpkgInstall: true

- name: Export VCPKGRS_TRIPLET env var
if: ${{ matrix.os == 'windows-2022' }}
shell: bash
run: echo "VCPKGRS_TRIPLET=${{ matrix.vcpkg_triplet }}" >> $GITHUB_ENV

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
Expand Down

0 comments on commit c8981eb

Please sign in to comment.