Skip to content

Commit

Permalink
build: add extra warning and make warning error
Browse files Browse the repository at this point in the history
- Enable extra warning from compiler
- Make warning into error in CI build
  • Loading branch information
wdhongtw committed Jul 6, 2024
1 parent a620529 commit 9485582
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ jobs:

- name: Build
run: |
cmake --preset default
cmake --build --preset default --verbose
cmake --build --preset default -t install --verbose
cmake --preset c23-release-ci
cmake --build --preset c23-release-ci --verbose
cmake --build --preset c23-release-ci -t install --verbose
- name: Test
env:
Expand All @@ -33,7 +33,7 @@ jobs:
run: |
glib-compile-schemas src/setup --targetdir=build/bin
weston --no-config --socket=wl-headless --backend=headless &
WAYLAND_DISPLAY=wl-headless cmake --build --preset default -t test --verbose
WAYLAND_DISPLAY=wl-headless cmake --build --preset c23-release-ci -t test --verbose
coverage:
runs-on: ubuntu-latest
Expand Down
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ set(DESCRIPTION_TRANSLATIONS
本輸入法也同時支援帶調漢語拼音輸入。")

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
option(ERROR_ON_WARNING "Toggle error-on-warning build" OFF)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
if(ERROR_ON_WARNING)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
endif()

set(AUTHORS "Peng Huang, Ding-Yi Chen")
set(MAINTAINER "Ding-Yi Chen <dchen at redhat.com>")
Expand Down
15 changes: 15 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "c23-release-ci",
"displayName": "C23 (Release CI)",
"description": "Build with only C dependencies",
"inherits": [
"c23-release"
],
"cacheVariables": {
"ERROR_ON_WARNING": true
}
},
{
"name": "c23-coverage",
"displayName": "C23 (Debug Coverage)",
Expand All @@ -66,6 +77,10 @@
{
"name": "c23-coverage",
"configurePreset": "c23-coverage"
},
{
"name": "c23-release-ci",
"configurePreset": "c23-release-ci"
}
]
}

0 comments on commit 9485582

Please sign in to comment.