From 735b22b9d3c1d5e0631f3c88c1e2b9324b7ac9e2 Mon Sep 17 00:00:00 2001 From: Lilith River Date: Mon, 19 Aug 2024 20:57:25 -0600 Subject: [PATCH 1/3] Fixes https://github.com/NoXF/libwebp-sys/issues/29 --- Cargo.toml | 5 +++++ build.rs | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 5db7dfb..4f7e1fa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/build.rs b/build.rs index f9f7e98..434df55 100644 --- a/build.rs +++ b/build.rs @@ -34,7 +34,6 @@ fn main() { { sharpyuv_build.file(manifest_dir.join(f)); } - sharpyuv_build.compile("sharpyuv"); cc.compile("webpsys"); } @@ -70,6 +69,21 @@ 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); + } + } _ => {} }; From 8a2057aa5460ce5dda179f7b1b8b3c58990b63d8 Mon Sep 17 00:00:00 2001 From: Lilith River Date: Wed, 28 Aug 2024 16:53:54 -0600 Subject: [PATCH 2/3] rustfmt --- build.rs | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/build.rs b/build.rs index 434df55..111d8e1 100644 --- a/build.rs +++ b/build.rs @@ -73,17 +73,27 @@ fn setup_build(build: &mut cc::Build, include_dir: &PathBuf) { // 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(); + 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") { + 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); } - } _ => {} }; From a1294826d7b1b8a63cb0b791e0dfb9ceb811f212 Mon Sep 17 00:00:00 2001 From: Lilith River Date: Wed, 28 Aug 2024 16:54:02 -0600 Subject: [PATCH 3/3] Fix wasm target --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 72d535e..251fa8f 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -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: