Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add simple CMake presets #71

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: CI-Linux
on: [push, pull_request]

Check warning on line 3 in .github/workflows/ci-linux.yml

View workflow job for this annotation

GitHub Actions / MegaLinter

3:1 [truthy] truthy value should be one of [false, true]

jobs:
build:
Expand Down Expand Up @@ -38,19 +38,17 @@
- name: Configure
run: |
export CXX=$(echo ${{ matrix.compiler }} | sed -E 's/^(g|clang)(cc)?/\1++/')
cmake -G Ninja -S . -B build
cmake --preset default --fresh

- name: Build
working-directory: build
run: ninja srecord-executables
run: cmake --build --preset srecord-executables

- name: Smoke test
working-directory: build
run: ninja srecord-executables-version
run: cmake --build --preset srecord-executables-version

- name: Build test prerequisites
working-directory: build
run: ninja prepare-test

run: cmake --build --preset prepare-test

- name: Test
working-directory: build
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/ci-macos.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: CI-MacOS
on: [push, pull_request]

Check warning on line 3 in .github/workflows/ci-macos.yml

View workflow job for this annotation

GitHub Actions / MegaLinter

3:1 [truthy] truthy value should be one of [false, true]

jobs:
build:
Expand All @@ -19,19 +19,16 @@
- uses: actions/checkout@v3

- name: Configure
run: cmake -G Ninja -S . -B build
run: cmake --preset default --fresh

- name: Build
working-directory: build
run: ninja srecord-executables
run: cmake --build --preset srecord-executables

- name: Smoke test
working-directory: build
run: ninja srecord-executables-version
run: cmake --build --preset srecord-executables-version

- name: Build test prerequisites
working-directory: build
run: ninja prepare-test
run: cmake --build --preset prepare-test

- name: Test
working-directory: build
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: CI-Windows
on: [push, pull_request]

Check warning on line 3 in .github/workflows/ci-windows.yml

View workflow job for this annotation

GitHub Actions / MegaLinter

3:1 [truthy] truthy value should be one of [false, true]

jobs:
build:
Expand Down Expand Up @@ -43,19 +43,16 @@
- uses: actions/checkout@v3

- name: Configure
run: cmake -G Ninja -S . -B build
run: cmake --preset default --fresh

- name: Build
working-directory: build
run: ninja srecord-executables
run: cmake --build --preset srecord-executables

- name: Smoke test
working-directory: build
run: ninja srecord-executables-version
run: cmake --build --preset srecord-executables-version

- name: Build test prerequisites
working-directory: build
run: ninja prepare-test
run: cmake --build --preset prepare-test

- name: Test
working-directory: build
Expand Down
20 changes: 8 additions & 12 deletions .github/workflows/qa.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: QA
on: [push, pull_request]

Check warning on line 3 in .github/workflows/qa.yml

View workflow job for this annotation

GitHub Actions / MegaLinter

3:1 [truthy] truthy value should be one of [false, true]

jobs:
build-clang:
Expand Down Expand Up @@ -36,25 +36,23 @@
-Wextra
SRecord_CMake_Flags: >-
-D CMAKE_EXPORT_COMPILE_COMMANDS=ON
run: cmake -G Ninja -S . -B build ${SRecord_CMake_Flags}
run: cmake --preset default --fresh ${SRecord_CMake_Flags}
# cSpell:enable

- name: Build
working-directory: build
run: ninja -k 0 srecord-executables

- name: Smoke test
working-directory: build
run: ninja srecord-executables-version
run: cmake --build --preset srecord-executables-version

- name: Build test prerequisites
working-directory: build
run: ninja prepare-test
run: cmake --build --preset prepare-test

- name: Test
working-directory: build
run: ctest --output-on-failure --output-junit ctest.junit.xml


- name: clang-tidy
if: always()
run: run-clang-tidy-14 -p build -header-filter=.*
Expand Down Expand Up @@ -92,25 +90,23 @@
-Wno-implicit-fallthrough
SRecord_CMake_Flags: >-
-D CMAKE_EXPORT_COMPILE_COMMANDS=ON
run: cmake -G Ninja -S . -B build ${SRecord_CMake_Flags}
run: cmake --preset default --fresh ${SRecord_CMake_Flags}

Check failure on line 93 in .github/workflows/qa.yml

View workflow job for this annotation

GitHub Actions / MegaLinter

93:14 [colons] too many spaces after colon
# cSpell:enable

- name: Build
working-directory: build
run: ninja -k 0 srecord-executables

- name: Smoke test
working-directory: build
run: ninja srecord-executables-version
run: cmake --build srecord-executables-version

- name: Build test prerequisites
working-directory: build
run: ninja prepare-test
run: cmake --build prepare-test

- name: Test
working-directory: build
run: ctest --output-on-failure --output-junit ctest.junit.xml


docs:
name: Documentation
runs-on: ubuntu-22.04
Expand Down
76 changes: 76 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"version": 6,
"cmakeMinimumRequired": {
"major": 3,
"minor": 25,
"patch": 0
},
"configurePresets": [
{
"name": "cmake-pedantic",
"hidden": true,
"warnings": {
"dev": false,
"uninitialized": false,
"systemVars": false
},
"errors": {
"deprecated": true
}
},
{
"name": "ci-build",
"binaryDir": "${sourceDir}/build",
"hidden": true
},
{
"name": "ninja",
"generator": "Ninja",
"hidden": true
},
{
"name": "default",
"displayName": "Basic configuration",
"inherits": ["ci-build", "cmake-pedantic", "ninja"]
}
],
"buildPresets": [
{
"name": "default-config-preset",
"hidden": true,
"configurePreset": "default"
},
{
"name": "clean",
"displayName": "Debug build",
"targets" : "clean",
"inherits": ["default-config-preset"]
},
{
"name": "srecord-executables",
"displayName": "Debug build",
"targets" : "srecord-executables",
"inherits": ["default-config-preset"]
},
{
"name": "srecord-executables-version",
"displayName": "Debug build",
"inherits": ["default-config-preset"],
"targets" : "srecord-executables-version"
},
{
"name": "prepare-test",
"displayName": "Debug build",
"inherits": ["default-config-preset"],
"targets" : "prepare-test"
}
],
"testPresets": [
{
"name": "test",
"configurePreset": "default",
"output": {"outputOnFailure": true, "outputJUnitFile": "ctest.junit.xml"}

}
]
}
7 changes: 4 additions & 3 deletions srecord/arglex.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <cstring>
#include <iostream>
#include <unistd.h>
#include <cstdint>

#include <srecord/arglex.h>
#include <srecord/progname.h>
Expand Down Expand Up @@ -80,7 +81,7 @@ srecord::arglex::read_arguments_file(const char *filename)
int sc = getc(fp);
if (sc == EOF)
break;
uint8_t c = sc;
std::uint8_t c = sc;

//
// Ignore white space between words.
Expand Down Expand Up @@ -144,10 +145,10 @@ srecord::arglex::compare(const char *formal, const char *actual)
{
for (;;)
{
uint8_t ac = *actual++;
std::uint8_t ac = *actual++;
if (isupper(ac))
ac = tolower(ac);
uint8_t fc = *formal++;
std::uint8_t fc = *formal++;
switch (fc)
{
case 0:
Expand Down
4 changes: 2 additions & 2 deletions srecord/arglex/abbreviate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
//

#include <srecord/arglex.h>

#include <cstdint>

std::string
srecord::arglex::abbreviate(const char *s)
{
std::string result;
for (;;)
{
uint8_t c = *s++;
std::uint8_t c = *s++;
switch (c)
{
case '\0':
Expand Down
2 changes: 1 addition & 1 deletion srecord/input/file/hexdump.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ srecord::input_file_hexdump::get_next_token()
int sc = get_char();
if (sc < 0)
return token_eof;
uint8_t c = sc;
std::uint8_t c = sc;
switch (c)
{
case '\n':
Expand Down
3 changes: 2 additions & 1 deletion srecord/input/file/ppx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
//

#include <cassert>
#include <cstdint>

#include <srecord/arglex/tool.h>
#include <srecord/input/file/ppx.h>
Expand Down Expand Up @@ -47,7 +48,7 @@ srecord::input_file_ppx::get_next_token()
token = token_eof;
return;
}
uint8_t c = sc;
std::uint8_t c = sc;
switch (c)
{
case '*':
Expand Down
Loading