From c9096be2d943caa0fe79d368d57db16af446a412 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20S=2E=20Ga=C3=9Fmann?= Date: Fri, 6 Jun 2025 17:31:29 +0000 Subject: [PATCH 1/7] build: Update cpp-template to v0.4.0 --- .clang-format | 174 +++++++++---- .clang-tidy | 22 ++ .copier-answers.yml | 2 +- .devcontainer/devcontainer.json | 30 ++- .github/workflows/cpp-ci.yml | 95 +++---- .gitignore | 2 + .vscode/extensions.json | 10 +- .vscode/settings.json | 1 + CMakeLists.txt | 2 +- CMakePresets.json | 240 ++++++++++++++++-- sources.cmake | 4 +- src/dplx/cncr/uuid.fmt.hpp | 44 ++-- src/dplx/cncr/uuid.test.cpp | 8 +- tools/cmake/CompilerWarnings.cmake | 2 - tools/cmake/VcpkgDefaults.cmake | 3 - tools/config.hpp.in | 2 + tools/ports/fmt/portfile.cmake | 28 ++ tools/ports/fmt/usage | 8 + tools/ports/fmt/vcpkg.json | 17 ++ .../arm64-macos-clang-19-brew.cmake | 14 + ...lang-16.cmake => x64-linux-clang-19.cmake} | 5 +- tools/toolchains/x64-linux-clang-20.cmake | 10 + tools/toolchains/x64-linux-clang.cmake | 1 + tools/toolchains/x64-linux-gcc-12.cmake | 2 + tools/toolchains/x64-linux-gcc.cmake | 9 + .../toolchains/x64-macos-clang-16-brew.cmake | 12 - tools/toolchains/x64-macos-gcc-12.cmake | 7 +- ....cmake => arm64-macos-clang-19-brew.cmake} | 6 +- ...lang-16.cmake => x64-linux-clang-19.cmake} | 2 +- tools/triplets/x64-linux-clang-20.cmake | 6 + tools/triplets/x64-osx-gcc-12.cmake | 1 + vcpkg-configuration.json | 13 +- 32 files changed, 602 insertions(+), 180 deletions(-) create mode 100644 tools/ports/fmt/portfile.cmake create mode 100644 tools/ports/fmt/usage create mode 100644 tools/ports/fmt/vcpkg.json create mode 100644 tools/toolchains/arm64-macos-clang-19-brew.cmake rename tools/toolchains/{x64-linux-clang-16.cmake => x64-linux-clang-19.cmake} (57%) create mode 100644 tools/toolchains/x64-linux-clang-20.cmake create mode 100644 tools/toolchains/x64-linux-gcc.cmake delete mode 100644 tools/toolchains/x64-macos-clang-16-brew.cmake rename tools/triplets/{x64-osx-clang-16-brew.cmake => arm64-macos-clang-19-brew.cmake} (69%) rename tools/triplets/{x64-linux-clang-16.cmake => x64-linux-clang-19.cmake} (83%) create mode 100644 tools/triplets/x64-linux-clang-20.cmake diff --git a/.clang-format b/.clang-format index 3b396b9..3d974a5 100644 --- a/.clang-format +++ b/.clang-format @@ -3,7 +3,7 @@ BasedOnStyle: LLVM --- Language: Cpp -BasedOnStyle: LLVM +#BasedOnStyle: LLVM AccessModifierOffset: -4 AlignAfterOpenBracket: Align AlignArrayOfStructures: Right @@ -12,93 +12,138 @@ AlignConsecutiveAssignments: AcrossEmptyLines: false AcrossComments: false AlignCompound: false + AlignFunctionDeclarations: false + AlignFunctionPointers: false PadOperators: true AlignConsecutiveBitFields: Enabled: false AcrossEmptyLines: false AcrossComments: false AlignCompound: false + AlignFunctionDeclarations: false + AlignFunctionPointers: false PadOperators: false AlignConsecutiveDeclarations: Enabled: false AcrossEmptyLines: false AcrossComments: false AlignCompound: false + AlignFunctionDeclarations: true + AlignFunctionPointers: false PadOperators: false AlignConsecutiveMacros: Enabled: true AcrossEmptyLines: false AcrossComments: true AlignCompound: false + AlignFunctionDeclarations: false + AlignFunctionPointers: false + PadOperators: false +AlignConsecutiveShortCaseStatements: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCaseArrows: false + AlignCaseColons: false +AlignConsecutiveTableGenBreakingDAGArgColons: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionDeclarations: false + AlignFunctionPointers: false + PadOperators: false +AlignConsecutiveTableGenCondOperatorColons: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionDeclarations: false + AlignFunctionPointers: false + PadOperators: false +AlignConsecutiveTableGenDefinitionColons: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionDeclarations: false + AlignFunctionPointers: false PadOperators: false AlignEscapedNewlines: Right -AlignOperands: AlignAfterOperator -AlignTrailingComments: true +AlignOperands: Align +AlignTrailingComments: + Kind: Always + OverEmptyLines: 1 AllowAllArgumentsOnNextLine: true AllowAllParametersOfDeclarationOnNextLine: true -AllowShortEnumsOnASingleLine: true +AllowBreakBeforeNoexceptSpecifier: Never AllowShortBlocksOnASingleLine: Never +AllowShortCaseExpressionOnASingleLine: true AllowShortCaseLabelsOnASingleLine: false +AllowShortCompoundRequirementOnASingleLine: true +AllowShortEnumsOnASingleLine: false AllowShortFunctionsOnASingleLine: None -AllowShortLambdasOnASingleLine: Inline AllowShortIfStatementsOnASingleLine: Never +AllowShortLambdasOnASingleLine: Inline AllowShortLoopsOnASingleLine: false +AllowShortNamespacesOnASingleLine: false AlwaysBreakAfterDefinitionReturnType: None -AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: false -AlwaysBreakTemplateDeclarations: Yes AttributeMacros: - __capability - DPLX_ATTR_FORCE_INLINE - DPLX_ATTR_NO_UNIQUE_ADDRESS + - DPLX_ATTR_DP_DEPRECATED + - DPLX_ATTR_DP_DEPRECATED_ BinPackArguments: true -BinPackParameters: false +BinPackParameters: OnePerLine +BitFieldColonSpacing: Both BraceWrapping: AfterCaseLabel: false - AfterClass: false + AfterClass: true AfterControlStatement: Always - AfterEnum: false - AfterFunction: false - AfterNamespace: false + AfterEnum: true + AfterExternBlock: true + AfterFunction: true + AfterNamespace: true AfterObjCDeclaration: false - AfterStruct: false - AfterUnion: false - AfterExternBlock: false - BeforeCatch: false - BeforeElse: false + AfterStruct: true + AfterUnion: true + BeforeCatch: true + BeforeElse: true BeforeLambdaBody: false - BeforeWhile: false + BeforeWhile: true IndentBraces: false SplitEmptyFunction: true SplitEmptyRecord: true SplitEmptyNamespace: true +BreakAdjacentStringLiterals: true +BreakAfterAttributes: Leave +BreakAfterJavaFieldAnnotations: true +BreakAfterReturnType: None +BreakArrays: false BreakBeforeBinaryOperators: All BreakBeforeConceptDeclarations: Always -BreakBeforeBraces: Allman -BreakBeforeInheritanceComma: false -BreakInheritanceList: BeforeComma +BreakBeforeBraces: Custom +BreakBeforeInlineASMColon: OnlyMultiline BreakBeforeTernaryOperators: true -BreakConstructorInitializersBeforeComma: false +BreakBinaryOperations: Never BreakConstructorInitializers: BeforeComma -BreakAfterJavaFieldAnnotations: false +BreakFunctionDefinitionParameters: false +BreakInheritanceList: BeforeComma BreakStringLiterals: true +BreakTemplateDeclarations: Yes ColumnLimit: 80 CommentPragmas: '^ IWYU pragma:' -QualifierAlignment: Right CompactNamespaces: false ConstructorInitializerIndentWidth: 4 ContinuationIndentWidth: 8 Cpp11BracedListStyle: true -DeriveLineEnding: true DerivePointerAlignment: false DisableFormat: false EmptyLineAfterAccessModifier: Never EmptyLineBeforeAccessModifier: LogicalBlock ExperimentalAutoDetectBinPacking: false -PackConstructorInitializers: Never -# deprecated, replaced by PackConstructorInitializers -#ConstructorInitializerAllOnOneLineOrOnePerLine: true -#AllowAllConstructorInitializersOnNextLine: false FixNamespaceComments: true ForEachMacros: - foreach @@ -109,41 +154,62 @@ IncludeBlocks: Regroup IncludeCategories: - Regex: '^<[[:alpha:]_]*>$' Priority: 2 + SortPriority: 0 CaseSensitive: false - Regex: '^ boost-*, + -boost-use-ranges, bugprone-*, -bugprone-easily-swappable-parameters, + -bugprone-forward-declaration-namespace, clang-analyzer-*, + -clang-analyzer-core.uninitialized.Assign, + -clang-analyzer-optin.core.EnumCastOutOfRange, clang-diagnostic-*, cppcoreguidelines-*, -cppcoreguidelines-avoid-c-arrays, + -cppcoreguidelines-avoid-do-while, + -cppcoreguidelines-missing-std-forward, + -cppcoreguidelines-rvalue-reference-param-not-moved, -cppcoreguidelines-special-member-functions, + -cppcoreguidelines-use-default-member-init, modernize-*, -modernize-avoid-c-arrays, + -cppcoreguidelines-avoid-do-while, -modernize-use-default-member-init, + -modernize-use-designated-initializers, + -modernize-use-ranges, performance-*, + -performance-enum-size, portability-*, + -portability-template-virtual-member-function, readability-*, -readability-identifier-length, -readability-magic-numbers, -readability-named-parameter, + -readability-redundant-inline-specifier, -readability-redundant-member-init, -readability-static-accessed-through-instance WarningsAsErrors: true diff --git a/.copier-answers.yml b/.copier-answers.yml index 1198b65..73bf49a 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: v0.3.2 +_commit: v0.4.0 _src_path: gh:deeplex/copier-cpp email: henrik@gassmann.onl full_name: Henrik Steffen Gaßmann diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 943b21f..e328bd5 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,21 +1,37 @@ -// For format details, see https://aka.ms/devcontainer.json. For config options, see the -// README at: https://github.com/devcontainers/templates/tree/main/src/cpp { - "name": "C++", - "image": "ghcr.io/deeplex/devcontainer-cpp:ubuntu-22.04", + "name": "Deeplex | C++", + "image": "ghcr.io/deeplex/devcontainer-cpp:ubuntu-24.04", "customizations": { "vscode": { "extensions": [ + // general editor utility "EditorConfig.EditorConfig", + // GitHub integration "github.vscode-github-actions", + "GitHub.vscode-pull-request-github", + // C++ + "llvm-vs-code-extensions.vscode-clangd", + "ms-vscode.cmake-tools", + // sphinx "lextudio.restructuredtext", "ms-python.python", - "ms-vscode.cpptools", - "ms-vscode.cmake-tools", "trond-snekvik.simple-rst", - "twxs.cmake", ] } }, + "features": { + "ghcr.io/devcontainers/features/common-utils:2": { + "installZsh": true, + "installOhMyZsh": true, + "installOhMyZshConfig": true, + "upgradePackages": true, + "username": "vscode" + }, + "ghcr.io/devcontainers/features/python:1": { + "version": "os-provided", + "installTools": true, + "toolsToInstall": "copier,pipenv" + } + }, "postCreateCommand": "cd ${containerWorkspaceFolder}/docs && pipenv sync --dev", } \ No newline at end of file diff --git a/.github/workflows/cpp-ci.yml b/.github/workflows/cpp-ci.yml index 682e99a..bc48de3 100644 --- a/.github/workflows/cpp-ci.yml +++ b/.github/workflows/cpp-ci.yml @@ -14,36 +14,38 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-13, ubuntu-22.04, windows-2022] + os: [ubuntu-24.04, windows-2022] compiler: [gcc, clang, msvc] exclude: - - os: macos-13 - compiler: msvc - - os: ubuntu-22.04 + - os: ubuntu-24.04 compiler: msvc - os: windows-2022 compiler: gcc include: - os: macos-13 + compiler: gcc triplet: x64-macos - - os: macos-13 + - os: macos-15 compiler: clang - triplet: x64-macos + triplet: arm64-macos install: | - HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install llvm@16 - - os: ubuntu-22.04 + HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install llvm@19 + - os: ubuntu-24.04 triplet: x64-linux - - os: ubuntu-22.04 + - os: ubuntu-24.04 triplet: x64-linux compiler: clang install: | sudo cp tools/llvm-snapshot.gpg.key.asc /etc/apt/trusted.gpg.d/llvm-snapshot.asc - sudo add-apt-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main" + sudo add-apt-repository "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-19 main" sudo apt-get -qq update - sudo apt-get -qq -y install clang-16 + sudo apt-get -qq -y install clang-19 - os: windows-2022 triplet: x64-windows + permissions: + actions: read + env: CTEST_OUTPUT_ON_FAILURE: "1" @@ -56,69 +58,81 @@ jobs: - uses: lukka/get-cmake@latest with: - cmakeVersion: 3.22.6 + cmakeVersion: 3.31.7 + + - name: Restore vcpkg cache + id: vcpkg-cache + uses: TAServers/vcpkg-cache@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + prefix: vcpkg/${{ matrix.triplet }}-${{ matrix.compiler }}/ - name: Initialize vcpkg - uses: lukka/run-vcpkg@v11 + uses: lukka/run-vcpkg@b3dd708d38df5c856fe1c18dc0d59ab771f93921 with: vcpkgDirectory: ${{ github.workspace }}/build/vcpkg - vcpkgGitCommitId: a42af01b72c28a8e1d7b48107b33e4f286a55ef6 - - name: Build ${{ matrix.triplet }}-${{ matrix.compiler }} preset + - name: Build ${{ matrix.triplet }}-${{ matrix.compiler }}-ci preset uses: lukka/run-cmake@v10 with: - configurePreset: ${{ matrix.triplet }}-${{ matrix.compiler }} - buildPreset: ${{ matrix.triplet }}-${{ matrix.compiler }} - testPreset: ${{ matrix.triplet }}-${{ matrix.compiler }} + configurePreset: ${{ matrix.triplet }}-${{ matrix.compiler }}-ci + buildPreset: ${{ matrix.triplet }}-${{ matrix.compiler }}-ci + testPreset: ${{ matrix.triplet }}-${{ matrix.compiler }}-ci env: CC: '' CXX: '' + VCPKG_BINARY_SOURCES: "clear;files,${{ steps.vcpkg-cache.outputs.path }},readwrite" - - name: Build ${{ matrix.triplet }}-${{ matrix.compiler }}-release preset + - name: Build ${{ matrix.triplet }}-${{ matrix.compiler }}-ci-release preset uses: lukka/run-cmake@v10 with: - configurePreset: ${{ matrix.triplet }}-${{ matrix.compiler }} - buildPreset: ${{ matrix.triplet }}-${{ matrix.compiler }}-release - testPreset: ${{ matrix.triplet }}-${{ matrix.compiler }}-release + configurePreset: ${{ matrix.triplet }}-${{ matrix.compiler }}-ci + buildPreset: ${{ matrix.triplet }}-${{ matrix.compiler }}-ci-release + testPreset: ${{ matrix.triplet }}-${{ matrix.compiler }}-ci-release env: CC: '' CXX: '' - - - name: Prevent uploading a corrupted vcpkg cache - if: ${{ failure() || cancelled() }} - run: | - echo "RUNVCPKG_NO_CACHE=1" >> $GITHUB_ENV - shell: bash - + VCPKG_BINARY_SOURCES: "clear;files,${{ steps.vcpkg-cache.outputs.path }},readwrite" check-format: name: clang-tidy & clang-format - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 + + permissions: + actions: read steps: - uses: actions/checkout@v3 - - name: "Install clang-tools-16" + - name: "Install clang-tools-20" run: | sudo cp ${{ github.workspace }}/tools/llvm-snapshot.gpg.key.asc /etc/apt/trusted.gpg.d/llvm-snapshot.asc - sudo add-apt-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main" + sudo add-apt-repository "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-20 main" sudo apt-get -qq update - sudo apt-get -qq -y install clang-16 clang-tidy-16 clang-format-16 + sudo apt-get -qq -y install clang-20 clang-tidy-20 clang-format-20 - uses: lukka/get-cmake@latest with: - cmakeVersion: 3.22.6 + cmakeVersion: 3.31.7 + + - name: Restore vcpkg cache + id: vcpkg-cache + uses: TAServers/vcpkg-cache@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + prefix: vcpkg/lint/ - name: Initialize vcpkg - uses: lukka/run-vcpkg@v11 + uses: lukka/run-vcpkg@b3dd708d38df5c856fe1c18dc0d59ab771f93921 with: vcpkgDirectory: ${{ github.workspace }}/../vcpkg - vcpkgGitCommitId: a42af01b72c28a8e1d7b48107b33e4f286a55ef6 - - name: Configure x64-linux-clang preset + - name: Configure x64-linux-ci-lint preset uses: lukka/run-cmake@v10 with: configurePreset: x64-linux-ci-lint + env: + VCPKG_BINARY_SOURCES: "clear;files,${{ steps.vcpkg-cache.outputs.path }},readwrite" - uses: cpp-linter/cpp-linter-action@v2 name: Lint with clang-format and clang-tidy @@ -126,7 +140,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - version: 16.0.6 + version: 20 style: file # use .clang-format settings tidy-checks: '' # use .clang-tidy settings extensions: cpp,hpp @@ -137,8 +151,3 @@ jobs: - name: Fail if issues have been raised if: steps.linter.outputs.checks-failed > 0 run: exit 1 - - - if: ${{ failure() || cancelled() }} - run: | - echo "RUNVCPKG_NO_CACHE=1" >> $GITHUB_ENV - shell: bash diff --git a/.gitignore b/.gitignore index 03d47e0..e5481f2 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,5 @@ build/ /.idea /cmake-build-debug /cmake-build-release +# cache directory used eg by clangd +.cache diff --git a/.vscode/extensions.json b/.vscode/extensions.json index d61d539..7bbe9cf 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,12 +1,16 @@ { "recommendations": [ + // general editor utility "EditorConfig.EditorConfig", + // GitHub integration "github.vscode-github-actions", + "GitHub.vscode-pull-request-github", + // C++ + "llvm-vs-code-extensions.vscode-clangd", + "ms-vscode.cmake-tools", + // sphinx "lextudio.restructuredtext", "ms-python.python", - "ms-vscode.cpptools-extension-pack", - "ms-vscode.cmake-tools", "trond-snekvik.simple-rst", - "twxs.cmake", ] } \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 7894eee..5c589c0 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -80,6 +80,7 @@ "ranges": "cpp", "ratio": "cpp", "regex": "cpp", + "resumable": "cpp", "scoped_allocator": "cpp", "semaphore": "cpp", "set": "cpp", diff --git a/CMakeLists.txt b/CMakeLists.txt index a667605..6790318 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ # http://creativecommons.org/publicdomain/zero/1.0/ # ######################################################################## -cmake_minimum_required(VERSION 3.22) +cmake_minimum_required(VERSION 3.23...4.0) list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/tools/cmake/") ######################################################################## diff --git a/CMakePresets.json b/CMakePresets.json index c7ef595..4868136 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -16,6 +16,7 @@ "BUILD_TESTING": true, "WARNINGS_AS_ERRORS": true, "CMAKE_DEBUG_POSTFIX": "-dbg", + "CMAKE_EXPORT_COMPILE_COMMANDS": true, "CMAKE_INSTALL_PREFIX": "${sourceDir}/build/zinstall" } }, @@ -33,8 +34,7 @@ "CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreaded$<$:Debug>", "VCPKG_TARGET_TRIPLET": "x64-windows-static" }, - "environment": { - }, + "environment": {}, "vendor": { "microsoft.com/VisualStudioSettings/CMake/1.0": { "hostOS": [ @@ -52,6 +52,12 @@ "CMAKE_CXX_COMPILER": "cl" } }, + { + "name": "x64-windows-msvc-ci", + "inherits": [ + "x64-windows-msvc" + ] + }, { "name": "x64-windows-msvc-lto", "inherits": [ @@ -86,6 +92,12 @@ } } }, + { + "name": "x64-windows-clang-ci", + "inherits": [ + "x64-windows-clang" + ] + }, { "name": "x64-linux", "hidden": true, @@ -126,38 +138,76 @@ "x64-linux" ], "cacheVariables": { - "VCPKG_TARGET_TRIPLET": "x64-linux-clang-16", - "VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/tools/toolchains/x64-linux-clang-16.cmake" + "VCPKG_TARGET_TRIPLET": "x64-linux-clang", + "VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/tools/toolchains/x64-linux-clang.cmake" } }, { - "name": "x64-linux-ci-lint", + "name": "x64-linux-clang-19", + "inherits": [ + "x64-linux-clang" + ], + "cacheVariables": { + "VCPKG_TARGET_TRIPLET": "x64-linux-clang-19", + "VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/tools/toolchains/x64-linux-clang-19.cmake" + } + }, + { + "name": "x64-linux-clang-20", "inherits": [ "x64-linux-clang" ], "cacheVariables": { - "VCPKG_TARGET_TRIPLET": "x64-linux-clang-16", - "VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/tools/toolchains/x64-linux-clang-16.cmake", - "CMAKE_EXPORT_COMPILE_COMMANDS": true + "VCPKG_TARGET_TRIPLET": "x64-linux-clang-20", + "VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/tools/toolchains/x64-linux-clang-20.cmake" } }, + { + "name": "x64-linux-clang-ci", + "inherits": [ + "x64-linux-clang-19" + ] + }, + { + "name": "x64-linux-ci-lint", + "inherits": [ + "x64-linux-clang-20" + ] + }, { "name": "x64-linux-gcc", "inherits": [ "x64-linux" ], "cacheVariables": { - "VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/tools/toolchains/x64-linux-gcc-12.cmake", + "VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/tools/toolchains/x64-linux-gcc.cmake", "CMAKE_CXX_FLAGS": "-fconcepts-diagnostics-depth=0 -ftemplate-backtrace-limit=0 -fsanitize=address,leak,undefined -g -fno-omit-frame-pointer", "CMAKE_EXE_LINKER_FLAGS": "-fsanitize=address,leak,undefined" } }, { - "name": "x64-macos", - "hidden": true, - "inherits": [ "base" ], + "name": "x64-linux-gcc-12", + "inherits": [ + "x64-linux-gcc" + ], "cacheVariables": { - "VCPKG_TARGET_TRIPLET": "x64-osx" + "VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/tools/toolchains/x64-linux-gcc-12.cmake" + } + }, + { + "name": "x64-linux-gcc-ci", + "inherits": [ + "x64-linux-gcc-12" + ] + }, + { + "name": "arm64-macos-clang", + "inherits": [ + "base" + ], + "cacheVariables": { + "VCPKG_TARGET_TRIPLET": "arm64-macos-clang-19-brew", + "VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/tools/toolchains/arm64-macos-clang-19-brew.cmake" }, "vendor": { "microsoft.com/VisualStudioSettings/CMake/1.0": { @@ -168,20 +218,33 @@ } }, { - "name": "x64-macos-clang", - "inherits": [ "x64-macos" ], - "cacheVariables": { - "VCPKG_TARGET_TRIPLET": "x64-osx-clang-16-brew", - "VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/tools/toolchains/x64-macos-clang-16-brew.cmake" - } + "name": "arm64-macos-clang-ci", + "inherits": [ + "arm64-macos-clang" + ] }, { "name": "x64-macos-gcc", - "inherits": [ "x64-macos" ], + "inherits": [ + "base" + ], "cacheVariables": { "VCPKG_TARGET_TRIPLET": "x64-osx-gcc-12", "VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/tools/toolchains/x64-macos-gcc-12.cmake" + }, + "vendor": { + "microsoft.com/VisualStudioSettings/CMake/1.0": { + "hostOS": [ + "macOS" + ] + } } + }, + { + "name": "x64-macos-gcc-ci", + "inherits": [ + "x64-macos-gcc" + ] } ], "buildPresets": [ @@ -195,6 +258,16 @@ "inherits": "x64-windows-msvc", "configuration": "RelWithDebInfo" }, + { + "name": "x64-windows-msvc-ci", + "configurePreset": "x64-windows-msvc-ci", + "configuration": "Debug" + }, + { + "name": "x64-windows-msvc-ci-release", + "inherits": "x64-windows-msvc-ci", + "configuration": "RelWithDebInfo" + }, { "name": "x64-windows-clang", "configurePreset": "x64-windows-clang", @@ -205,6 +278,16 @@ "inherits": "x64-windows-clang", "configuration": "RelWithDebInfo" }, + { + "name": "x64-windows-clang-ci", + "configurePreset": "x64-windows-clang-ci", + "configuration": "Debug" + }, + { + "name": "x64-windows-clang-ci-release", + "inherits": "x64-windows-clang-ci", + "configuration": "RelWithDebInfo" + }, { "name": "x64-linux-clang", "configurePreset": "x64-linux-clang", @@ -215,6 +298,16 @@ "inherits": "x64-linux-clang", "configuration": "RelWithDebInfo" }, + { + "name": "x64-linux-clang-ci", + "configurePreset": "x64-linux-clang-ci", + "configuration": "Debug" + }, + { + "name": "x64-linux-clang-ci-release", + "inherits": "x64-linux-clang-ci", + "configuration": "RelWithDebInfo" + }, { "name": "x64-linux-gcc", "configurePreset": "x64-linux-gcc", @@ -226,13 +319,33 @@ "configuration": "RelWithDebInfo" }, { - "name": "x64-macos-clang", - "configurePreset": "x64-macos-clang", + "name": "x64-linux-gcc-ci", + "configurePreset": "x64-linux-gcc-ci", + "configuration": "Debug" + }, + { + "name": "x64-linux-gcc-ci-release", + "inherits": "x64-linux-gcc-ci", + "configuration": "RelWithDebInfo" + }, + { + "name": "arm64-macos-clang", + "configurePreset": "arm64-macos-clang", + "configuration": "Debug" + }, + { + "name": "arm64-macos-clang-release", + "inherits": "arm64-macos-clang", + "configuration": "RelWithDebInfo" + }, + { + "name": "arm64-macos-clang-ci", + "configurePreset": "arm64-macos-clang-ci", "configuration": "Debug" }, { - "name": "x64-macos-clang-release", - "inherits": "x64-macos-clang", + "name": "arm64-macos-clang-ci-release", + "inherits": "arm64-macos-clang-ci", "configuration": "RelWithDebInfo" }, { @@ -244,6 +357,16 @@ "name": "x64-macos-gcc-release", "inherits": "x64-macos-gcc", "configuration": "RelWithDebInfo" + }, + { + "name": "x64-macos-gcc-ci", + "configurePreset": "x64-macos-gcc-ci", + "configuration": "Debug" + }, + { + "name": "x64-macos-gcc-ci-release", + "inherits": "x64-macos-gcc-ci", + "configuration": "RelWithDebInfo" } ], "testPresets": [ @@ -265,6 +388,16 @@ "inherits": "x64-windows-msvc", "configuration": "RelWithDebInfo" }, + { + "name": "x64-windows-msvc-ci", + "configurePreset": "x64-windows-msvc-ci", + "configuration": "Debug" + }, + { + "name": "x64-windows-msvc-ci-release", + "inherits": "x64-windows-msvc-ci", + "configuration": "RelWithDebInfo" + }, { "name": "x64-windows-clang", "configurePreset": "x64-windows-clang", @@ -275,6 +408,16 @@ "inherits": "x64-windows-clang", "configuration": "RelWithDebInfo" }, + { + "name": "x64-windows-clang-ci", + "configurePreset": "x64-windows-clang-ci", + "configuration": "Debug" + }, + { + "name": "x64-windows-clang-ci-release", + "inherits": "x64-windows-clang-ci", + "configuration": "RelWithDebInfo" + }, { "name": "x64-linux-clang", "configurePreset": "x64-linux-clang", @@ -285,6 +428,16 @@ "inherits": "x64-linux-clang", "configuration": "RelWithDebInfo" }, + { + "name": "x64-linux-clang-ci", + "configurePreset": "x64-linux-clang-ci", + "configuration": "Debug" + }, + { + "name": "x64-linux-clang-ci-release", + "inherits": "x64-linux-clang-ci", + "configuration": "RelWithDebInfo" + }, { "name": "x64-linux-gcc", "inherits": "sanitizer_env", @@ -297,13 +450,34 @@ "configuration": "RelWithDebInfo" }, { - "name": "x64-macos-clang", - "configurePreset": "x64-macos-clang", + "name": "x64-linux-gcc-ci", + "inherits": "sanitizer_env", + "configurePreset": "x64-linux-gcc-ci", "configuration": "Debug" }, { - "name": "x64-macos-clang-release", - "inherits": "x64-macos-clang", + "name": "x64-linux-gcc-ci-release", + "inherits": "x64-linux-gcc-ci", + "configuration": "RelWithDebInfo" + }, + { + "name": "arm64-macos-clang", + "configurePreset": "arm64-macos-clang", + "configuration": "Debug" + }, + { + "name": "arm64-macos-clang-release", + "inherits": "arm64-macos-clang", + "configuration": "RelWithDebInfo" + }, + { + "name": "arm64-macos-clang-ci", + "configurePreset": "arm64-macos-clang-ci", + "configuration": "Debug" + }, + { + "name": "arm64-macos-clang-ci-release", + "inherits": "arm64-macos-clang-ci", "configuration": "RelWithDebInfo" }, { @@ -316,6 +490,16 @@ "name": "x64-macos-gcc-release", "inherits": "x64-macos-gcc", "configuration": "RelWithDebInfo" + }, + { + "name": "x64-macos-gcc-ci", + "configurePreset": "x64-macos-gcc-ci", + "configuration": "Debug" + }, + { + "name": "x64-macos-gcc-ci-release", + "inherits": "x64-macos-gcc-ci", + "configuration": "RelWithDebInfo" } ] } \ No newline at end of file diff --git a/sources.cmake b/sources.cmake index 658e6a9..4c9be40 100644 --- a/sources.cmake +++ b/sources.cmake @@ -24,8 +24,8 @@ dplx_target_sources(concrete scope_guard ) -file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/generated/src/dplx/cncr/detail) -configure_file(tools/config.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/generated/src/dplx/cncr/detail/config.hpp @ONLY) +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/generated/src/dplx/cncr/detail") +configure_file(tools/config.hpp.in "${CMAKE_CURRENT_BINARY_DIR}/generated/src/dplx/cncr/detail/config.hpp" @ONLY) target_sources(concrete PUBLIC $) dplx_target_sources(concrete diff --git a/src/dplx/cncr/uuid.fmt.hpp b/src/dplx/cncr/uuid.fmt.hpp index 75f5f86..c90af5a 100644 --- a/src/dplx/cncr/uuid.fmt.hpp +++ b/src/dplx/cncr/uuid.fmt.hpp @@ -11,12 +11,12 @@ #include -#if __cpp_lib_format >= 202106L +#if __cpp_lib_format >= 202'106L #include #endif -#if __has_include() -#include +#if __has_include() +#include #endif namespace dplx::cncr::detail @@ -28,11 +28,7 @@ enum class uuid_format_casing : unsigned char upper = 0x10, }; -template - typename ParseContext, - template - typename FormatContext> +template typename ParseContext> requires has_uuid_encoding_lut struct basic_uuid_formatter { @@ -41,9 +37,10 @@ struct basic_uuid_formatter bool mAlternateForm{false}; public: - constexpr auto parse(ParseContext &ctx) -> + constexpr auto parse(ParseContext &ctx) noexcept -> typename ParseContext::iterator { + constexpr auto formatSpecEnd = uuid_encoding_lut[34]; constexpr auto alternateForm = uuid_encoding_lut[35]; constexpr auto lowerHex = uuid_encoding_lut[36]; constexpr auto upperHex = uuid_encoding_lut[37]; @@ -52,7 +49,7 @@ struct basic_uuid_formatter auto it = ctx.begin(); auto const end = ctx.end(); - if (it == end) + if (it == end || *it == formatSpecEnd) { return it; } @@ -78,11 +75,11 @@ struct basic_uuid_formatter } return it; } - template - constexpr auto format(dplx::cncr::uuid value, - FormatContext &ctx) const -> OutIt + template + constexpr auto format(dplx::cncr::uuid value, FormatContext &ctx) const -> + typename FormatContext::iterator { - return detail::format_uuid_to( + return detail::format_uuid_to( value, ctx.out(), static_cast(mCasing), mAlternateForm); } @@ -90,17 +87,16 @@ struct basic_uuid_formatter } // namespace dplx::cncr::detail -#if __cpp_lib_format >= 202106L +#if __cpp_lib_format >= 202'106L template struct std::formatter : dplx::cncr::detail::basic_uuid_formatter + std::basic_format_parse_context> { }; #endif -#if __has_include() +#if __has_include() namespace dplx::cncr::detail { @@ -110,11 +106,17 @@ using fmt_basic_format_parse_context = fmt::basic_format_parse_context; } template -struct fmt::formatter +struct fmt::formatter : dplx::cncr::detail::basic_uuid_formatter< CharT, - dplx::cncr::detail::fmt_basic_format_parse_context, - fmt::basic_format_context> + dplx::cncr::detail::fmt_basic_format_parse_context> +{ +}; +template <> +struct fmt::formatter + : dplx::cncr::detail::basic_uuid_formatter< + char, + dplx::cncr::detail::fmt_basic_format_parse_context> { }; #endif diff --git a/src/dplx/cncr/uuid.test.cpp b/src/dplx/cncr/uuid.test.cpp index 71d9a1e..e50b91c 100644 --- a/src/dplx/cncr/uuid.test.cpp +++ b/src/dplx/cncr/uuid.test.cpp @@ -12,8 +12,10 @@ // #include +#include #include +#include #include @@ -24,6 +26,10 @@ namespace cncr_tests { +#if __has_include() +static_assert(std::is_constructible_v>); +#endif + namespace { @@ -124,7 +130,7 @@ TEST_CASE("a uuid is correctly stringified") CHECK(stringified == "{47183823-2574-4BFD-B411-99ED177D3E43}"sv); } #endif -#if __has_include() +#if __has_include() SECTION("via fmt::format") { auto const stringified = fmt::format("{}", subject); diff --git a/tools/cmake/CompilerWarnings.cmake b/tools/cmake/CompilerWarnings.cmake index 2499d6c..3879df8 100644 --- a/tools/cmake/CompilerWarnings.cmake +++ b/tools/cmake/CompilerWarnings.cmake @@ -30,8 +30,6 @@ set(CLANG_WARNINGS -Wall -Wextra # reasonable and standard -Wshadow # warn the user if a variable declaration shadows one from a parent context - -Wnon-virtual-dtor # warn the user if a class with virtual functions has a non-virtual destructor. This helps - # catch hard to track down memory errors -Wold-style-cast # warn for c-style casts -Wcast-align # warn for potential performance problem casts -Wunused # warn on anything being unused diff --git a/tools/cmake/VcpkgDefaults.cmake b/tools/cmake/VcpkgDefaults.cmake index 618a940..dfc96be 100644 --- a/tools/cmake/VcpkgDefaults.cmake +++ b/tools/cmake/VcpkgDefaults.cmake @@ -11,6 +11,3 @@ endif() if(NOT DEFINED VCPKG_FEATURE_FLAGS) set(VCPKG_FEATURE_FLAGS "registries" CACHE STRING "") endif() -if(NOT DEFINED VCPKG_OVERLAY_TRIPLETS) - set(VCPKG_OVERLAY_TRIPLETS "${CMAKE_SOURCE_DIR}/tools/triplets" CACHE STRING "") -endif() diff --git a/tools/config.hpp.in b/tools/config.hpp.in index 6d5e5a7..38cade7 100644 --- a/tools/config.hpp.in +++ b/tools/config.hpp.in @@ -9,11 +9,13 @@ // NOLINTBEGIN(modernize-macro-to-enum) // NOLINTBEGIN(cppcoreguidelines-macro-usage) +// NOLINTBEGIN(cppcoreguidelines-macro-to-enum) #cmakedefine01 DPLX_CNCR_USE_STD_BYTESWAP #cmakedefine01 DPLX_CNCR_DISABLE_WORKAROUNDS #cmakedefine01 DPLX_CNCR_FLAG_OUTDATED_WORKAROUNDS +// NOLINTEND(cppcoreguidelines-macro-to-enum) // NOLINTEND(cppcoreguidelines-macro-usage) // NOLINTEND(modernize-macro-to-enum) diff --git a/tools/ports/fmt/portfile.cmake b/tools/ports/fmt/portfile.cmake new file mode 100644 index 0000000..81fd4ff --- /dev/null +++ b/tools/ports/fmt/portfile.cmake @@ -0,0 +1,28 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO fmtlib/fmt + REF "${VERSION}" + SHA512 46974efd36e613477351aa357c451cee434da797c2a505f9f86d73e394dcb35dc2dc0cda66abb98c023e8f24deac9d8e3ee6f9f6c0971cc4c00e37c34aa7f15f + HEAD_REF master +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DFMT_CMAKE_DIR=share/fmt + -DFMT_TEST=OFF + -DFMT_DOC=OFF +) + +vcpkg_cmake_install() +vcpkg_cmake_config_fixup() +vcpkg_fixup_pkgconfig() +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE + "${CURRENT_PACKAGES_DIR}/debug/include" + "${CURRENT_PACKAGES_DIR}/debug/share" +) + +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/tools/ports/fmt/usage b/tools/ports/fmt/usage new file mode 100644 index 0000000..e5a9d70 --- /dev/null +++ b/tools/ports/fmt/usage @@ -0,0 +1,8 @@ +The package fmt provides CMake targets: + + find_package(fmt CONFIG REQUIRED) + target_link_libraries(main PRIVATE fmt::fmt) + + # Or use the header-only version + find_package(fmt CONFIG REQUIRED) + target_link_libraries(main PRIVATE fmt::fmt-header-only) diff --git a/tools/ports/fmt/vcpkg.json b/tools/ports/fmt/vcpkg.json new file mode 100644 index 0000000..0ed7a4f --- /dev/null +++ b/tools/ports/fmt/vcpkg.json @@ -0,0 +1,17 @@ +{ + "name": "fmt", + "version": "11.2.0", + "description": "{fmt} is an open-source formatting library providing a fast and safe alternative to C stdio and C++ iostreams.", + "homepage": "https://github.com/fmtlib/fmt", + "license": "MIT", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} \ No newline at end of file diff --git a/tools/toolchains/arm64-macos-clang-19-brew.cmake b/tools/toolchains/arm64-macos-clang-19-brew.cmake new file mode 100644 index 0000000..68587e6 --- /dev/null +++ b/tools/toolchains/arm64-macos-clang-19-brew.cmake @@ -0,0 +1,14 @@ +set(CMAKE_SYSTEM_PROCESSOR arm64) + +execute_process(COMMAND brew --prefix llvm@19 OUTPUT_VARIABLE BREW_LLVM_PATH OUTPUT_STRIP_TRAILING_WHITESPACE) + +set(CMAKE_C_COMPILER "${BREW_LLVM_PATH}/bin/clang") +set(CMAKE_CXX_COMPILER "${BREW_LLVM_PATH}/bin/clang++") +set(CMAKE_OSX_DEPLOYMENT_TARGET 15.5 CACHE STRING "OSX deployment target") +set(CMAKE_OSX_ARCHITECTURES arm64 CACHE STRING "OSX target architectures") + +set(CMAKE_C_STANDARD 17 CACHE STRING "C standard") +set(CMAKE_CXX_STANDARD 20 CACHE STRING "C++ standard") + +set(CMAKE_CXX_FLAGS_INIT "-fsized-deallocation") +set(CMAKE_CXX_SCAN_FOR_MODULES OFF) diff --git a/tools/toolchains/x64-linux-clang-16.cmake b/tools/toolchains/x64-linux-clang-19.cmake similarity index 57% rename from tools/toolchains/x64-linux-clang-16.cmake rename to tools/toolchains/x64-linux-clang-19.cmake index c4733c6..f296780 100644 --- a/tools/toolchains/x64-linux-clang-16.cmake +++ b/tools/toolchains/x64-linux-clang-19.cmake @@ -1,9 +1,10 @@ set(CMAKE_SYSTEM_PROCESSOR AMD64) -set(CMAKE_C_COMPILER clang-16) -set(CMAKE_CXX_COMPILER clang++-16) +set(CMAKE_C_COMPILER clang-19) +set(CMAKE_CXX_COMPILER clang++-19) set(CMAKE_C_STANDARD 17) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_FLAGS_INIT "-fsized-deallocation") +set(CMAKE_CXX_SCAN_FOR_MODULES OFF) diff --git a/tools/toolchains/x64-linux-clang-20.cmake b/tools/toolchains/x64-linux-clang-20.cmake new file mode 100644 index 0000000..274a783 --- /dev/null +++ b/tools/toolchains/x64-linux-clang-20.cmake @@ -0,0 +1,10 @@ +set(CMAKE_SYSTEM_PROCESSOR AMD64) + +set(CMAKE_C_COMPILER clang-20) +set(CMAKE_CXX_COMPILER clang++-20) + +set(CMAKE_C_STANDARD 17) +set(CMAKE_CXX_STANDARD 20) + +set(CMAKE_CXX_FLAGS_INIT "-fsized-deallocation") +set(CMAKE_CXX_SCAN_FOR_MODULES OFF) diff --git a/tools/toolchains/x64-linux-clang.cmake b/tools/toolchains/x64-linux-clang.cmake index 5220a4f..20e20f7 100644 --- a/tools/toolchains/x64-linux-clang.cmake +++ b/tools/toolchains/x64-linux-clang.cmake @@ -7,3 +7,4 @@ set(CMAKE_C_STANDARD 17) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_FLAGS_INIT "-fsized-deallocation") +set(CMAKE_CXX_SCAN_FOR_MODULES OFF) diff --git a/tools/toolchains/x64-linux-gcc-12.cmake b/tools/toolchains/x64-linux-gcc-12.cmake index a1790c6..92919b5 100644 --- a/tools/toolchains/x64-linux-gcc-12.cmake +++ b/tools/toolchains/x64-linux-gcc-12.cmake @@ -5,3 +5,5 @@ set(CMAKE_CXX_COMPILER g++-12) set(CMAKE_C_STANDARD 17) set(CMAKE_CXX_STANDARD 20) + +set(CMAKE_CXX_SCAN_FOR_MODULES OFF) diff --git a/tools/toolchains/x64-linux-gcc.cmake b/tools/toolchains/x64-linux-gcc.cmake new file mode 100644 index 0000000..d16cb89 --- /dev/null +++ b/tools/toolchains/x64-linux-gcc.cmake @@ -0,0 +1,9 @@ +set(CMAKE_SYSTEM_PROCESSOR AMD64) + +set(CMAKE_C_COMPILER gcc) +set(CMAKE_CXX_COMPILER g++) + +set(CMAKE_C_STANDARD 17) +set(CMAKE_CXX_STANDARD 20) + +set(CMAKE_CXX_SCAN_FOR_MODULES OFF) diff --git a/tools/toolchains/x64-macos-clang-16-brew.cmake b/tools/toolchains/x64-macos-clang-16-brew.cmake deleted file mode 100644 index 24c7483..0000000 --- a/tools/toolchains/x64-macos-clang-16-brew.cmake +++ /dev/null @@ -1,12 +0,0 @@ -set(CMAKE_SYSTEM_PROCESSOR AMD64) - -execute_process(COMMAND brew --prefix llvm@16 OUTPUT_VARIABLE BREW_LLVM_PATH OUTPUT_STRIP_TRAILING_WHITESPACE) - -set(CMAKE_C_COMPILER "${BREW_LLVM_PATH}/bin/clang") -set(CMAKE_CXX_COMPILER "${BREW_LLVM_PATH}/bin/clang++") -set(CMAKE_OSX_SYSROOT /Applications/Xcode_15.0.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk) - -set(CMAKE_C_STANDARD 17) -set(CMAKE_CXX_STANDARD 20) - -set(CMAKE_CXX_FLAGS_INIT "-fsized-deallocation") diff --git a/tools/toolchains/x64-macos-gcc-12.cmake b/tools/toolchains/x64-macos-gcc-12.cmake index c1b4122..9a2f9dc 100644 --- a/tools/toolchains/x64-macos-gcc-12.cmake +++ b/tools/toolchains/x64-macos-gcc-12.cmake @@ -2,7 +2,12 @@ set(CMAKE_SYSTEM_PROCESSOR AMD64) set(CMAKE_C_COMPILER gcc-12) set(CMAKE_CXX_COMPILER g++-12) -set(CMAKE_OSX_SYSROOT /Applications/Xcode_15.0.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk) +set(CMAKE_OSX_DEPLOYMENT_TARGET 14.2 CACHE STRING "OSX deployment target") +set(CMAKE_OSX_ARCHITECTURES x86_64 CACHE STRING "OSX target architectures") set(CMAKE_C_STANDARD 17) set(CMAKE_CXX_STANDARD 20) + +# the new linker currently segfaults with gcc (I believe this is fixed with gcc 14) +set(CMAKE_CXX_FLAGS_INIT "-Wl,-ld_classic") +set(CMAKE_CXX_SCAN_FOR_MODULES OFF) diff --git a/tools/triplets/x64-osx-clang-16-brew.cmake b/tools/triplets/arm64-macos-clang-19-brew.cmake similarity index 69% rename from tools/triplets/x64-osx-clang-16-brew.cmake rename to tools/triplets/arm64-macos-clang-19-brew.cmake index cbe5d61..d3431d1 100644 --- a/tools/triplets/x64-osx-clang-16-brew.cmake +++ b/tools/triplets/arm64-macos-clang-19-brew.cmake @@ -1,10 +1,10 @@ -set(VCPKG_TARGET_ARCHITECTURE x64) +set(VCPKG_TARGET_ARCHITECTURE arm64) set(VCPKG_CRT_LINKAGE dynamic) set(VCPKG_LIBRARY_LINKAGE static) set(VCPKG_CMAKE_SYSTEM_NAME Darwin) -set(VCPKG_OSX_ARCHITECTURES x86_64) -set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/../toolchains/x64-macos-clang-16-brew.cmake") +set(VCPKG_OSX_ARCHITECTURES arm64) +set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/../toolchains/arm64-macos-clang-19-brew.cmake") if(PORT STREQUAL "status-code") set(VCPKG_CMAKE_CONFIGURE_OPTIONS "-DBUILD_TESTING=OFF") diff --git a/tools/triplets/x64-linux-clang-16.cmake b/tools/triplets/x64-linux-clang-19.cmake similarity index 83% rename from tools/triplets/x64-linux-clang-16.cmake rename to tools/triplets/x64-linux-clang-19.cmake index c06c8bb..869cca4 100644 --- a/tools/triplets/x64-linux-clang-16.cmake +++ b/tools/triplets/x64-linux-clang-19.cmake @@ -3,4 +3,4 @@ set(VCPKG_CRT_LINKAGE dynamic) set(VCPKG_LIBRARY_LINKAGE static) set(VCPKG_CMAKE_SYSTEM_NAME Linux) -set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/../toolchains/x64-linux-clang-16.cmake") +set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/../toolchains/x64-linux-clang-19.cmake") diff --git a/tools/triplets/x64-linux-clang-20.cmake b/tools/triplets/x64-linux-clang-20.cmake new file mode 100644 index 0000000..08e130f --- /dev/null +++ b/tools/triplets/x64-linux-clang-20.cmake @@ -0,0 +1,6 @@ +set(VCPKG_TARGET_ARCHITECTURE x64) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE static) + +set(VCPKG_CMAKE_SYSTEM_NAME Linux) +set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/../toolchains/x64-linux-clang-20.cmake") diff --git a/tools/triplets/x64-osx-gcc-12.cmake b/tools/triplets/x64-osx-gcc-12.cmake index 53c6db8..6658f7c 100644 --- a/tools/triplets/x64-osx-gcc-12.cmake +++ b/tools/triplets/x64-osx-gcc-12.cmake @@ -3,4 +3,5 @@ set(VCPKG_CRT_LINKAGE dynamic) set(VCPKG_LIBRARY_LINKAGE static) set(VCPKG_CMAKE_SYSTEM_NAME Darwin) +set(VCPKG_OSX_ARCHITECTURES x86_64) set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/../toolchains/x64-macos-gcc-12.cmake") diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json index 5cab6f4..d3cc6b5 100644 --- a/vcpkg-configuration.json +++ b/vcpkg-configuration.json @@ -2,15 +2,20 @@ "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg-configuration.schema.json", "default-registry": { "kind": "builtin", - "baseline": "a42af01b72c28a8e1d7b48107b33e4f286a55ef6" + "baseline": "ce613c41372b23b1f51333815feb3edd87ef8a8b" }, + "overlay-triplets": [ + "tools/triplets" + ], "registries": [ { "kind": "git", "repository": "https://github.com/deeplex/vcpkg-registry", - "baseline": "0a1cf2aba847e4074950a3061f5f7251f388e61f", - "packages": [ - ] + "baseline": "90373c127f67e25393120e7332270aa1a27d54f8", + "packages": [] } + ], + "overlay-ports": [ + "tools/ports" ] } \ No newline at end of file From 1ea3a75242d244116a138b598d44e707c789bbf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20S=2E=20Ga=C3=9Fmann?= Date: Fri, 6 Jun 2025 17:33:10 +0000 Subject: [PATCH 2/7] style: reformat with clang-format-20 --- src/dplx/cncr/bit.hpp | 14 ++++---- src/dplx/cncr/bit.test.cpp | 35 ++++++++++---------- src/dplx/cncr/disappointment.hpp | 12 +++---- src/dplx/cncr/intrusive_ptr.hpp | 4 +-- src/dplx/cncr/math_supplement.hpp | 14 ++++---- src/dplx/cncr/mp_lite.hpp | 6 ++-- src/dplx/cncr/tag_invoke.hpp | 12 +++---- src/dplx/cncr/utils.hpp | 6 ++-- src/dplx/cncr/uuid.hpp | 12 +++---- src/dplx/cncr/uuid.rng.hpp | 4 +-- src/dplx/cncr/uuid.test.cpp | 2 +- src/dplx/scope_guard.hpp | 54 +++++++++++++++++-------------- src/dplx/scope_guard.test.cpp | 3 +- 13 files changed, 89 insertions(+), 89 deletions(-) diff --git a/src/dplx/cncr/bit.hpp b/src/dplx/cncr/bit.hpp index 6467ca7..48c0e92 100644 --- a/src/dplx/cncr/bit.hpp +++ b/src/dplx/cncr/bit.hpp @@ -55,7 +55,7 @@ namespace dplx::cncr { -static_assert(__cpp_lib_byteswap >= 202110L, +static_assert(__cpp_lib_byteswap >= 202'110L, "USE_STD_BYTESWAP has been configured, but this TU isn't " "compiled with a sufficiently C++23 compliant compiler/mode"); using std::byteswap; @@ -109,8 +109,8 @@ constexpr auto byteswap(T value) noexcept -> T // NOLINTNEXTLINE(bugprone-signed-char-misuse) auto const x = static_cast(value); auto const step16 = x << 16 | x >> 16; - return static_cast(((step16 << 8) & 0xff00ff00U) - | ((step16 >> 8) & 0x00ff00ffU)); + return static_cast(((step16 << 8) & 0xff00'ff00U) + | ((step16 >> 8) & 0x00ff'00ffU)); } else if constexpr (sizeof(T) == sizeof(std::uint64_t)) { @@ -122,10 +122,10 @@ constexpr auto byteswap(T value) noexcept -> T #endif auto const x = static_cast(value); auto const step32 = x << 32 | x >> 32; - auto const step16 = (step32 & 0x0000ffff0000ffffU) << 16 - | (step32 & 0xffff0000ffff0000U) >> 16; - return static_cast((step16 & 0x00ff00ff00ff00ffU) << 8 - | (step16 & 0xff00ff00ff00ff00U) >> 8); + auto const step16 = (step32 & 0x0000'ffff'0000'ffffU) << 16 + | (step32 & 0xffff'0000'ffff'0000U) >> 16; + return static_cast((step16 & 0x00ff'00ff'00ff'00ffU) << 8 + | (step16 & 0xff00'ff00'ff00'ff00U) >> 8); } else { diff --git a/src/dplx/cncr/bit.test.cpp b/src/dplx/cncr/bit.test.cpp index 382b217..88878eb 100644 --- a/src/dplx/cncr/bit.test.cpp +++ b/src/dplx/cncr/bit.test.cpp @@ -49,10 +49,9 @@ auto endian_samples(endian_sample const (&samples)[N]) return cncr_tests::from_range(std::move(values)); #else return cncr_tests::from_range( - samples - | std::views::transform( - [](endian_sample const &sample) - { return std::bit_cast>(sample); })); + samples | std::views::transform([](endian_sample const &sample) { + return std::bit_cast>(sample); + })); #endif } @@ -80,16 +79,16 @@ constexpr endian_sample byteswap_samples[] = { template requires(sizeof(T) == sizeof(std::uint32_t)) constexpr endian_sample byteswap_samples[] = { - {0x1f2e3d4c, 0x4c3d2e1f}, - {0xf1e2d3c4, 0xc4d3e2f1}, - {0x1234abcd, 0xcdab3412}, + {0x1f2e'3d4c, 0x4c3d'2e1f}, + {0xf1e2'd3c4, 0xc4d3'e2f1}, + {0x1234'abcd, 0xcdab'3412}, }; template requires(sizeof(T) == sizeof(std::uint64_t)) constexpr endian_sample byteswap_samples[] = { - {0x1f2e3d4c5b6a7988, 0x88796a5b4c3d2e1f}, - {0xf1e2d3c4b5a69788, 0x8897a6b5c4d3e2f1}, - {0x1234567890abcdef, 0xefcdab9078563412}, + {0x1f2e'3d4c'5b6a'7988, 0x8879'6a5b'4c3d'2e1f}, + {0xf1e2'd3c4'b5a6'9788, 0x8897'a6b5'c4d3'e2f1}, + {0x1234'5678'90ab'cdef, 0xefcd'ab90'7856'3412}, }; } // namespace @@ -132,34 +131,34 @@ TEST_CASE("endian_load correctly loads a big endian value from bytes") using enum std::endian; auto const bytes = cncr::make_byte_array<4>({0x1f, 0x2e, 0x3d, 0x4c}); auto const loaded = cncr::endian_load(bytes.data()); - CHECK(loaded == 0x1f2e3d4c); + CHECK(loaded == 0x1f2e'3d4c); } TEST_CASE("endian_load correctly loads a little endian value from bytes") { using enum std::endian; auto const bytes = cncr::make_byte_array<4>({0x4c, 0x3d, 0x2e, 0x1f}); auto const loaded = cncr::endian_load(bytes.data()); - CHECK(loaded == 0x1f2e3d4c); + CHECK(loaded == 0x1f2e'3d4c); } TEST_CASE("endian_load correctly loads a big endian value from uint8s") { using enum std::endian; std::array const bytes{0x1f, 0x2e, 0x3d, 0x4c}; auto const loaded = cncr::endian_load(bytes.data()); - CHECK(loaded == 0x1f2e3d4c); + CHECK(loaded == 0x1f2e'3d4c); } TEST_CASE("endian_load correctly loads a little endian value from uint8s") { using enum std::endian; std::array const bytes{0x4c, 0x3d, 0x2e, 0x1f}; auto const loaded = cncr::endian_load(bytes.data()); - CHECK(loaded == 0x1f2e3d4c); + CHECK(loaded == 0x1f2e'3d4c); } TEST_CASE("endian_store correctly stores a big endian value to bytes") { using enum std::endian; - constexpr unsigned value = 0x1f2e3d4c; + constexpr unsigned value = 0x1f2e'3d4c; auto const expected = cncr::make_byte_array<4>({0x1f, 0x2e, 0x3d, 0x4c}); std::array stored{}; @@ -169,7 +168,7 @@ TEST_CASE("endian_store correctly stores a big endian value to bytes") TEST_CASE("endian_store correctly stores a little endian value to bytes") { using enum std::endian; - constexpr unsigned value = 0x1f2e3d4c; + constexpr unsigned value = 0x1f2e'3d4c; auto const expected = cncr::make_byte_array<4>({0x4c, 0x3d, 0x2e, 0x1f}); std::array stored{}; @@ -179,7 +178,7 @@ TEST_CASE("endian_store correctly stores a little endian value to bytes") TEST_CASE("endian_store correctly stores a big endian value to uint8s") { using enum std::endian; - constexpr unsigned value = 0x1f2e3d4c; + constexpr unsigned value = 0x1f2e'3d4c; std::array const expected{0x1f, 0x2e, 0x3d, 0x4c}; std::array stored{}; @@ -189,7 +188,7 @@ TEST_CASE("endian_store correctly stores a big endian value to uint8s") TEST_CASE("endian_store correctly stores a little endian value to uint8s") { using enum std::endian; - constexpr unsigned value = 0x1f2e3d4c; + constexpr unsigned value = 0x1f2e'3d4c; std::array const expected{0x4c, 0x3d, 0x2e, 0x1f}; std::array stored{}; diff --git a/src/dplx/cncr/disappointment.hpp b/src/dplx/cncr/disappointment.hpp index bf291c7..fe2f206 100644 --- a/src/dplx/cncr/disappointment.hpp +++ b/src/dplx/cncr/disappointment.hpp @@ -95,11 +95,11 @@ using result_value_t template concept tryable_result = tryable - && (std::is_same_v> // this handles R=void - || requires(T rx) { - detail::check_copy_initializable( - outcome::try_operation_extract_value( - static_cast(rx))); - }); + && (std::is_same_v> // this handles R=void + || requires(T rx) { + detail::check_copy_initializable( + outcome::try_operation_extract_value( + static_cast(rx))); + }); } // namespace dplx::cncr diff --git a/src/dplx/cncr/intrusive_ptr.hpp b/src/dplx/cncr/intrusive_ptr.hpp index 9943a8a..5407374 100644 --- a/src/dplx/cncr/intrusive_ptr.hpp +++ b/src/dplx/cncr/intrusive_ptr.hpp @@ -580,12 +580,12 @@ class [[nodiscard]] intrusive_ptr { return mPtr; } - [[nodiscard]] constexpr auto get_handle() &&noexcept -> intrusive_ptr + [[nodiscard]] constexpr auto get_handle() && noexcept -> intrusive_ptr { mPtr = nullptr; return std::move(mHandle); } - [[nodiscard]] constexpr auto get_handle() const &noexcept + [[nodiscard]] constexpr auto get_handle() const & noexcept -> intrusive_ptr const & { return mHandle; diff --git a/src/dplx/cncr/math_supplement.hpp b/src/dplx/cncr/math_supplement.hpp index 9db0a5c..5c4e3a3 100644 --- a/src/dplx/cncr/math_supplement.hpp +++ b/src/dplx/cncr/math_supplement.hpp @@ -18,13 +18,13 @@ namespace dplx::cncr template concept integer = std::integral - && none_of, - bool, - char, - wchar_t, - char8_t, - char16_t, - char32_t>; + && none_of, + bool, + char, + wchar_t, + char8_t, + char16_t, + char32_t>; template concept signed_integer = integer && std::signed_integral; diff --git a/src/dplx/cncr/mp_lite.hpp b/src/dplx/cncr/mp_lite.hpp index fee34ba..ce18402 100644 --- a/src/dplx/cncr/mp_lite.hpp +++ b/src/dplx/cncr/mp_lite.hpp @@ -23,8 +23,7 @@ struct mp_rename { }; template