Skip to content

Commit

Permalink
Allow compiling non-32bit under feature flag (#184)
Browse files Browse the repository at this point in the history
Co-authored-by: ZeWaka <[email protected]>
  • Loading branch information
MrStonedOne and ZeWaka authored Aug 23, 2024
1 parent 0de97f9 commit 1c50a79
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ jobs:

- uses: dtolnay/rust-toolchain@nightly
with:
targets: i686-pc-windows-msvc # Used for clippy, since it doesn't need to build the entire std
components: rustfmt, clippy, rust-src
targets: x86_64-pc-windows-msvc
components: clippy, rustfmt, rust-src

- uses: Swatinem/rust-cache@v2

- name: Clippy (all features)
run: cargo clippy --target i686-pc-windows-msvc --features all --locked -- -D warnings
run: cargo clippy -Z build-std --target i686-win7-windows-msvc --features all --locked -- -D warnings

- name: Rustfmt
run: cargo fmt -- --check
Expand All @@ -40,7 +40,7 @@ jobs:
runs-on: ubuntu-latest
env:
BYOND_MAJOR: 515
BYOND_MINOR: 1636
BYOND_MINOR: 1642
PKG_CONFIG_ALLOW_CROSS: 1

steps:
Expand All @@ -52,7 +52,7 @@ jobs:
sudo apt-get install libgcc-s1:i386 g++-multilib zlib1g-dev:i386
./scripts/install_byond.sh
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@nightly
with:
targets: i686-unknown-linux-gnu

Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ rustls_tls = ["mysql/default-rustls"]

# internal feature-like things
jobs = ["flume"]
allow_non_32bit = []

[dev-dependencies]
regex = "1"
6 changes: 4 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,7 @@ pub mod url;
#[cfg(feature = "worleynoise")]
pub mod worleynoise;

#[cfg(not(target_pointer_width = "32"))]
compile_error!("rust-g must be compiled for a 32-bit target");
#[cfg(all(not(target_pointer_width = "32"), not(feature = "allow_non_32bit")))]
compile_error!(
"Compiling for non-32bit is not allowed without enabling the `allow_non_32bit` feature."
);

0 comments on commit 1c50a79

Please sign in to comment.