Skip to content

Commit 03bf94e

Browse files
31chtumaisch
authored andcommitted
Add CMakePresets.json
1 parent 3dd820e commit 03bf94e

File tree

2 files changed

+56
-7
lines changed

2 files changed

+56
-7
lines changed

CMakePresets.json

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"version": 6,
3+
"cmakeMinimumRequired": {
4+
"major": 3,
5+
"minor": 14,
6+
"patch": 0
7+
},
8+
"configurePresets": [
9+
{
10+
"name": "default",
11+
"displayName": "Default Config",
12+
"description": "Default build using Ninja generator",
13+
"generator": "Ninja",
14+
"binaryDir": "${sourceDir}/build/default",
15+
"cacheVariables": {
16+
"CMAKE_BUILD_TYPE": "Release"
17+
}
18+
},
19+
{
20+
"name": "coverage",
21+
"inherits": "default",
22+
"displayName": "Coverage Config",
23+
"description": "Coverage build using Ninja generator",
24+
"binaryDir": "${sourceDir}/build/coverage",
25+
"cacheVariables": {
26+
"CMAKE_BUILD_TYPE": "PROFILE"
27+
}
28+
}
29+
],
30+
"buildPresets": [
31+
{
32+
"name": "default",
33+
"configurePreset": "default"
34+
},
35+
{
36+
"name": "coverage",
37+
"configurePreset": "coverage"
38+
}
39+
],
40+
"testPresets": [
41+
{
42+
"name": "default",
43+
"configurePreset": "default",
44+
"output": {
45+
"outputOnFailure": true
46+
}
47+
}
48+
]
49+
}

Jenkinsfile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,27 +52,27 @@ pipeline {
5252
}
5353
stage('Build project') {
5454
steps {
55-
sh 'cmake -DCMAKE_BUILD_TYPE=Release -S . -B build'
56-
sh 'cmake --build build --target cplusplus_training_project'
55+
sh 'cmake --preset default'
56+
sh 'cmake --build --preset default --target cplusplus_training_project'
5757
archiveArtifacts(
58-
artifacts: 'build/bin/cplusplus_training_project',
58+
artifacts: 'build/default/bin/cplusplus_training_project',
5959
onlyIfSuccessful: true
6060
)
6161
}
6262
}
6363
stage('Build tests') {
6464
steps {
65-
sh 'cmake -DCMAKE_BUILD_TYPE=PROFILE -S . -B build'
66-
sh 'cmake --build build --target calculate_test'
65+
sh 'cmake --preset coverage'
66+
sh 'cmake --build --preset coverage --target calculate_test'
6767
archiveArtifacts(
68-
artifacts: 'build/bin/calculate_test',
68+
artifacts: 'build/coverage/bin/calculate_test',
6969
onlyIfSuccessful: true
7070
)
7171
}
7272
}
7373
stage('Run tests') {
7474
steps {
75-
sh './build/bin/calculate_test --gtest_output="xml:report.xml"'
75+
sh './build/coverage/bin/calculate_test --gtest_output="xml:report.xml"'
7676
// Create Cobertura coverage report
7777
sh 'gcovr -f src . --root ./ --exclude-unreachable-branches --xml-pretty --print-summary -o "coverage.xml"'
7878
// Create HTML coverage report

0 commit comments

Comments
 (0)