Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add vendored build to windows ci #241

Merged
merged 1 commit into from
Jun 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .github/workflows/cross.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Cross-CI
name: CrossCompiling

on:
push:
Expand Down Expand Up @@ -34,10 +34,6 @@ jobs:
strategy:
matrix:
target: [
{
rustc: x86_64-unknown-linux-musl,
gcc: musl-tools,
},
{
rustc: x86_64-pc-windows-gnu,
gcc: gcc-mingw-w64-x86-64,
Expand Down
80 changes: 80 additions & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: StaticLinking

on:
push:
paths-ignore:
- 'ansible/**'
- 'doc/**'
- 'demo/**'
- 'scripts/**'
- 'g3proxy/doc/**'
- 'g3tiles/doc/**'
branches:
- 'master'
- 'rel/**'
- 'lts/**'
pull_request:
branches:
- 'master'
- 'rel/**'
- 'lts/**'

env:
CARGO_TERM_COLOR: always
CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_RUSTFLAGS: -C target-feature=+crt-static

jobs:
musl:
name: musl
runs-on: ubuntu-latest
strategy:
matrix:
feature:
- vendored-openssl
- vendored-tongsuo
# - vendored-aws-lc
# - vendored-boringssl
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: true
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-musl
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install capnproto musl-tools
- name: Cargo build
run: cargo build --target=x86_64-unknown-linux-musl --no-default-features --features ${{ matrix.feature }},quic,vendored-c-ares,hickory
msvc:
name: msvc
runs-on: windows-latest
strategy:
matrix:
feature:
- vendored-openssl
- vendored-tongsuo
- vendored-aws-lc
- vendored-boringssl
steps:
- name: Install common tools
run: choco install capnproto
- name: Install nasm and ninja for BoringSSL
if: matrix.feature == 'vendored-boringssl'
run: choco install nasm ninja
- name: Install nasm for AWS-LC
if: matrix.feature == 'vendored-aws-lc'
uses: ilammy/setup-nasm@v1
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: true
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Cargo build
run: cargo build --no-default-features --features ${{ matrix.feature }},quic,vendored-c-ares,hickory
41 changes: 41 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ jobs:
submodules: true
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Install tools (choco)
run: choco install capnproto
- name: Install lib dependencies (vcpkg)
Expand All @@ -45,3 +47,42 @@ jobs:
run: cargo clippy --no-default-features --features $env:WIN_FEATURES --tests -- --deny warnings
- name: Cargo test
run: cargo test --no-default-features --features $env:WIN_FEATURES

build-vendored:
name: Build vendored
runs-on: windows-latest
strategy:
matrix:
feature:
- vendored-openssl
- vendored-tongsuo
- vendored-aws-lc
- vendored-boringssl
component:
- g3proxy
- g3bench
- g3tiles
- g3fcgen
- g3mkcert
- g3keymess
steps:
- name: Install common tools
run: choco install capnproto
- name: Install nasm and ninja for BoringSSL
if: matrix.feature == 'vendored-boringssl'
run: choco install nasm ninja
- name: Install nasm for AWS-LC
if: matrix.feature == 'vendored-aws-lc'
uses: ilammy/setup-nasm@v1
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: true
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Cargo build
run: cargo build --no-default-features --features ${{ matrix.feature }} -p ${{ matrix.component }}
- name: Cargo clippy
run: cargo clippy --no-default-features --features ${{ matrix.feature }} -p ${{ matrix.component }} -- --deny warnings
15 changes: 14 additions & 1 deletion doc/static-linking.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Static Linking
Static Linking
---

# Linux

## Install musl

Expand All @@ -25,3 +28,13 @@ Then compile with the features that do not require dynamic linking:
```shell
cargo build --target=x86_64-unknown-linux-musl --no-default-features --features vendored-openssl,vendored-c-ares
```

# Windows

Windows provides both dynamic and static C runtimes.

See [C runtime (CRT) and C++ standard library (STL) .lib files](https://learn.microsoft.com/en-us/cpp/c-runtime-library/crt-library-features).

You can change to use a static runtime by setting `-C target-feature=+crt-static` rustc flag.

See [Static and dynamic C runtimes](https://doc.rust-lang.org/reference/linkage.html#static-and-dynamic-c-runtimes).
Loading