Refactor CMakePresets and gitlab-ci

This commit is contained in:
2025-04-11 10:27:01 +02:00
parent 0dc9eeeea2
commit f3cd73d569
2 changed files with 124 additions and 99 deletions

View File

@@ -9,8 +9,8 @@ stages:
build: build:
stage: build stage: build
script: script:
- cmake --preset ci-coverage - cmake --preset coverage
- cmake --build build/coverage -j$(nproc) - cmake --build --preset build-coverage
after_script: after_script:
- find . -name "*.o" -type f -delete - find . -name "*.o" -type f -delete
- find . -name "*.a" -type f -delete - find . -name "*.a" -type f -delete
@@ -25,20 +25,20 @@ test:
needs: needs:
- build - build
script: script:
- cd build/coverage - ctest --preset test-coverage
- ctest --output-on-failure -j$(nproc)
after_script: after_script:
- find . -name "*.tdb" -type f -delete - find . -name "*.tdb" -type f -delete
artifacts: artifacts:
paths: paths:
- build/coverage - build/coverage
expire_in: 1 hour expire_in: 1 hour
coverage: coverage:
stage: coverage stage: coverage
needs: needs:
- test - test
script: script:
- cmake --build build/coverage --target coverage - cmake --build --preset build-coverage --target coverage
artifacts: artifacts:
paths: paths:
- build/coverage/coverage_html - build/coverage/coverage_html

View File

@@ -1,97 +1,122 @@
{ {
"version": 3, "version": 6,
"cmakeMinimumRequired": { "cmakeMinimumRequired": {
"major": 3, "major": 3,
"minor": 21, "minor": 25,
"patch": 0 "patch": 0
},
"configurePresets": [
{
"name": "cpp-standard",
"hidden": true,
"cacheVariables": {
"CMAKE_CXX_STANDARD": "17",
"CMAKE_CXX_STANDARD_REQUIRED": "ON",
"CMAKE_CXX_EXTENSIONS": "OFF"
}
}, },
"configurePresets": [ {
{ "name": "vcpkg",
"name": "vcpkg", "hidden": true,
"hidden": true, "toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"cacheVariables": { "cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", "VCPKG_INSTALL_OPTIONS": "--no-print-usage"
"VCPKG_INSTALL_OPTIONS": "--no-print-usage" }
} },
}, {
{ "name": "dev",
"name": "cmake-pedantic", "binaryDir": "${sourceDir}/build",
"hidden": true, "inherits": [
"warnings": { "cpp-standard"
"dev": true, ],
"deprecated": true, "cacheVariables": {
"unusedCli": true, "CMAKE_BUILD_TYPE": "Debug",
"systemVars": false "CMAKE_CXX_FLAGS": "-Wall -Wextra -Wpedantic -fdiagnostics-color=always",
} "CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
}, "DRAMSYS_BUILD_TESTS": "ON",
{ "DRAMSYS_BUILD_BENCHMARKS": "ON",
"name": "dev-mode", "DRAMSYS_BUILD_TRACE_ANALYZER": "ON"
"hidden": true, }
"inherits": "cmake-pedantic", },
"cacheVariables": { {
"DRAMSYS_BUILD_TESTS": "ON", "name": "dev-local",
"DRAMSYS_BUILD_BENCHMARKS": "ON", "inherits": [
"DRAMSYS_BUILD_TRACE_ANALYZER": "ON" "dev"
} ],
}, "cacheVariables": {
{ "DRAMSYS_USE_FETCH_CONTENT": "OFF"
"name": "std", }
"description": "This preset makes sure the project actually builds with at least the specified standard", },
"hidden": true, {
"cacheVariables": { "name": "dev-vcpkg",
"CMAKE_CXX_EXTENSIONS": "OFF", "inherits": [
"CMAKE_CXX_STANDARD": "17", "dev",
"CMAKE_CXX_STANDARD_REQUIRED": "ON" "vcpkg"
} ],
}, "cacheVariables": {
{ "DRAMSYS_USE_FETCH_CONTENT": "ON",
"name": "ci-common", "DRAMSYS_USE_FETCH_CONTENT_INTERNAL": "ON",
"binaryDir": "${sourceDir}/build", "DRAMSYS_USE_FETCH_CONTENT_SYSTEMC": "OFF",
"inherits": [ "DRAMSYS_USE_FETCH_CONTENT_SQLITE3": "OFF",
"std", "DRAMSYS_USE_FETCH_CONTENT_NLOHMANN_JSON": "OFF"
"dev-mode" }
], },
"cacheVariables": { {
"CMAKE_BUILD_TYPE": "Release" "name": "coverage",
} "binaryDir": "${sourceDir}/build/coverage",
}, "inherits": [
{ "cpp-standard",
"name": "ci-coverage", "dev"
"binaryDir": "${sourceDir}/build/coverage", ],
"inherits": "ci-common", "cacheVariables": {
"cacheVariables": { "CMAKE_BUILD_TYPE": "Coverage",
"DRAMSYS_ENABLE_COVERAGE": "ON", "CMAKE_CXX_FLAGS_COVERAGE": "-Og -g --coverage -fkeep-static-functions",
"CMAKE_BUILD_TYPE": "Coverage", "CMAKE_EXE_LINKER_FLAGS_COVERAGE": "--coverage",
"CMAKE_CXX_FLAGS_COVERAGE": "-Og -g --coverage -fkeep-static-functions", "CMAKE_SHARED_LINKER_FLAGS_COVERAGE": "--coverage",
"CMAKE_EXE_LINKER_FLAGS_COVERAGE": "--coverage", "DRAMSYS_ENABLE_COVERAGE": "ON"
"CMAKE_SHARED_LINKER_FLAGS_COVERAGE": "--coverage" }
} }
}, ],
{ "buildPresets": [
"name": "dev", {
"binaryDir": "${sourceDir}/build", "name": "build-dev",
"inherits": [ "configurePreset": "dev",
"dev-mode", "jobs": 0,
"std" "targets": [
], "all"
"cacheVariables": { ]
"CMAKE_BUILD_TYPE": "Debug", },
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON", {
"CMAKE_CXX_FLAGS": "-Wall -Wextra -Wpedantic -fdiagnostics-color=always" "name": "build-coverage",
} "configurePreset": "coverage",
}, "jobs": 0,
{ "targets": [
"name": "dev-local", "all"
"binaryDir": "${sourceDir}/build", ]
"inherits": [ }
"dev-mode", ],
"std" "testPresets": [
], {
"cacheVariables": { "name": "test-dev",
"CMAKE_BUILD_TYPE": "Debug", "configurePreset": "dev",
"CMAKE_CXX_FLAGS": "-Wall -Wextra -Wpedantic -fdiagnostics-color=always", "configuration": "Debug",
"DRAMSYS_USE_FETCH_CONTENT": "OFF" "execution": {
} "jobs": 0
} },
] "output": {
"outputOnFailure": true
}
},
{
"name": "test-coverage",
"configurePreset": "coverage",
"configuration": "Coverage",
"execution": {
"jobs": 0
},
"output": {
"outputOnFailure": true
}
}
]
} }