From c69a5c76d6be873f9de2bc16747c81b1c9a493f8 Mon Sep 17 00:00:00 2001 From: kamchatka-volcano Date: Tue, 14 May 2024 00:29:17 +0500 Subject: [PATCH] -update seal_lake to v0.2.0 -update sfun to v5.1.0 -added CMakePresets.json -set version to 2.6.0 --- .github/workflows/build_and_test.yml | 26 +++--- CMakeLists.txt | 13 ++- CMakePresets.json | 123 +++++++++++++++++++++++++++ external/seal_lake | 3 +- 4 files changed, 146 insertions(+), 19 deletions(-) create mode 100644 CMakePresets.json diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 8dca2e8..9390eba 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -26,29 +26,33 @@ jobs: - { name: "Ubuntu Latest gcc", os: ubuntu-latest, - cc: "gcc", - cxx: "g++", - flags: "-Wall -Werror -Wextra -Wpedantic -Wcast-align -Wnon-virtual-dtor -Woverloaded-virtual -Wunused" + cmake-preset: "gcc-release" } - { name: "Ubuntu Latest clang", os: ubuntu-latest, - cc: "clang", - cxx: "clang++", - flags: "-Wall -Werror -Wextra -Wpedantic -Wcast-align -Wnon-virtual-dtor -Woverloaded-virtual -Wunused" + cmake-preset: "clang-release" } - { name: "Windows Latest MSVC", os: windows-latest, - cc: "cl", - cxx: "cl", - flags: "/EHsc /W4 /WX" + cmake-preset: "msvc-release" } steps: - - uses: actions/checkout@v3 + - name: Install ninja (Windows) + if: matrix.config.os == 'windows-latest' + run: choco install ninja + - name: Install ninja (Linux) + if: matrix.config.os == 'ubuntu-latest' + run: sudo apt install ninja-build + + - uses: actions/checkout@v4 + - uses: rui314/setup-mold@v1 + - uses: hendrikmuhs/ccache-action@v1.2 + - uses: ilammy/msvc-dev-cmd@v1 - name: Configure CMake - run: cmake -B ${{github.workspace}}/build -DENABLE_TESTS=ON -DENABLE_EXAMPLES=ON -DCMDLIME_USE_NAMEOF=${{ matrix.use_nameof }} -DCMAKE_CXX_FLAGS="${{ matrix.config.flags }}" + run: cmake -B ${{github.workspace}}/build -DENABLE_TESTS=ON -DENABLE_EXAMPLES=ON -DCMDLIME_USE_NAMEOF=${{ matrix.use_nameof }} --preset="${{ matrix.config.cmake-preset }}" - name: Build run: cmake --build ${{github.workspace}}/build diff --git a/CMakeLists.txt b/CMakeLists.txt index a857390..60caeab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,13 +1,12 @@ cmake_minimum_required(VERSION 3.18) -project(cmdlime VERSION 2.5.0 DESCRIPTION "C++17 command line parsing library") -include(GNUInstallDirs) +project(cmdlime VERSION 2.6.0 DESCRIPTION "C++17 command line parsing library") include(external/seal_lake) option(CMDLIME_USE_NAMEOF "Enable automatic registration of struct field names using the nameof library" OFF) option(CMDLIME_NO_WINDOWS_UNICODE "Disable storing std::wstring and std::filesystem::path with UTF16 encoding on Windows" OFF) if (CMDLIME_USE_NAMEOF) - SealLake_IsInstalled(NAMEOF_OPT_INSTALL) + SealLake_IsInstallEnabled(NAMEOF_OPT_INSTALL) SealLake_Bundle( NAME nameof GIT_REPOSITORY https://github.com/Neargye/nameof.git @@ -18,7 +17,7 @@ endif() SealLake_Bundle( NAME cmdlime_sfun GIT_REPOSITORY https://github.com/kamchatka-volcano/sfun.git - GIT_TAG v5.0.0 + GIT_TAG v5.1.0 DESTINATION include/cmdlime/detail/external DIRECTORIES include/sfun TEXT_REPLACEMENTS @@ -37,10 +36,10 @@ SealLake_HeaderOnlyLibrary( ) if (CMDLIME_USE_NAMEOF) - SealLake_Libraries( + SealLake_AddLibraries( nameof::nameof ) - SealLake_Dependencies( + SealLake_AddDependencies( nameof 0.10.2 ) endif() @@ -53,4 +52,4 @@ if (CMDLIME_NO_CANONICAL_PATHS) target_compile_definitions(cmdlime INTERFACE CMDLIME_NO_CANONICAL_PATHS) endif() -SealLake_OptionalBuildSteps(tests examples) \ No newline at end of file +SealLake_OptionalSubProjects(tests examples) \ No newline at end of file diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000..a995d8b --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,123 @@ +{ + "version": 6, + "configurePresets": [ + { + "name": "base-linux", + "hidden": true, + "displayName": "linux base preset", + "generator": "Ninja", + "binaryDir": "build-${presetName}", + "cacheVariables": { + "CMAKE_EXE_LINKER_FLAGS": "-fuse-ld=mold", + "CMAKE_CXX_COMPILER_LAUNCHER": "ccache", + "CPM_SOURCE_CACHE": "cpm_cache" + } + }, + { + "name": "clang-base", + "hidden": true, + "displayName": "clang base preset", + "inherits": "base-linux", + "cacheVariables": { + "CMAKE_CXX_COMPILER": "clang++", + "CMAKE_C_COMPILER": "clang", + "CMAKE_CXX_FLAGS": "-Wall -Wextra -Wpedantic -Werror -Wcast-align -Wnon-virtual-dtor -Woverloaded-virtual -Wunused" + } + }, + { + "name": "clang-debug", + "displayName": "clang (Debug)", + "inherits": "clang-base", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + } + }, + { + "name": "clang-release", + "displayName": "clang (Release)", + "inherits": "clang-base", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } + }, + { + "name": "gcc-base", + "hidden": true, + "displayName": "gcc base preset", + "inherits": "base-linux", + "cacheVariables": { + "CMAKE_CXX_COMPILER": "g++", + "CMAKE_C_COMPILER": "gcc", + "CMAKE_CXX_FLAGS": "-Wall -Wextra -Wpedantic -Werror -Wcast-align -Wnon-virtual-dtor -Woverloaded-virtual -Wunused" + } + }, + { + "name": "gcc-debug", + "displayName": "gcc (Debug)", + "inherits": "gcc-base", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + } + }, + { + "name": "gcc-release", + "displayName": "gcc (Release)", + "inherits": "gcc-base", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } + }, + { + "name": "base-windows", + "displayName": "windows base preset", + "hidden": true, + "generator": "Ninja", + "binaryDir": "build-${presetName}", + "architecture": { + "value": "x64", + "strategy": "external" + }, + "cacheVariables": { + "CPM_SOURCE_CACHE": "cpm_cache", + "CMAKE_CXX_COMPILER_LAUNCHER": "ccache" + }, + "vendor": { + "microsoft.com/VisualStudioSettings/CMake/1.0": { + "hostOS": [ + "Windows" + ] + }, + "jetbrains.com/clion": { + "toolchain": "Visual Studio" + } + } + }, + { + "name": "msvc-base", + "hidden": true, + "displayName": "msvc base preset", + "inherits": "base-windows", + "cacheVariables": { + "CMAKE_CXX_COMPILER": "cl.exe", + "CMAKE_C_COMPILER": "cl.exe", + "CMAKE_CXX_FLAGS": "/EHsc /W4 /WX" + } + }, + { + "name": "msvc-debug", + "displayName": "msvc (Debug)", + "inherits": "msvc-base", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + } + }, + { + "name": "msvc-release", + "displayName": "msvc (Release)", + "inherits": "msvc-base", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } + } + ] +} \ No newline at end of file diff --git a/external/seal_lake b/external/seal_lake index b6a33ac..9b6082c 100644 --- a/external/seal_lake +++ b/external/seal_lake @@ -2,7 +2,8 @@ include(FetchContent) Set(FETCHCONTENT_QUIET FALSE) FetchContent_Declare(seal_lake GIT_REPOSITORY https://github.com/kamchatka-volcano/seal_lake.git - GIT_TAG master + GIT_TAG v0.2.0 ) FetchContent_MakeAvailable(seal_lake) + include(${seal_lake_SOURCE_DIR}/seal_lake.cmake) \ No newline at end of file