Skip to content

Commit

Permalink
Merge pull request #30 from lilith/master
Browse files Browse the repository at this point in the history
Fixes #29
  • Loading branch information
NoXF authored Sep 2, 2024
2 parents ede9073 + a129482 commit 8e7a124
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ jobs:
run: |
cargo test ${{ matrix.features }} --target ${{ matrix.target }}
- name: Check wasm
if: matrix.target == 'wasm32-unknown-unknown'
if: matrix.target == 'wasm32-unknown-emscripten'
run: |
cargo check ${{ matrix.features }} --target ${{ matrix.target }}
env:
Expand Down
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ build = "build.rs"
homepage = "https://github.com/NoXF/libwebp-sys"
repository = "https://github.com/NoXF/libwebp-sys"

edition = "2021"

[profile.test]
opt-level = 2

[build-dependencies]
cc = "1"
glob = "0.3"
Expand Down
26 changes: 25 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ fn main() {
{
sharpyuv_build.file(manifest_dir.join(f));
}

sharpyuv_build.compile("sharpyuv");
cc.compile("webpsys");
}
Expand Down Expand Up @@ -70,6 +69,31 @@ fn setup_build(build: &mut cc::Build, include_dir: &PathBuf) {
if cfg!(feature = "neon") {
build.define("WEBP_HAVE_NEON", Some("1"));
}

// If any optimizations are ennabled, we must remove -gdwarf flags
// Which we can only do by stopping debug mode entirely since we can't
// fix env flags.
let gccflags = build
.get_compiler()
.cflags_env()
.to_string_lossy()
.to_string();

if gccflags.contains("-O0")
|| gccflags.contains("-O1")
|| gccflags.contains("-O2")
|| gccflags.contains("-O3")
|| gccflags.contains("-Ofast")
|| gccflags.contains("-Os")
|| gccflags.contains("--opt-level=0")
|| gccflags.contains("--opt-level=1")
|| gccflags.contains("--opt-level=2")
|| gccflags.contains("--opt-level=3")
|| gccflags.contains("--opt-level=s")
|| gccflags.contains("--opt-level=z")
{
build.debug(false);
}
}
_ => {}
};
Expand Down

0 comments on commit 8e7a124

Please sign in to comment.