Skip to content

Commit 39bf59e

Browse files
committed
Merge branch 'main' into feature/add-scripts-clang-tidy-clang-format-cmake-targets
2 parents cfe0c75 + 8cf8a67 commit 39bf59e

7 files changed

Lines changed: 171 additions & 13 deletions

File tree

.github/workflows/build_cmake.yml

Lines changed: 109 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ jobs:
4141
compiler: [ {name: 'GCC 10', preset: gcc-10, pkgs: 'gcc-10 g++-10 lib32gcc-10-dev gcc-multilib'},
4242
{name: 'GCC 11', preset: gcc-11, pkgs: 'gcc-11 g++-11 lib32gcc-11-dev gcc-multilib'},
4343
{name: 'GCC 12', preset: gcc-12, pkgs: 'gcc-12 g++-12 lib32gcc-12-dev gcc-multilib'},
44-
{name: 'Clang 12', preset: clang-12, pkgs: 'clang-12 llvm-12'},
45-
{name: 'Clang 13', preset: clang-13, pkgs: 'clang-13 llvm-13'},
46-
{name: 'Clang 14', preset: clang-14, pkgs: 'clang-14 llvm-14'},
4744
{name: 'Clang 15', preset: clang-15, pkgs: 'clang-15 llvm-15'}
4845
]
4946
cxx: [17, 20]
@@ -86,6 +83,60 @@ jobs:
8683
shell: bash
8784
run: ctest --preset test-unixlike-${{ matrix.compiler.preset }}-${{ matrix.buildtype }}
8885

86+
# because of an bug in github actions: https://github.com/actions/runner-images/issues/8659
87+
# we use clang 12, clang 13, clang 14 only in C++17 mode
88+
linux-clang-smaller-15:
89+
name: ${{ matrix.os }}, ${{ matrix.compiler.name }}, C++${{ matrix.cxx }}, ${{ matrix.buildtype }}
90+
runs-on: ${{ matrix.os }}
91+
strategy:
92+
fail-fast: false # 'false' means Don't stop matrix workflows even if some matrix entry fails.
93+
matrix:
94+
os: [ubuntu-22.04]
95+
buildtype: [debug]
96+
compiler: [ {name: 'Clang 12', preset: clang-12, pkgs: 'clang-12 llvm-12'},
97+
{name: 'Clang 13', preset: clang-13, pkgs: 'clang-13 llvm-13'},
98+
{name: 'Clang 14', preset: clang-14, pkgs: 'clang-14 llvm-14'}
99+
]
100+
cxx: [17]
101+
102+
steps:
103+
- uses: actions/checkout@v3
104+
105+
- name: Cache
106+
uses: actions/cache@v3
107+
env:
108+
cache-name: cache-conan-modules
109+
with:
110+
path: |
111+
${{ env.CONAN_USER_HOME }}
112+
~/.cache/pip
113+
key: ${{ runner.os }}-${{ env.BUILD_TYPE }}-${{ hashFiles('CMakeLists.txt') }}-${{ hashFiles('cmake/Conan.cmake') }}
114+
115+
- name: Install conan
116+
shell: bash
117+
run: |
118+
python3 -m pip install --upgrade pip setuptools conan
119+
source ~/.profile
120+
121+
- name: Install dependencies
122+
run: |
123+
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
124+
sudo apt update
125+
sudo apt install ninja-build ${{ matrix.compiler.pkgs }}
126+
shell: bash
127+
128+
- name: Configure via CMake
129+
shell: bash
130+
run: cmake --preset unixlike-${{ matrix.compiler.preset }}-${{ matrix.buildtype }} -DCXX_STANDARD=${{ matrix.cxx }}
131+
132+
- name: Build
133+
shell: bash
134+
run: cmake --build --preset build-unixlike-${{ matrix.compiler.preset }}-${{ matrix.buildtype }}
135+
136+
- name: Test
137+
shell: bash
138+
run: ctest --preset test-unixlike-${{ matrix.compiler.preset }}-${{ matrix.buildtype }}
139+
89140
linux-static_analysis:
90141
name: Static Analysis, ${{ matrix.os }}, ${{ matrix.compiler.name }}, ${{ matrix.buildtype }}
91142
runs-on: ${{ matrix.os }}
@@ -200,11 +251,7 @@ jobs:
200251
matrix:
201252
os: [ubuntu-22.04]
202253
buildtype: [debug]
203-
compiler: [ {name: 'Clang 12', preset: clang-12, pkgs: 'clang-12 llvm-12'},
204-
{name: 'Clang 13', preset: clang-13, pkgs: 'clang-13 llvm-13'},
205-
{name: 'Clang 14', preset: clang-14, pkgs: 'clang-14 llvm-14'},
206-
{name: 'Clang 15', preset: clang-15, pkgs: 'clang-15 llvm-15'}
207-
]
254+
compiler: [ {name: 'Clang 15', preset: clang-15, pkgs: 'clang-15 llvm-15'} ]
208255

209256
steps:
210257
- uses: actions/checkout@v3
@@ -239,3 +286,57 @@ jobs:
239286
- name: Build
240287
shell: bash
241288
run: cmake --build --preset build-unixlike-${{ matrix.compiler.preset }}-${{ matrix.buildtype }}
289+
290+
linux-qt:
291+
name: ${{ matrix.os }}, QT ${{ matrix.compiler.name }}, C++${{ matrix.cxx }}
292+
runs-on: ${{ matrix.os }}
293+
strategy:
294+
fail-fast: false # 'false' means Don't stop matrix workflows even if some matrix entry fails.
295+
matrix:
296+
os: [ubuntu-22.04]
297+
compiler: [ {name: 'Clang 15', preset: clang-15, pkgs: 'clang-15 llvm-15'} ]
298+
cxx: [20]
299+
300+
steps:
301+
- uses: actions/checkout@v3
302+
303+
- name: Cache
304+
uses: actions/cache@v3
305+
env:
306+
cache-name: cache-conan-modules
307+
with:
308+
path: |
309+
${{ env.CONAN_USER_HOME }}
310+
~/.cache/pip
311+
key: ${{ runner.os }}-${{ env.BUILD_TYPE }}-${{ hashFiles('CMakeLists.txt') }}-${{ hashFiles('cmake/Conan.cmake') }}
312+
313+
- name: Install conan
314+
shell: bash
315+
run: |
316+
python3 -m pip install --upgrade pip setuptools conan
317+
source ~/.profile
318+
319+
- name: Install dependencies
320+
run: |
321+
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
322+
sudo apt update
323+
sudo apt install ninja-build ${{ matrix.compiler.pkgs }} libx11-xcb-dev libfontenc-dev libice-dev \
324+
libsm-dev libxaw7-dev libxcomposite-dev libxcursor-dev libxdamage-dev libxext-dev libxfixes-dev libxi-dev \
325+
libxinerama-dev libxkbfile-dev libxmu-dev libxmuu-dev libxpm-dev libxrandr-dev libxrender-dev libxres-dev \
326+
libxss-dev libxt-dev libxtst-dev libxv-dev libxxf86vm-dev libxcb-render0-dev libxcb-render-util0-dev \
327+
libxcb-xkb-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-randr0-dev libxcb-shape0-dev \
328+
libxcb-sync-dev libxcb-xfixes0-dev libxcb-xinerama0-dev libxcb-dri3-dev uuid-dev libxcb-cursor-dev \
329+
libxcb-util-dev libxcb-util0-dev libx11-xcb1 libx11-dev libgl-dev libgl1-mesa-dev
330+
shell: bash
331+
332+
- name: Configure via CMake
333+
shell: bash
334+
run: cmake --preset ${{ matrix.compiler.preset }}-qt -DCXX_STANDARD=${{ matrix.cxx }}
335+
336+
- name: Build
337+
shell: bash
338+
run: cmake --build --preset build-${{ matrix.compiler.preset }}-qt
339+
340+
- name: Test
341+
shell: bash
342+
run: ctest --preset test-${{ matrix.compiler.preset }}-qt

CMakePresets.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
"hidden": true,
1313
"binaryDir": "${sourceDir}/out/build/${presetName}",
1414
"installDir": "${sourceDir}/out/install/${presetName}",
15+
"environment": {
16+
"CONFIGURE_QT": "0"
17+
},
1518
"cacheVariables": {
1619
"CPP_STARTER_USE_SML": "ON",
1720
"CPP_STARTER_USE_BOOST_BEAST": "ON",
@@ -404,6 +407,24 @@
404407
"CMAKE_C_COMPILER": "clang-15",
405408
"CMAKE_CXX_COMPILER": "clang++-15"
406409
}
410+
},
411+
{
412+
"name": "clang-15-qt",
413+
"displayName": "Clang 15 QT",
414+
"inherits": "conf-unixlike-common",
415+
"cacheVariables": {
416+
"CMAKE_C_COMPILER": "clang-15",
417+
"CMAKE_CXX_COMPILER": "clang++-15",
418+
"CPP_STARTER_USE_SML": "OFF",
419+
"CPP_STARTER_USE_BOOST_BEAST": "OFF",
420+
"CPP_STARTER_USE_CROW": "OFF",
421+
"CPP_STARTER_USE_CPPZMQ_PROTO": "OFF",
422+
"CPP_STARTER_USE_QT": "ON"
423+
},
424+
"environment": {
425+
"NOT_ON_C3I": "1",
426+
"CONFIGURE_QT": "1"
427+
}
407428
}
408429
],
409430
"buildPresets": [
@@ -541,6 +562,11 @@
541562
"name": "build-clang-15-fuzzing",
542563
"displayName": "Linux Clang 15 Fuzzing",
543564
"configurePreset": "clang-15-fuzzing"
565+
},
566+
{
567+
"name": "build-clang-15-qt",
568+
"displayName": "Linux Clang 15 QT",
569+
"configurePreset": "clang-15-qt"
544570
}
545571
],
546572
"testPresets": [
@@ -713,6 +739,12 @@
713739
"displayName": "Linux Clang 15 Fuzzing",
714740
"inherits": "test-common",
715741
"configurePreset": "clang-15-fuzzing"
742+
},
743+
{
744+
"name": "test-clang-15-qt",
745+
"displayName": "Linux Clang 15 QT",
746+
"inherits": "test-common",
747+
"configurePreset": "clang-15-qt"
716748
}
717749
]
718750
}

cmake/Options.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,4 @@ OPTION(CPP_STARTER_USE_BOOST_BEAST "Enable compilation of boost beast sample" OF
3535
OPTION(CPP_STARTER_USE_CROW "Enable compilation of crow sample" OFF)
3636
OPTION(CPP_STARTER_USE_CPPZMQ_PROTO "Enable compilation of protobuf and cppzmq sample" OFF)
3737
OPTION(CPP_STARTER_USE_EMBEDDED_TOOLCHAIN "Enable compilation of an example cortex m4 project" OFF)
38+
OPTION(CPP_STARTER_USE_QT "Enable compilation of an example QT project" OFF)

conanfile.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import os
2+
13
import conans.model.requires
24
from conan import ConanFile
35
from conan.tools.cmake import CMakeToolchain
@@ -6,18 +8,24 @@
68
class HelloConan(ConanFile):
79
settings = 'os', 'compiler', 'build_type', 'arch'
810
generators = 'CMakeDeps', 'CMakeToolchain'
9-
default_options = {'fmt/*:header_only': True, 'spdlog/*:header_only': True}
11+
default_options = {'fmt/*:header_only': True, 'spdlog/*:header_only': True, 'qt/*:with_fontconfig': False}
1012

1113
def configure(self):
1214
cmake = CMakeToolchain(self)
1315
cmake.user_presets_path = None
1416
if self.settings.get_safe('arch') == 'armv7':
1517
self.requires = conans.model.requires.Requirements(['fmt/10.0.0', 'sml/1.1.6'])
18+
return
19+
20+
if os.getenv("CONFIGURE_QT") == '1':
21+
self.requires = conans.model.requires.Requirements(['catch2/3.4.0', 'docopt.cpp/0.6.3', 'gtest/1.14.0',
22+
'qt/6.6.1', 'spdlog/1.12.0'])
1623
else:
17-
self.requires = conans.model.requires.Requirements(['catch2/3.4.0', 'gtest/1.14.0', 'docopt.cpp/0.6.3',
18-
'spdlog/1.12.0', 'sml/1.1.8', 'nlohmann_json/3.11.2',
19-
'boost/1.83.0', 'crowcpp-crow/1.0+5', 'cppzmq/4.9.0',
20-
'protobuf/3.21.12'])
24+
requirement = ['catch2/3.4.0', 'gtest/1.14.0', 'docopt.cpp/0.6.3',
25+
'spdlog/1.12.0', 'sml/1.1.8', 'nlohmann_json/3.11.2',
26+
'boost/1.83.0', 'crowcpp-crow/1.0+5', 'cppzmq/4.9.0',
27+
'protobuf/3.21.12']
28+
self.requires = conans.model.requires.Requirements(requirement)
2129

2230
def build(self):
2331
cmake = CMakeToolchain(self)

src/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ IF(CPP_STARTER_USE_CPPZMQ_PROTO)
3030
ADD_SUBDIRECTORY(protobuf.cppzmq)
3131
ENDIF()
3232

33+
# QT example
34+
IF(CPP_STARTER_USE_QT)
35+
MESSAGE("Using QT")
36+
ADD_SUBDIRECTORY(qt)
37+
ENDIF()
38+
3339

3440
FIND_PACKAGE(docopt REQUIRED)
3541
FIND_PACKAGE(spdlog REQUIRED)

src/qt/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FIND_PACKAGE(Qt6 REQUIRED)
2+
3+
ADD_EXECUTABLE(test_qt main.cpp)
4+
TARGET_LINK_LIBRARIES(test_qt PRIVATE ${CMAKE_THREAD_LIBS_INIT} qt::qt)

src/qt/main.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
3+
int main()
4+
{
5+
return 0;
6+
}

0 commit comments

Comments
 (0)