From 4b9b69bf61a1508c3a570a5d65fb1d0ccad18567 Mon Sep 17 00:00:00 2001 From: Alonso Schaich Date: Fri, 20 Oct 2023 15:19:23 +0000 Subject: [PATCH] Use CMakePresets (#20) * Create cmake workflows Closes #19 * Add CI workflow presets * Use CMakePreset workflows * Try to get a ninja * Try harder * Restore JUnit format * Try forcing cl.exe usage on windows * Update build-and-test.yml * Revert "Try forcing cl.exe usage on windows" This reverts commit c20f233dbec253f836d108c91e7c8de97deeeebd. * The error message smells like build-type selection bugs in qt * Enter-VsDevShell defaults to x86 [...] * Setup configuration for testPresets * Print DevShells * Introduce c++20 dependency * Try merging the configure and build workflows * Merge the test job, too * Add ninjamulti generator and fix ninja to be ninjasingle * Update readme with new instructions * Use free runners. The big ones are only needed to seed nuget. * Get rid of the unused shell scripts * Revert "Use free runners. The big ones are only needed to seed nuget." This reverts commit 511cade378c0d0a1ab7d742270d099e133b6af9d. * [skip ci] Add Unix Makefile presets and reorder the file * Add make flows * Add visual studio 2022 project file CI runs * Build only the more common presets on pull requests --- .github/workflows/all-presets.yml | 194 ++++++++ ...build-and-test.yml => typical-presets.yml} | 67 ++- CMakeLists.txt | 10 + CMakePresets.json | 458 ++++++++++++++++++ README.md | 16 +- build.ps1 | 33 -- build.sh | 17 - test.ps1 | 30 -- 8 files changed, 715 insertions(+), 110 deletions(-) create mode 100644 .github/workflows/all-presets.yml rename .github/workflows/{build-and-test.yml => typical-presets.yml} (59%) create mode 100644 CMakePresets.json delete mode 100644 build.ps1 delete mode 100644 build.sh delete mode 100644 test.ps1 diff --git a/.github/workflows/all-presets.yml b/.github/workflows/all-presets.yml new file mode 100644 index 0000000..4f87339 --- /dev/null +++ b/.github/workflows/all-presets.yml @@ -0,0 +1,194 @@ +name: All Presets + +on: + push: + branches: [ "main" ] + workflow_dispatch: + +env: + VCPKG_BINARY_SOURCES: clear;nuget,GitHub,readwrite;nugettimeout,3600 + +jobs: + build: + strategy: + fail-fast: false + matrix: + generator: ['ninja', 'ninjamulti'] + vcpkg_target_triplet: ['x64-windows', 'x64-windows-static', 'x64-linux'] + build_type: ['debug', 'release'] + include: + - vcpkg_target_triplet: 'x64-linux' + mono: 'mono' + os: 'ubuntu-22.04' + - vcpkg_target_triplet: 'x64-windows' + mono: '' + os: 'windows-2022' + VsDevShellArch: 'amd64' + - vcpkg_target_triplet: 'x64-windows-static' + mono: '' + os: 'windows-2022' + VsDevShellArch: 'amd64' + + - generator: 'make' + vcpkg_target_triplet: 'x64-linux' + build_type: 'debug' + mono: 'mono' + os: 'ubuntu-22.04' + - generator: 'make' + vcpkg_target_triplet: 'x64-linux' + build_type: 'release' + mono: 'mono' + os: 'ubuntu-22.04' + - generator: 'vs2022' + vcpkg_target_triplet: 'x64-windows' + build_type: 'debug' + mono: '' + os: 'windows-2022' + VsDevShellArch: 'amd64' + - generator: 'vs2022' + vcpkg_target_triplet: 'x64-windows' + build_type: 'release' + mono: '' + os: 'windows-2022' + VsDevShellArch: 'amd64' + - generator: 'vs2022' + vcpkg_target_triplet: 'x64-windows-static' + build_type: 'debug' + mono: '' + os: 'windows-2022' + VsDevShellArch: 'amd64' + - generator: 'vs2022' + vcpkg_target_triplet: 'x64-windows-static' + build_type: 'release' + mono: '' + os: 'windows-2022' + VsDevShellArch: 'amd64' + + permissions: + contents: read + packages: write + + runs-on: ${{ matrix.os }}-8-cores + + env: + VCPKG_TARGET_TRIPLET: ${{ matrix.vcpkg_target_triplet }} + + steps: + - name: Update ubuntu repository + if: ${{ matrix.os == 'ubuntu-22.04' }} + shell: bash + run: sudo apt-get update + + - name: Install ubuntu icu dependencies + if: ${{ matrix.os == 'ubuntu-22.04' }} + shell: bash + run: sudo apt-get install autoconf-archive + + - name: Install ubuntu qtbase dependencies (documented) + if: ${{ matrix.os == 'ubuntu-22.04' }} + shell: bash + run: sudo apt-get install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev + + - name: Install ubuntu qtbase dependencies (undocumented) + if: ${{ matrix.os == 'ubuntu-22.04' }} + shell: bash + run: sudo apt-get install libgl1-mesa-dev mesa-common-dev + + - name: Install ubuntu Ninja + if: ${{ matrix.os == 'ubuntu-22.04' }} + shell: bash + run: sudo sudo apt-get install ninja-build + + - name: Checkout Repository + uses: actions/checkout@v3 + with: + submodules: 'recursive' + + - name: Bootstrap VCPKG + shell: bash + run: ./vcpkg/bootstrap-vcpkg.sh + + - name: Setup NuGet + shell: bash + run: | + ${{matrix.mono}} $((./vcpkg/vcpkg fetch nuget) | tail -n 1) sources add \ + -source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \ + -storepasswordincleartext \ + -name "GitHub" \ + -username "${{ github.repository_owner }}" \ + -password "${{ secrets.GITHUB_TOKEN }}" + ${{matrix.mono}} $((./vcpkg/vcpkg fetch nuget) | tail -n 1) setapikey "${{ secrets.GITHUB_TOKEN }}" \ + -source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" + ${{matrix.mono}} $((./vcpkg/vcpkg fetch nuget) | tail -n 1) sources + + - name: Print VsDevShells + if: ${{ matrix.os == 'windows-2022' }} + shell: pwsh + run: | + & "${env:ProgramFiles(x86)}/Microsoft Visual Studio/Installer/vswhere.exe" -requires "Microsoft.VisualStudio.Component.Windows11SDK.*" + + - name: CMake Workflow (VsDevShell) + if: ${{ matrix.os == 'windows-2022' }} + shell: pwsh + run: | + $vsInstallationPath=(& "${env:ProgramFiles(x86)}/Microsoft Visual Studio/Installer/vswhere.exe" -requires "Microsoft.VisualStudio.Component.Windows11SDK.*" -property "installationPath") + Import-Module "${vsInstallationPath}/Common7/Tools/Microsoft.VisualStudio.DevShell.dll" + # invoking vcvarsall leaves the shell in another directory... + pushd . + Enter-VsDevShell -VsInstallPath ${vsInstallationPath} -Arch ${{ matrix.VsDevShellArch }} + popd + cmake --preset ci-${{ matrix.generator }}-${{ matrix.vcpkg_target_triplet }}-${{ matrix.build_type }} + cmake --build --preset ci-${{ matrix.generator }}-${{ matrix.vcpkg_target_triplet }}-${{ matrix.build_type }} + ctest --preset ci-${{ matrix.generator }}-${{ matrix.vcpkg_target_triplet }}-${{ matrix.build_type }} + + - name: CMake Workflow (non VsDevShell) + if: ${{ matrix.os != 'windows-2022' }} + shell: pwsh + run: | + cmake --preset ci-${{ matrix.generator }}-${{ matrix.vcpkg_target_triplet }}-${{ matrix.build_type }} + cmake --build --preset ci-${{ matrix.generator }}-${{ matrix.vcpkg_target_triplet }}-${{ matrix.build_type }} + ctest --preset ci-${{ matrix.generator }}-${{ matrix.vcpkg_target_triplet }}-${{ matrix.build_type }} + + - name: Archive VCPKG Log Files + if: always() + uses: actions/upload-artifact@v3 + with: + name: buildlogs + path: | + vcpkg/buildtrees/*/*.txt + vcpkg/buildtrees/*/*.log + + - name: Create Test Result Artifact + if: always() + uses: actions/upload-artifact@v3 + with: + name: Test Results (${{ matrix.vcpkg_target_triplet }}) + path: | + build/*.xml + + + + publish-teshresults: + name: Publish Test Results + needs: build + if: > + always() && + github.event.sender.login != 'dependabot[bot]' && + ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository ) + runs-on: ubuntu-latest + permissions: + checks: write + pull-requests: write + + steps: + - name: Download Artifacts + uses: actions/download-artifact@v3 + with: + path: artifacts + + - name: Publish Test Results + uses: EnricoMi/publish-unit-test-result-action@v2 + if: always() + with: + files: | + artifacts/**/*.xml diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/typical-presets.yml similarity index 59% rename from .github/workflows/build-and-test.yml rename to .github/workflows/typical-presets.yml index f2ee0a0..5f54821 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/typical-presets.yml @@ -1,4 +1,4 @@ -name: TinyORM Tests +name: Typical Presets on: push: @@ -15,36 +15,27 @@ jobs: strategy: fail-fast: false matrix: - os: ['windows-2022', 'ubuntu-22.04'] - vcpkg_library_linkage: ['dynamic', 'static'] - build_type: ['Debug', 'Release'] + vcpkg_target_triplet: ['x64-windows', 'x64-linux'] + build_type: ['release'] include: - - os: 'ubuntu-22.04' + - vcpkg_target_triplet: 'x64-linux' mono: 'mono' - - os: 'windows-2022' + os: 'ubuntu-22.04' + generator: 'make' + - vcpkg_target_triplet: 'x64-windows' mono: '' - - os: 'ubuntu-22.04' - vcpkg_library_linkage: 'static' - vcpkg_target_triplet: 'x64-linux' - - os: 'windows-2022' - vcpkg_library_linkage: 'dynamic' - vcpkg_target_triplet: 'x64-windows' - - os: 'windows-2022' - vcpkg_library_linkage: 'static' - vcpkg_target_triplet: 'x64-windows-static' - exclude: - - os: 'ubuntu-22.04' - vcpkg_library_linkage: 'dynamic' + os: 'windows-2022' + VsDevShellArch: 'amd64' + generator: 'vs2022' permissions: contents: read packages: write - runs-on: ${{ matrix.os }}-8-cores + runs-on: ${{ matrix.os }}-8-cores env: VCPKG_TARGET_TRIPLET: ${{ matrix.vcpkg_target_triplet }} - BUILD_TYPE: ${{ matrix.build_type }} steps: - name: Update ubuntu repository @@ -66,8 +57,12 @@ jobs: if: ${{ matrix.os == 'ubuntu-22.04' }} shell: bash run: sudo apt-get install libgl1-mesa-dev mesa-common-dev - + - name: Install ubuntu Ninja + if: ${{ matrix.os == 'ubuntu-22.04' }} + shell: bash + run: sudo sudo apt-get install ninja-build + - name: Checkout Repository uses: actions/checkout@v3 with: @@ -89,14 +84,34 @@ jobs: ${{matrix.mono}} $((./vcpkg/vcpkg fetch nuget) | tail -n 1) setapikey "${{ secrets.GITHUB_TOKEN }}" \ -source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" ${{matrix.mono}} $((./vcpkg/vcpkg fetch nuget) | tail -n 1) sources - - - name: Build + + - name: Print VsDevShells + if: ${{ matrix.os == 'windows-2022' }} shell: pwsh - run: ./build.ps1 + run: | + & "${env:ProgramFiles(x86)}/Microsoft Visual Studio/Installer/vswhere.exe" -requires "Microsoft.VisualStudio.Component.Windows11SDK.*" - - name: Run Tests + - name: CMake Workflow (VsDevShell) + if: ${{ matrix.os == 'windows-2022' }} shell: pwsh - run: pwsh ./test.ps1 + run: | + $vsInstallationPath=(& "${env:ProgramFiles(x86)}/Microsoft Visual Studio/Installer/vswhere.exe" -requires "Microsoft.VisualStudio.Component.Windows11SDK.*" -property "installationPath") + Import-Module "${vsInstallationPath}/Common7/Tools/Microsoft.VisualStudio.DevShell.dll" + # invoking vcvarsall leaves the shell in another directory... + pushd . + Enter-VsDevShell -VsInstallPath ${vsInstallationPath} -Arch ${{ matrix.VsDevShellArch }} + popd + cmake --preset ci-${{ matrix.generator }}-${{ matrix.vcpkg_target_triplet }}-${{ matrix.build_type }} + cmake --build --preset ci-${{ matrix.generator }}-${{ matrix.vcpkg_target_triplet }}-${{ matrix.build_type }} + ctest --preset ci-${{ matrix.generator }}-${{ matrix.vcpkg_target_triplet }}-${{ matrix.build_type }} + + - name: CMake Workflow (non VsDevShell) + if: ${{ matrix.os != 'windows-2022' }} + shell: pwsh + run: | + cmake --preset ci-${{ matrix.generator }}-${{ matrix.vcpkg_target_triplet }}-${{ matrix.build_type }} + cmake --build --preset ci-${{ matrix.generator }}-${{ matrix.vcpkg_target_triplet }}-${{ matrix.build_type }} + ctest --preset ci-${{ matrix.generator }}-${{ matrix.vcpkg_target_triplet }}-${{ matrix.build_type }} - name: Archive VCPKG Log Files if: always() diff --git a/CMakeLists.txt b/CMakeLists.txt index e3c7a37..03b702c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,6 +11,10 @@ else() set(MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") endif() +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + find_package(Qt6 REQUIRED COMPONENTS Concurrent Core Sql Test) qt_standard_project_setup() @@ -26,5 +30,11 @@ target_link_libraries(TinyOrmQueryTest PRIVATE Qt::Core Qt::Sql Qt::Test TinyOrm set_target_properties(TinyOrmQueryTest PROPERTIES MSVC_RUNTIME_LIBRARY ${MSVC_RUNTIME_LIBRARY}) enable_testing() + add_test(NAME QSqlQueryTest COMMAND QSqlQueryTest -o "${CMAKE_CURRENT_BINARY_DIR}/QSqlQueryTest.xml,junitxml" COMMAND_EXPAND_LISTS) +set_property(TEST QSqlQueryTest PROPERTY ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$:/debug>/bin") +set_property(TEST QSqlQueryTest APPEND PROPERTY ENVIRONMENT_MODIFICATION "QT_PLUGIN_PATH=set:${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$:/debug>/Qt6/plugins") + add_test(NAME TinyOrmQueryTest COMMAND TinyOrmQueryTest -o "${CMAKE_CURRENT_BINARY_DIR}/TinyOrmQueryTest.xml,junitxml" COMMAND_EXPAND_LISTS) +set_property(TEST TinyOrmQueryTest PROPERTY ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$:/debug>/bin") +set_property(TEST TinyOrmQueryTest APPEND PROPERTY ENVIRONMENT_MODIFICATION "QT_PLUGIN_PATH=set:${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$:/debug>/Qt6/plugins") diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000..53f9608 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,458 @@ +{ + "version": 6, + "cmakeMinimumRequired": { + "major": 3, + "minor": 25, + "patch": 0 + }, + "configurePresets": [ + { + "name": "base", + "cacheVariables": { + "VCPKG_INSTALL_OPTIONS": "--debug", + "VCPKG_VERBOSE": "ON", + "VCPKG_APPLOCAL_DEPS": "OFF" + }, + "toolchainFile": "${sourceDir}/vcpkg/scripts/buildsystems/vcpkg.cmake", + "hidden": true + }, + { + "name": "debug", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + }, + "inherits": [ "base" ] + }, + { + "name": "release", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + }, + "inherits": [ "base" ] + }, + + { + "name": "ci", + "binaryDir": "${sourceDir}/build", + "hidden": true + }, + { + "name": "make", + "generator": "Unix Makefiles", + "hidden": true + }, + { + "name": "ninja", + "generator": "Ninja", + "hidden": true + }, + { + "name": "ninjamulti", + "generator": "Ninja Multi-Config", + "hidden": true + }, + { + "name": "vs2022", + "generator": "Visual Studio 17 2022", + "hidden": true + }, + { + "name": "x64-freebsd", + "cacheVariables": { + "VCPKG_TARGET_TRIPLET": "x64-freebsd" + }, + "hidden": true + }, + { + "name": "x64-linux", + "cacheVariables": { + "VCPKG_TARGET_TRIPLET": "x64-linux" + }, + "hidden": true + }, + { + "name": "x64-windows", + "cacheVariables": { + "VCPKG_TARGET_TRIPLET": "x64-windows" + }, + "hidden": true + }, + { + "name": "x64-windows-static", + "cacheVariables": { + "MSVC_RUNTIME_DYNAMIC": "OFF", + "VCPKG_TARGET_TRIPLET": "x64-windows-static" + }, + "hidden": true + }, + + { + "name": "ci-make-x64-linux-release", + "inherits": [ "ci", "make", "x64-linux", "release" ] + }, + { + "name": "ci-make-x64-linux-debug", + "inherits": [ "ci", "make", "x64-linux", "debug" ] + }, + { + "name": "ci-make-x64-freebsd-release", + "inherits": [ "ci", "make", "x64-freebsd", "release" ] + }, + { + "name": "ci-make-x64-freebsd-debug", + "inherits": [ "ci", "make", "x64-freebsd", "debug" ] + }, + { + "name": "ci-ninja-x64-freebsd-release", + "inherits": [ "ci", "ninja", "x64-freebsd", "release" ] + }, + { + "name": "ci-ninja-x64-freebsd-debug", + "inherits": [ "ci", "ninja", "x64-freebsd", "debug" ] + }, + { + "name": "ci-ninja-x64-linux-release", + "inherits": [ "ci", "ninja", "x64-linux", "release" ] + }, + { + "name": "ci-ninja-x64-linux-debug", + "inherits": [ "ci", "ninja", "x64-linux", "debug" ] + }, + { + "name": "ci-ninja-x64-windows-release", + "inherits": [ "ci", "ninja", "x64-windows", "release" ] + }, + { + "name": "ci-ninja-x64-windows-debug", + "inherits": [ "ci", "ninja", "x64-windows", "debug" ] + }, + { + "name": "ci-ninja-x64-windows-static-release", + "inherits": [ "ci", "ninja", "x64-windows-static", "release" ] + }, + { + "name": "ci-ninja-x64-windows-static-debug", + "inherits": [ "ci", "ninja", "x64-windows-static", "debug" ] + }, + { + "name": "ci-ninjamulti-x64-freebsd-release", + "inherits": [ "ci", "ninjamulti", "x64-freebsd", "release" ] + }, + { + "name": "ci-ninjamulti-x64-freebsd-debug", + "inherits": [ "ci", "ninjamulti", "x64-freebsd", "debug" ] + }, + { + "name": "ci-ninjamulti-x64-linux-release", + "inherits": [ "ci", "ninjamulti", "x64-linux", "release" ] + }, + { + "name": "ci-ninjamulti-x64-linux-debug", + "inherits": [ "ci", "ninjamulti", "x64-linux", "debug" ] + }, + { + "name": "ci-ninjamulti-x64-windows-release", + "inherits": [ "ci", "ninjamulti", "x64-windows", "release" ] + }, + { + "name": "ci-ninjamulti-x64-windows-debug", + "inherits": [ "ci", "ninjamulti", "x64-windows", "debug" ] + }, + { + "name": "ci-ninjamulti-x64-windows-static-release", + "inherits": [ "ci", "ninjamulti", "x64-windows-static", "release" ] + }, + { + "name": "ci-ninjamulti-x64-windows-static-debug", + "inherits": [ "ci", "ninjamulti", "x64-windows-static", "debug" ] + }, + { + "name": "ci-vs2022-x64-windows-release", + "inherits": [ "ci", "vs2022", "x64-windows", "release" ] + }, + { + "name": "ci-vs2022-x64-windows-debug", + "inherits": [ "ci", "vs2022", "x64-windows", "debug" ] + }, + { + "name": "ci-vs2022-x64-windows-static-release", + "inherits": [ "ci", "vs2022", "x64-windows-static", "release" ] + }, + { + "name": "ci-vs2022-x64-windows-static-debug", + "inherits": [ "ci", "vs2022", "x64-windows-static", "debug" ] + } + ], + "buildPresets": [ + { + "name": "debug", + "configurePreset": "debug", + "configuration": "Debug" + }, + { + "name": "release", + "configurePreset": "release", + "configuration": "Release" + }, + { + "name": "ci-make-x64-freebsd-debug", + "configurePreset": "ci-make-x64-freebsd-debug", + "configuration": "Debug" + }, + { + "name": "ci-make-x64-freebsd-release", + "configurePreset": "ci-make-x64-freebsd-release", + "configuration": "Release" + }, + { + "name": "ci-make-x64-linux-debug", + "configurePreset": "ci-make-x64-linux-debug", + "configuration": "Debug" + }, + { + "name": "ci-make-x64-linux-release", + "configurePreset": "ci-make-x64-linux-release", + "configuration": "Release" + }, + { + "name": "ci-ninja-x64-freebsd-debug", + "configurePreset": "ci-ninja-x64-freebsd-debug", + "configuration": "Debug" + }, + { + "name": "ci-ninja-x64-freebsd-release", + "configurePreset": "ci-ninja-x64-freebsd-release", + "configuration": "Release" + }, + { + "name": "ci-ninja-x64-linux-debug", + "configurePreset": "ci-ninja-x64-linux-debug", + "configuration": "Debug" + }, + { + "name": "ci-ninja-x64-linux-release", + "configurePreset": "ci-ninja-x64-linux-release", + "configuration": "Release" + }, + { + "name": "ci-ninja-x64-windows-debug", + "configurePreset": "ci-ninja-x64-windows-debug", + "configuration": "Debug" + }, + { + "name": "ci-ninja-x64-windows-release", + "configurePreset": "ci-ninja-x64-windows-release", + "configuration": "Release" + }, + { + "name": "ci-ninja-x64-windows-static-debug", + "configurePreset": "ci-ninja-x64-windows-static-debug", + "configuration": "Debug" + }, + { + "name": "ci-ninja-x64-windows-static-release", + "configurePreset": "ci-ninja-x64-windows-static-release", + "configuration": "Release" + }, + { + "name": "ci-ninjamulti-x64-freebsd-debug", + "configurePreset": "ci-ninjamulti-x64-freebsd-debug", + "configuration": "Debug" + }, + { + "name": "ci-ninjamulti-x64-freebsd-release", + "configurePreset": "ci-ninjamulti-x64-freebsd-release", + "configuration": "Release" + }, + { + "name": "ci-ninjamulti-x64-linux-debug", + "configurePreset": "ci-ninjamulti-x64-linux-debug", + "configuration": "Debug" + }, + { + "name": "ci-ninjamulti-x64-linux-release", + "configurePreset": "ci-ninjamulti-x64-linux-release", + "configuration": "Release" + }, + { + "name": "ci-ninjamulti-x64-windows-debug", + "configurePreset": "ci-ninjamulti-x64-windows-debug", + "configuration": "Debug" + }, + { + "name": "ci-ninjamulti-x64-windows-release", + "configurePreset": "ci-ninjamulti-x64-windows-release", + "configuration": "Release" + }, + { + "name": "ci-ninjamulti-x64-windows-static-debug", + "configurePreset": "ci-ninjamulti-x64-windows-static-debug", + "configuration": "Debug" + }, + { + "name": "ci-ninjamulti-x64-windows-static-release", + "configurePreset": "ci-ninjamulti-x64-windows-static-release", + "configuration": "Release" + }, + { + "name": "ci-vs2022-x64-windows-debug", + "configurePreset": "ci-vs2022-x64-windows-debug", + "configuration": "Debug" + }, + { + "name": "ci-vs2022-x64-windows-release", + "configurePreset": "ci-vs2022-x64-windows-release", + "configuration": "Release" + }, + { + "name": "ci-vs2022-x64-windows-static-debug", + "configurePreset": "ci-vs2022-x64-windows-static-debug", + "configuration": "Debug" + }, + { + "name": "ci-vs2022-x64-windows-static-release", + "configurePreset": "ci-vs2022-x64-windows-static-release", + "configuration": "Release" + } + ], + "testPresets": [ + { + "name": "debug", + "configurePreset": "debug", + "configuration": "Debug" + }, + { + "name": "release", + "configurePreset": "release", + "configuration": "Release" + }, + { + "name": "ci", + "output": { + "outputJUnitFile": "${sourceDir}/build/ctest.xml", + "verbosity": "extra" + }, + "hidden": true + }, + { + "name": "ci-make-x64-freebsd-debug", + "configurePreset": "ci-make-x64-freebsd-debug", + "inherits": [ "ci", "debug" ] + }, + { + "name": "ci-make-x64-freebsd-release", + "configurePreset": "ci-make-x64-freebsd-release", + "inherits": [ "ci", "release" ] + }, + { + "name": "ci-make-x64-linux-debug", + "configurePreset": "ci-make-x64-linux-debug", + "inherits": [ "ci", "debug" ] + }, + { + "name": "ci-make-x64-linux-release", + "configurePreset": "ci-make-x64-linux-release", + "inherits": [ "ci", "release" ] + }, + { + "name": "ci-ninja-x64-freebsd-debug", + "configurePreset": "ci-ninja-x64-freebsd-debug", + "inherits": [ "ci", "debug" ] + }, + { + "name": "ci-ninja-x64-freebsd-release", + "configurePreset": "ci-ninja-x64-freebsd-release", + "inherits": [ "ci", "release" ] + }, + { + "name": "ci-ninja-x64-linux-debug", + "configurePreset": "ci-ninja-x64-linux-debug", + "inherits": [ "ci", "debug" ] + }, + { + "name": "ci-ninja-x64-linux-release", + "configurePreset": "ci-ninja-x64-linux-release", + "inherits": [ "ci", "release" ] + }, + { + "name": "ci-ninja-x64-windows-debug", + "configurePreset": "ci-ninja-x64-windows-debug", + "inherits": [ "ci", "debug" ] + }, + { + "name": "ci-ninja-x64-windows-release", + "configurePreset": "ci-ninja-x64-windows-release", + "inherits": [ "ci", "release" ] + }, + { + "name": "ci-ninja-x64-windows-static-debug", + "configurePreset": "ci-ninja-x64-windows-static-debug", + "inherits": [ "ci", "debug" ] + }, + { + "name": "ci-ninja-x64-windows-static-release", + "configurePreset": "ci-ninja-x64-windows-static-release", + "inherits": [ "ci", "release" ] + }, + { + "name": "ci-ninjamulti-x64-freebsd-debug", + "configurePreset": "ci-ninjamulti-x64-freebsd-debug", + "inherits": [ "ci", "debug" ] + }, + { + "name": "ci-ninjamulti-x64-freebsd-release", + "configurePreset": "ci-ninjamulti-x64-freebsd-release", + "inherits": [ "ci", "release" ] + }, + { + "name": "ci-ninjamulti-x64-linux-debug", + "configurePreset": "ci-ninjamulti-x64-linux-debug", + "inherits": [ "ci", "debug" ] + }, + { + "name": "ci-ninjamulti-x64-linux-release", + "configurePreset": "ci-ninjamulti-x64-linux-release", + "inherits": [ "ci", "release" ] + }, + { + "name": "ci-ninjamulti-x64-windows-debug", + "configurePreset": "ci-ninjamulti-x64-windows-debug", + "inherits": [ "ci", "debug" ] + }, + { + "name": "ci-ninjamulti-x64-windows-release", + "configurePreset": "ci-ninjamulti-x64-windows-release", + "inherits": [ "ci", "release" ] + }, + { + "name": "ci-ninjamulti-x64-windows-static-debug", + "configurePreset": "ci-ninjamulti-x64-windows-static-debug", + "inherits": [ "ci", "debug" ] + }, + { + "name": "ci-ninjamulti-x64-windows-static-release", + "configurePreset": "ci-ninjamulti-x64-windows-static-release", + "inherits": [ "ci", "release" ] + }, + { + "name": "ci-vs2022-x64-windows-debug", + "configurePreset": "ci-vs2022-x64-windows-debug", + "inherits": [ "ci", "debug" ] + }, + { + "name": "ci-vs2022-x64-windows-release", + "configurePreset": "ci-vs2022-x64-windows-release", + "inherits": [ "ci", "release" ] + }, + { + "name": "ci-vs2022-x64-windows-static-debug", + "configurePreset": "ci-vs2022-x64-windows-static-debug", + "inherits": [ "ci", "debug" ] + }, + { + "name": "ci-vs2022-x64-windows-static-release", + "configurePreset": "ci-vs2022-x64-windows-static-release", + "inherits": [ "ci", "release" ] + } + ] +} diff --git a/README.md b/README.md index 3f6556b..2c33296 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,18 @@ The scope of this project is to provision TinyORM and all dependencies using VCP Run - pwsh build.ps1 + cmake --list-presets -to build, and then +to list the current CI presets. If any of the CI presets is representative enough, they can be used to build and run the tests using e.g. - pwsh test.ps1 + cmake --preset ci-ninja-x64-freebsd-release + cmake --build --preset ci-ninja-x64-freebsd-release + ctest --preset ci-ninja-x64-freebsd-release + +to build using the `ci-ninja-x64-freebsd-release` preset. + +If none of the presets is eligable, the `debug` and `release` presets can be used, though they don't configure a build path nor generator, and the ctest runner can't be used as straightforwardedly: -to run the bundled test case. + cmake --preset release -B mybuildpath + cmake --build mybuildpath --preset release + pushd mybuildpath && ctest -C Release; popd diff --git a/build.ps1 b/build.ps1 deleted file mode 100644 index ed49879..0000000 --- a/build.ps1 +++ /dev/null @@ -1,33 +0,0 @@ -if (${env:GITHUB_WORKSPACE} -eq ${null}) { - ${env:GITHUB_WORKSPACE}=${pwd} -} - -if (${env:BUILD_TYPE} -eq ${null}) { - ${env:BUILD_TYPE}="Debug" -} - -if (${env:VCPKG_TARGET_TRIPLET} -eq ${null}) { - ${env:VCPKG_TARGET_TRIPLET}="x64-windows" -} - -if ("x64-windows-static" -eq "${env:VCPKG_TARGET_TRIPLET}") { - $msvc_runtime_dynamic="Off" -} else { - $msvc_runtime_dynamic="On" -} - -if ("x64-windows", "x64-windows-static" -contains "${env:VCPKG_TARGET_TRIPLET}") { - $cmake_build_args="-v:n" -} - -cmake ` - -B ${env:GITHUB_WORKSPACE}/build ` - -DCMAKE_BUILD_TYPE="${env:BUILD_TYPE}" ` - -DVCPKG_VERBOSE=ON ` - -DVCPKG_INSTALL_OPTIONS="--debug" ` - -DVCPKG_TARGET_TRIPLET="${env:VCPKG_TARGET_TRIPLET}" ` - -DCMAKE_TOOLCHAIN_FILE="${env:GITHUB_WORKSPACE}/vcpkg/scripts/buildsystems/vcpkg.cmake" ` - -DMSVC_RUNTIME_DYNAMIC="${msvc_runtime_dynamic}" ` - ${env:GITHUB_WORKSPACE} - -cmake --build ${env:GITHUB_WORKSPACE}/build --config ${env:BUILD_TYPE} --verbose -- ${cmake_build_args} diff --git a/build.sh b/build.sh deleted file mode 100644 index de63795..0000000 --- a/build.sh +++ /dev/null @@ -1,17 +0,0 @@ -if (test -z ${GITHUB_WORKSPACE+x}) then - GITHUB_WORKSPACE=$(pwd) -fi - -if (test -z ${BUILD_TYPE+x}) then - BUILD_TYPE="Debug" -fi - -cmake \ - -B "${GITHUB_WORKSPACE}/build" \ - -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \ - -DVCPKG_VERBOSE=ON \ - -DVCPKG_INSTALL_OPTIONS="--debug" \ - -DCMAKE_TOOLCHAIN_FILE="${GITHUB_WORKSPACE}/vcpkg/scripts/buildsystems/vcpkg.cmake" \ - "${GITHUB_WORKSPACE}" - -cmake --build "${GITHUB_WORKSPACE}/build" --config "${BUILD_TYPE}" diff --git a/test.ps1 b/test.ps1 deleted file mode 100644 index 620d309..0000000 --- a/test.ps1 +++ /dev/null @@ -1,30 +0,0 @@ -if (${env:GITHUB_WORKSPACE} -eq ${null}) { - ${env:GITHUB_WORKSPACE}=${pwd} -} - -if (${env:BUILD_TYPE} -eq ${null}) { - ${env:BUILD_TYPE}="Debug" -} - -if (${env:VCPKG_TARGET_TRIPLET} -eq ${null}) { - ${env:VCPKG_TARGET_TRIPLET}="x64-windows" -} - -if ("x64-windows-static" -eq "${env:VCPKG_TARGET_TRIPLET}") { - ${msvc_runtime_dynamic}="Off" -} else { - ${msvc_runtime_dynamic}="On" -} - -$vcpkgPrefix="${env:GITHUB_WORKSPACE}/build/vcpkg_installed/${env:VCPKG_TARGET_TRIPLET}/" -if ($env:BUILD_TYPE -eq "Debug") { - ${vcpkgPrefix}="${vcpkgPrefix}/debug" -} - -if (${msvc_runtime_dynamic} -eq "On") { - ${env:PATH}="${vcpkgPrefix}/bin;${env:PATH}" - ${env:QT_PLUGIN_PATH}="${vcpkgPrefix}/Qt6/plugins" -} - -cd "${env:GITHUB_WORKSPACE}/build" -ctest --test-dir "${env:GITHUB_WORKSPACE}/build" -C "${env:BUILD_TYPE}" --output-junit "${env:GITHUB_WORKSPACE}/build/ctest.xml"