Skip to content

Commit

Permalink
Merge pull request #117 from joto/update-some-stuff
Browse files Browse the repository at this point in the history
Update some stuff
  • Loading branch information
kkaefer authored Dec 19, 2024
2 parents 2a739b1 + 16e41ee commit 5cc0ee5
Show file tree
Hide file tree
Showing 8 changed files with 285 additions and 194 deletions.
6 changes: 2 additions & 4 deletions .github/actions/install-ubuntu/action.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
name: Install Prerequisites on Ubuntu
name: Install apt packages on Ubuntu/Debian

runs:
using: composite

steps:
- name: Install packages
run: |
sudo apt-get update -q
sudo apt-get update -qq
sudo apt-get install -yq \
libprotobuf-dev \
protobuf-compiler
if [ "$CC" = clang-13 ]; then sudo apt-get install -yq --no-install-suggests --no-install-recommends clang-13; fi
shell: bash
67 changes: 34 additions & 33 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,26 @@ on: [ push, pull_request ]
jobs:
linux:
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
image:
- "ubuntu:18.04" # gcc 7.5.0, clang 6.0.0, cmake 3.10.2
- "ubuntu:20.04" # gcc 9.3.0, clang 10.0.0, cmake 3.16.3
- "ubuntu:21.04" # gcc 10.3.0, clang 12.0.0, cmake 3.18.4
- "ubuntu:21.10" # gcc 11.2.0, clang 13.0.0, cmake 3.18.4
- "debian:stretch" # gcc 6.3.0, clang 3.8.1, cmake 3.7.2
- "ubuntu:22.04" # gcc 12.2.0, clang 15.0.7, cmake 3.24.2
- "ubuntu:24.04" # gcc 14.2.0, clang 18.1.3, cmake 3.28.3
- "debian:buster" # gcc 8.3.0, clang 7.0.1, cmake 3.13.4
- "debian:bullseye" # gcc 10.2.1, clang 11.0.1, cmake 3.18.4
- "debian:testing" # gcc 10.3.0, clang 11.1.0, cmake 3.21.3
- "debian:experimental" # gcc 11.0.0, clang 14.0.0, cmake 3.21.3
- "fedora:34" # gcc 11.2.1, clang 12.0.1, cmake 3.20.5
- "fedora:35" # gcc 11.2.1, clang 13.0.0, cmake 3.22.0
- "debian:bookworm" # gcc 12.2.0, clang 15.0.6, cmake 3.25.1
- "debian:testing"
- "debian:experimental"
- "fedora:39"
- "fedora:40"
- "fedora:41"
build_type: [Debug]
cpp_compiler: [g++]
cpp_version: [11]
cpp_version: [14]
include:
- image: "debian:bullseye"
cpp_version: 14
- image: "debian:bullseye"
cpp_version: 17
- image: "debian:bullseye"
Expand Down Expand Up @@ -58,12 +57,17 @@ jobs:
# cpp_compiler: clang++
# CXXFLAGS: "-fsanitize=address,undefined,integer -fno-sanitize-recover=all -fno-omit-frame-pointer"
# LDFLAGS: "-fsanitize=address,undefined,integer"
- image: "debian:bookworm"
c_compiler: clang
cpp_compiler: clang++
- image: "debian:testing"
c_compiler: clang
cpp_compiler: clang++
CXXFLAGS: -Wno-c++20-extensions
- image: "debian:experimental"
c_compiler: clang-14
cpp_compiler: clang++-14
c_compiler: clang
cpp_compiler: clang++
CXXFLAGS: -Wno-c++20-extensions
container:
image: ${{ matrix.image }}
env:
Expand Down Expand Up @@ -105,72 +109,69 @@ jobs:
gcc-c++ \
graphviz \
make \
protobuf-devel \
protobuf-lite-static
- uses: actions/checkout@v2
protobuf-lite-devel \
protobuf-lite
- uses: actions/checkout@v4
- uses: ./.github/actions/cmake
- uses: ./.github/actions/build
- uses: ./.github/actions/ctest

ubuntu-latest:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
timeout-minutes: 30
env:
CC: clang-13
CXX: clang++-13
CC: clang-18
CXX: clang++-18
BUILD_TYPE: Debug
steps:
- name: Install new clang
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main'
shell: bash
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: ./.github/actions/install-ubuntu
- uses: ./.github/actions/cmake
- uses: ./.github/actions/build
- uses: ./.github/actions/ctest

macos:
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os:
- "macos-10.15"
- "macos-11.0"
- macos-14
- macos-15
build_type: [Debug]
include:
- os: "macos-11.0"
- os: macos-14
build_type: Release
runs-on: ${{ matrix.os }}
env:
CC: clang
CXX: clang++
BUILD_TYPE: ${{ matrix.build_type }}
steps:
- run: brew install protobuf
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: ./.github/actions/cmake
- uses: ./.github/actions/build
- uses: ./.github/actions/ctest

windows:
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os:
- windows-2019
- windows-2022
runs-on: ${{ matrix.os }}
steps:
- run: |
vcpkg install \
protobuf:x64-windows \
protobuf-c:x64-windows
shell: bash
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/cmake-windows
- uses: ./.github/actions/build-windows
- uses: ./.github/actions/ctest-windows

16 changes: 12 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
#-----------------------------------------------------------------------------

cmake_minimum_required(VERSION 3.5.0 FATAL_ERROR)
cmake_minimum_required(VERSION 3.10.0 FATAL_ERROR)

#-----------------------------------------------------------------------------

Expand All @@ -17,7 +17,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
#-----------------------------------------------------------------------------

if (NOT "${CMAKE_CXX_STANDARD}")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 14)
endif()
message(STATUS "Building in C++${CMAKE_CXX_STANDARD} mode")
set(CMAKE_CXX_EXTENSIONS OFF)
Expand Down Expand Up @@ -52,6 +52,14 @@ endif()
#
#-----------------------------------------------------------------------------

# This is needed for the protobuf_generate_cpp() function to work on newer
# versions of the Protobuf CMake config.
set(protobuf_MODULE_COMPATIBLE ON CACHE BOOL "")

# This is needed so that we pick up the (more modern) CONFIG mode cmake file
# before the (older) MODULE mode cmake config file. Seems to be needed on macOS.
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE)

find_package(Protobuf)


Expand All @@ -61,7 +69,7 @@ find_package(Protobuf)
#
#-----------------------------------------------------------------------------
message(STATUS "Looking for clang-tidy")
find_program(CLANG_TIDY NAMES clang-tidy clang-tidy-14 clang-tidy-13 clang-tidy-12 clang-tidy-11)
find_program(CLANG_TIDY NAMES clang-tidy-20 clang-tidy-19 clang-tidy-18 clang-tidy-17 clang-tidy-16 clang-tidy-15)

if(CLANG_TIDY AND PROTOBUF_FOUND)
message(STATUS "Looking for clang-tidy - found ${CLANG_TIDY}")
Expand Down Expand Up @@ -95,7 +103,7 @@ if(CPPCHECK)
message(STATUS "Looking for cppcheck - found")
add_custom_target(cppcheck
${CPPCHECK}
-Uassert --std=c++11 --enable=all
-Uassert --std=c++14 --enable=all
${CMAKE_SOURCE_DIR}/include/protozero/*.hpp
${CMAKE_SOURCE_DIR}/test/*.cpp
${CMAKE_SOURCE_DIR}/test/include/*.hpp
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ the Google Protobufs `protoc` program.

## Depends

* C++11 compiler
* C++14 compiler
* CMake
* Some tests depend on the Google Protobuf library, but use of Protozero
doesn't need it
Expand Down
Loading

0 comments on commit 5cc0ee5

Please sign in to comment.