Skip to content

Commit

Permalink
Merge pull request #353 from qw-ctf/warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
dsvensson authored Aug 2, 2024
2 parents 8a9caca + 1ee4530 commit ea92a73
Show file tree
Hide file tree
Showing 78 changed files with 3,175 additions and 3,126 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ jobs:
id: cpu-cores
if: matrix.target == 'qvm'

- uses: ammaraskar/[email protected]
if: matrix.target != 'qvm'

- name: Checkout q3lcc
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -91,6 +94,34 @@ jobs:
qwprogs.*
compression-level: 9

verify-macos:
runs-on: macos-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: ammaraskar/[email protected]

- name: Build
run: |
cmake -B builddir -S . -G Xcode -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
cmake --build builddir --config Release --parallel
verify-msvc:
runs-on: windows-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: ammaraskar/[email protected]

- name: Build
run: |
cmake -B builddir -S . -G "Visual Studio 17 2022"
cmake --build builddir --config Release --parallel
upload:
needs: build
timeout-minutes: 10
Expand Down
15 changes: 15 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ cmake_minimum_required(VERSION 3.9.0)
# Set project name and languge.
project(qwprogs C)

include(CheckCCompilerFlag)

set(CMAKE_COLOR_DIAGNOSTICS ON)

# CMake option for bot support, we check it below and add C preprocessor directive if required.
option(BOT_SUPPORT "Build with bot support" ON)
# Option for FTE extensions. We also have some basic support for FTE which does not controlled by this setting.
Expand Down Expand Up @@ -152,6 +156,17 @@ if (CMAKE_C_COMPILER_ID STREQUAL "MSVC")
target_compile_options(${PROJECT_NAME} PRIVATE /W4)
else()
target_compile_options(${PROJECT_NAME} PRIVATE -Wall)

check_c_compiler_flag("-Wstrict-prototypes" HAS_CFLAG_STRICT_PROTOTYPES)
if (HAS_CFLAG_STRICT_PROTOTYPES)
target_compile_options(${PROJECT_NAME} PRIVATE -Werror=strict-prototypes)
endif()

check_c_compiler_flag("-Wstrlcpy-strlcat-size" HAS_STRLCPY_STRLCAT_SIZE)
if (HAS_STRLCPY_STRLCAT_SIZE)
target_compile_options(${PROJECT_NAME} PRIVATE -Werror=strlcpy-strlcat-size)
endif()

# Do not allow undefined symbols while linking.
if(APPLE)
target_link_options(${PROJECT_NAME} PRIVATE "-Wl,-undefined,error")
Expand Down
Loading

0 comments on commit ea92a73

Please sign in to comment.