From 72eb1dbc1dd2f9f619e3ebf70239dc59c7889ee3 Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Mon, 30 Sep 2024 09:17:51 -0700 Subject: [PATCH 1/2] Use -Werror in Makefile builds in CI only Warnings as errors interfere with local development, especially Wunused; for CMake we already switched to specifying werror separately as an option, and it's probably time to do this for Makefile as well. --- .github/workflows/build.yml | 4 ++++ Makefile | 9 +++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a20ce901..a1df56a0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,6 +17,8 @@ jobs: os: [{ name: ubuntu, version: ubuntu-latest }, { name: macos-intel, version: macos-13 }, { name: macos-arm, version: macos-14 }] name: ${{matrix.os.name}} runs-on: ${{matrix.os.version}} + env: + werror: 1 steps: - uses: actions/checkout@v4 - name: work around ASLR+ASAN compatibility @@ -131,6 +133,8 @@ jobs: gltfpack-basis: runs-on: ubuntu-latest + env: + werror: 1 steps: - uses: actions/checkout@v4 - uses: actions/checkout@v4 diff --git a/Makefile b/Makefile index cede9784..4cafb958 100644 --- a/Makefile +++ b/Makefile @@ -19,8 +19,8 @@ OBJECTS=$(LIBRARY_OBJECTS) $(DEMO_OBJECTS) $(GLTFPACK_OBJECTS) LIBRARY=$(BUILD)/libmeshoptimizer.a DEMO=$(BUILD)/meshoptimizer -CFLAGS=-g -Wall -Wextra -Werror -std=c89 -CXXFLAGS=-g -Wall -Wextra -Wshadow -Wno-missing-field-initializers -Werror -std=gnu++98 +CFLAGS=-g -Wall -Wextra -std=c89 +CXXFLAGS=-g -Wall -Wextra -Wshadow -Wno-missing-field-initializers -std=gnu++98 LDFLAGS= $(GLTFPACK_OBJECTS): CXXFLAGS+=-std=c++11 @@ -63,6 +63,11 @@ WASM_SIMPLIFIER_EXPORTS=meshopt_simplify meshopt_simplifyWithAttributes meshopt_ WASM_CLUSTERIZER_SOURCES=src/clusterizer.cpp tools/wasmstubs.cpp WASM_CLUSTERIZER_EXPORTS=meshopt_buildMeshletsBound meshopt_buildMeshlets meshopt_computeClusterBounds meshopt_computeMeshletBounds meshopt_optimizeMeshlet sbrk __wasm_call_ctors +ifneq ($(werror),) + CFLAGS+=-Werror + CXXFLAGS+=-Werror +endif + ifeq ($(config),iphone) IPHONESDK=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk CFLAGS+=-arch armv7 -arch arm64 -isysroot $(IPHONESDK) From 582ce5b9c1d47e3cca4c456119f25bbb6c60728d Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Mon, 30 Sep 2024 09:19:32 -0700 Subject: [PATCH 2/2] Fix gltfpack Wasm warning settings This target is not using the wasm flags so it's cumbersome to get it to support the full setup... for now just add Wall (can't add Wextra without a couple warnings exclusions/fixes in wasi stubs). --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4cafb958..5c031441 100644 --- a/Makefile +++ b/Makefile @@ -150,7 +150,7 @@ $(BUILD)/gltfpack: $(GLTFPACK_OBJECTS) $(LIBRARY) gltfpack.wasm: gltf/library.wasm gltf/library.wasm: $(LIBRARY_SOURCES) $(GLTFPACK_SOURCES) - $(WASMCC) $^ -o $@ -Os -DNDEBUG --target=wasm32-wasi --sysroot=$(WASIROOT) -nostartfiles -Wl,--no-entry -Wl,--export=pack -Wl,--export=malloc -Wl,--export=free -Wl,--export=__wasm_call_ctors -Wl,-s -Wl,--allow-undefined-file=gltf/wasistubs.txt + $(WASMCC) $^ -o $@ -Wall -Os -DNDEBUG --target=wasm32-wasi --sysroot=$(WASIROOT) -nostartfiles -Wl,--no-entry -Wl,--export=pack -Wl,--export=malloc -Wl,--export=free -Wl,--export=__wasm_call_ctors -Wl,-s -Wl,--allow-undefined-file=gltf/wasistubs.txt build/decoder_base.wasm: $(WASM_DECODER_SOURCES) @mkdir -p build