Skip to content

Commit

Permalink
Merge branch 'optimize-for-size'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sewer56 committed Nov 28, 2023
2 parents e06b735 + ab950f7 commit 9fa75f9
Show file tree
Hide file tree
Showing 24 changed files with 372 additions and 304 deletions.
120 changes: 43 additions & 77 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,92 +42,58 @@ jobs:
rust_project_path: src-rust
rust_branch: nightly

build-c-libs:
build-c-libs-linux:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
features: "c_exports"
- os: ubuntu-latest
target: i686-unknown-linux-gnu
features: "c_exports"
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
features: "c_exports"
- os: windows-latest
target: x86_64-pc-windows-msvc
features: "c_exports"
- os: windows-latest
target: i686-pc-windows-msvc
features: "c_exports"
- os: windows-latest
target: aarch64-pc-windows-msvc
features: "c_exports"
- os: macos-latest
target: x86_64-apple-darwin
features: "c_exports"
- os: macos-latest
target: aarch64-apple-darwin
features: "c_exports"
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
features: "c_exports,size_opt"
- os: ubuntu-latest
target: i686-unknown-linux-gnu
features: "c_exports,size_opt"
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
features: "c_exports,size_opt"
- os: windows-latest
target: x86_64-pc-windows-msvc
features: "c_exports,size_opt"
- os: windows-latest
target: i686-pc-windows-msvc
features: "c_exports,size_opt"
- os: windows-latest
target: aarch64-pc-windows-msvc
features: "c_exports,size_opt"
- os: macos-latest
target: x86_64-apple-darwin
features: "c_exports,size_opt"
- os: macos-latest
target: aarch64-apple-darwin
features: "c_exports,size_opt"
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
features: "c_exports,size_opt,no_format"
- os: ubuntu-latest
target: i686-unknown-linux-gnu
features: "c_exports,size_opt,no_format"
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
features: "c_exports,size_opt,no_format"
- os: windows-latest
target: x86_64-pc-windows-msvc
features: "c_exports,size_opt,no_format"
- os: windows-latest
target: i686-pc-windows-msvc
features: "c_exports,size_opt,no_format"
- os: windows-latest
target: aarch64-pc-windows-msvc
features: "c_exports,size_opt,no_format"
- os: macos-latest
target: x86_64-apple-darwin
features: "c_exports,size_opt,no_format"
- os: macos-latest
target: aarch64-apple-darwin
features: "c_exports,size_opt,no_format"
os: [ubuntu-latest]
target: [x86_64-unknown-linux-gnu, i686-unknown-linux-gnu, aarch64-unknown-linux-gnu]
features: ["c_exports", "c_exports,size_opt", "c_exports,size_opt,no_format"]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- id: build-libs
uses: Reloaded-Project/reloaded-project-configurations-rust/.github/actions/build-c-library@v1
with:
rust_project_path: src-rust
target: ${{ matrix.target }}
features: ${{ matrix.features }}

build-c-libs-macos:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [macos-latest]
target: [x86_64-apple-darwin, aarch64-apple-darwin]
features: ["c_exports", "c_exports,size_opt", "c_exports,size_opt,no_format"]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- id: build-libs
uses: Reloaded-Project/reloaded-project-configurations-rust/.github/actions/build-c-library@v1
with:
rust_project_path: src-rust
target: ${{ matrix.target }}
features: ${{ matrix.features }}

build-c-libs-windows:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest]
target: [x86_64-pc-windows-msvc, i686-pc-windows-msvc, aarch64-pc-windows-msvc]
features: ["c_exports,external_processes", "c_exports,size_opt,external_processes", "c_exports,size_opt,no_format,external_processes"]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- id: build-libs
uses: Reloaded-Project/reloaded-project-configurations-rust/.github/actions/build-c-library@v1 # upgrade if needed
uses: Reloaded-Project/reloaded-project-configurations-rust/.github/actions/build-c-library@v1
with:
rust_project_path: src-rust
target: ${{ matrix.target }}
Expand Down Expand Up @@ -155,7 +121,7 @@ jobs:
header_file: bindings_c.h

publish-artifacts:
needs: ["build-c-headers", "build-c-libs", "test-wine", "test-native"]
needs: ["build-c-headers", "build-c-libs-windows", "build-c-libs-linux", "build-c-libs-macos", "test-wine", "test-native"]
# Publish only on tags
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ You can specify another process with `TargetProcess = someProcess` in `BufferAll

## Crate Features (Rust)

- `std`: [Enabled by Default] Enables use of standard library.
- `external_processes`: Support external processes (windows only).
- `no_format`: Disables formatting code in errors, saving ~8kB of space.
- `size_opt`: Makes cold paths optimized for size instead of optimized for speed. [Requires 'nightly' Rust]
- `c_exports` Provides C exports for the library.
Expand Down
2 changes: 2 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ Alternative overload also allows you to pass a 'context' variable.

### Crate Features (Rust)

- `std`: [Enabled by Default] Enables use of standard library.
- `external_processes`: Support external processes (windows only).
- `no_format`: Disables formatting code in errors, saving ~8kB of space.
- `size_opt`: Makes cold paths optimized for size instead of optimized for speed. [Requires 'nightly' Rust]
- `c_exports` Provides C exports for the library.
Expand Down
Loading

0 comments on commit 9fa75f9

Please sign in to comment.