diff --git a/.github/workflows/modules.yml b/.github/workflows/modules.yml new file mode 100644 index 000000000..361e5689c --- /dev/null +++ b/.github/workflows/modules.yml @@ -0,0 +1,56 @@ +name: Build & Test with modules + +on: + push: + branches: [master] + pull_request: + branches: [master] + paths: + - "CMakeLists.txt" + - "cmake/**" + - "include/jwt-cpp/**" + - "tests/cmake/**" + - ".github/actions/**" + - ".github/workflows/cmake.yml" + +jobs: + build: + name: ${{ matrix.runs_on }}-${{ matrix.compiler }}-${{ matrix.configure_preset }} + runs-on: ${{ matrix.runs_on }} + strategy: + fail-fast: false + matrix: + include: + - runs_on: windows-2025-vs2026 + compiler: msvc-14.50 + configure_preset: "x64-vs-modules" + build_preset: "x64-vs-modules-build" + test_preset : "x64-vs-modules-test" + # To be uncommented once GitHub Actions adds GCC 15 with Ubuntu 26 + # - runs_on: ubuntu-latest + # compiler: gcc-15 + # configure_preset: "linux-debug" + # build_preset: "linux-debug-build" + # test_preset : "linux-debug-test" + # - runs_on: ubuntu-latest + # compiler: clang-18 + # cc: clang + # cxx: clang++ + # configure_preset: "linux-debug-modules" + # build_preset: "linux-debug-modules-build" + # test_preset : "linux-debug-modules-test" + steps: + + - uses: actions/checkout@v6 + + - uses: lukka/get-cmake@latest + + - name: "Build & Test" + uses: lukka/run-cmake@v10 + env: + CC: ${{ matrix.cc }} + CXX: ${{ matrix.cxx }} + with: + configurePreset: ${{ matrix.configure_preset }} + buildPreset: ${{ matrix.build_preset }} + testPreset: ${{ matrix.test_preset }} \ No newline at end of file diff --git a/CMakePresets.json b/CMakePresets.json index acac67081..8463236f1 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -21,6 +21,47 @@ "JWT_BUILD_EXAMPLES": "ON", "JWT_BUILD_TESTS": "ON" } + }, + { + "name": "windows-vs-base", + "hidden": true, + "generator": "Visual Studio 18 2026", + "binaryDir": "${sourceDir}/out/build/${presetName}", + "installDir": "${sourceDir}/out/install/${presetName}", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "x64-vs-modules", + "displayName": "x64 (VS generator) with Modules", + "inherits": "windows-vs-base", + "architecture": "x64", + "cacheVariables": { + "JWT_ENABLE_MODULES": "ON", + "JWT_USE_IMPORT_STD": "ON", + "JWT_BUILD_EXAMPLES": "ON" + } + }, + { + "name": "linux-debug-modules", + "displayName": "Linux Debug with Modules", + "generator": "Ninja", + "binaryDir": "${sourceDir}/out/build/${presetName}", + "installDir": "${sourceDir}/out/install/${presetName}", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "JWT_ENABLE_MODULES": "ON", + "JWT_USE_IMPORT_STD": "ON", + "JWT_BUILD_EXAMPLES": "ON" + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } } ], "buildPresets": [ @@ -28,6 +69,14 @@ "name": "dev", "configurePreset": "dev", "configuration": "Debug" + }, + { + "name": "x64-vs-modules-build", + "configurePreset": "x64-vs-modules" + }, + { + "name": "linux-debug-modules-build", + "configurePreset": "linux-debug-modules" } ], "testPresets": [ @@ -35,6 +84,14 @@ "name": "dev", "displayName": "Run all tests", "configurePreset": "dev" + }, + { + "name": "x64-vs-modules-test", + "configurePreset": "x64-vs-modules" + }, + { + "name": "linux-debug-modules-test", + "configurePreset": "linux-debug-modules" } ] } \ No newline at end of file diff --git a/README.md b/README.md index 452810ccb..80aa26dc2 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,7 @@ If you are looking to issue or verify more unique tokens, checkout out the [exam Building on the goal of providing flexibility. #### Modules support -jwt-cpp supports C++20/23 modules. There are two configuration options `JWT_ENABLE_MODULES` to enable modules (С++20) and `JWT_USE_IMPORT_STD` to use `import std` (С++23). +jwt-cpp supports C++20/23 modules. There are two configuration options: `JWT_ENABLE_MODULES` to enable modules (С++20) and `JWT_USE_IMPORT_STD` to use `import std` (С++23). CMake example: ```cmake set(JWT_ENABLE_MODULES ON) diff --git a/docs/install.md b/docs/install.md index 5215045ea..28220b2f6 100644 --- a/docs/install.md +++ b/docs/install.md @@ -9,7 +9,7 @@ It's strongly recommended to use a package manager, as JWT-CPP has dependencies When manually adding this dependency, and the dependencies this has, check the GitHub Actions and Workflows for some inspiration about how to go about it. #### Modules support -jwt-cpp supports C++20/23 modules. There are two configuration options `JWT_ENABLE_MODULES` to enable modules (С++20) and `JWT_USE_IMPORT_STD` to use `import std` (С++23). +jwt-cpp supports C++20/23 modules. There are two configuration options: `JWT_ENABLE_MODULES` to enable modules (С++20) and `JWT_USE_IMPORT_STD` to use `import std` (С++23). CMake example: ```cmake set(JWT_ENABLE_MODULES ON)