diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1eadcc3..83179b0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,8 +18,8 @@ jobs: name: ${{ matrix.preset }} / ${{ matrix.os }} / ${{ matrix.compiler }} runs-on: ${{ matrix.os }} env: - CC: ${{ matrix.compiler == 'gcc' && 'gcc' || 'clang' }} - CXX: ${{ matrix.compiler == 'gcc' && 'g++' || 'clang++' }} + CC: ${{ matrix.compiler == 'gcc' && 'gcc-14' || 'clang' }} + CXX: ${{ matrix.compiler == 'gcc' && 'g++-14' || 'clang++' }} CCACHE_DIR: ${{ github.workspace }}/.ccache CCACHE_MAXSIZE: 200M strategy: @@ -43,6 +43,9 @@ jobs: name: Load CI env shell: bash run: cat .github/ci.env >> "$GITHUB_ENV" + - name: Install GCC 14 + if: runner.os == 'Linux' && matrix.compiler == 'gcc' + run: sudo apt-get update && sudo apt-get install -y gcc-14 g++-14 - uses: conan-io/setup-conan@v1 with: version: ${{ env.CONAN_VERSION }} @@ -101,18 +104,19 @@ jobs: name: coverage / ubuntu-latest / gcc runs-on: ubuntu-latest env: - CC: gcc - CXX: g++ + CC: gcc-14 + CXX: g++-14 CCACHE_DIR: ${{ github.workspace }}/.ccache CCACHE_MAXSIZE: 200M + GCOV_EXECUTABLE: gcov-14 steps: - uses: actions/checkout@v7 - *load-ci-env + - run: sudo apt-get update && sudo apt-get install -y ccache mold gcc-14 g++-14 - uses: conan-io/setup-conan@v1 with: version: ${{ env.CONAN_VERSION }} cache_packages: true - - run: sudo apt-get update && sudo apt-get install -y ccache mold - uses: actions/cache@v6 with: path: .ccache @@ -129,6 +133,9 @@ jobs: lint: runs-on: ubuntu-latest + env: + CC: clang + CXX: clang++ steps: - uses: actions/checkout@v7 - *load-ci-env diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 9b6af44..1e4edd1 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -19,6 +19,9 @@ jobs: analyze: name: codeql / ubuntu-latest / cpp runs-on: ubuntu-latest + env: + CC: gcc-14 + CXX: g++-14 permissions: actions: read contents: read @@ -29,6 +32,7 @@ jobs: # Tool pins live in .github/ci.env, shared across workflows. - name: Load CI env run: cat .github/ci.env >> "$GITHUB_ENV" + - run: sudo apt-get update && sudo apt-get install -y gcc-14 g++-14 - uses: github/codeql-action/init@v4 with: languages: c-cpp diff --git a/.github/workflows/template.yml b/.github/workflows/template.yml index fab27b3..3aa9b04 100644 --- a/.github/workflows/template.yml +++ b/.github/workflows/template.yml @@ -22,13 +22,14 @@ jobs: name: rename / ubuntu-latest / gcc runs-on: ubuntu-latest env: - CC: gcc - CXX: g++ + CC: gcc-14 + CXX: g++-14 steps: - uses: actions/checkout@v7 # Tool pins live in .github/ci.env, shared across workflows - name: Load CI env run: cat .github/ci.env >> "$GITHUB_ENV" + - run: sudo apt-get update && sudo apt-get install -y gcc-14 g++-14 - uses: conan-io/setup-conan@v1 with: version: ${{ env.CONAN_VERSION }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f417e2..b839730 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,7 @@ project( include(CTest) set(CMAKE_CXX_EXTENSIONS OFF) +set(CMAKE_CXX_SCAN_FOR_MODULES OFF) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_COLOR_DIAGNOSTICS ON diff --git a/README.md b/README.md index a435555..11b886a 100644 --- a/README.md +++ b/README.md @@ -86,9 +86,9 @@ stable across toolchain changes. - [mold](https://github.com/rui314/mold) or [LLD](https://lld.llvm.org/) (optional, Linux only; used automatically to link first-party targets when on PATH, with mold preferred) - [Doxygen](https://www.doxygen.nl) (optional; required only for `make docs`) -- A compiler and standard library with working C++23 support - - [GCC](https://gcc.gnu.org/) 13+ - - [LLVM Clang](https://llvm.org/) 17+ +- A compiler and standard library with C++23 `std::ranges::to` support + - [GCC](https://gcc.gnu.org/) 14+ + - [LLVM Clang](https://llvm.org/) 17+ with libc++ 17+ or libstdc++ 14+ - [Apple Clang](https://developer.apple.com/xcode/) 17+ recommended - [MSVC](https://visualstudio.microsoft.com/) 2022 (17.10+) on Windows diff --git a/src/main.cpp b/src/main.cpp index ddc721b..604e03d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -31,7 +31,7 @@ void run() // NOLINTNEXTLINE(bugprone-exception-escape) int main(int argc, char* argv[]) { - CLI::App app{"C++23 project template demo"}; + CLI::App app{"C++23 project template"}; app.set_version_flag("--version", std::string{cpp_boilerplate::version}); try { diff --git a/src/split.cpp b/src/split.cpp index 82dbea0..e492e16 100644 --- a/src/split.cpp +++ b/src/split.cpp @@ -1,14 +1,18 @@ #include +#include #include #include +#if !defined(__cpp_lib_ranges_to_container) || __cpp_lib_ranges_to_container < 202202L +#error "cpp-boilerplate requires C++23 std::ranges::to support" +#endif + namespace cpp_boilerplate { std::vector split_views_vec(std::string_view record, char delimiter) { - auto view = split_views(record, delimiter); - return {view.begin(), view.end()}; + return std::ranges::to(split_views(record, delimiter)); } } // namespace cpp_boilerplate