Skip to content

Commit 6634aa2

Browse files
committed
add sample code and test workflow
1 parent ba35fac commit 6634aa2

File tree

3 files changed

+90
-0
lines changed

3 files changed

+90
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: CMake Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
12+
jobs:
13+
build-and-run:
14+
15+
strategy:
16+
fail-fast: false
17+
18+
matrix:
19+
include:
20+
- name: Windows
21+
os: windows-2019
22+
23+
- name: Ubuntu 22.04
24+
os: ubuntu-22.04
25+
26+
name: Build and run on ${{ matrix.name }}
27+
runs-on: ${{ matrix.os }}
28+
29+
steps:
30+
- name: Checkout code
31+
uses: actions/checkout@v4
32+
33+
- name: Set up Visual Studio shell
34+
if: runner.os == 'Windows'
35+
uses: egor-tensin/vs-shell@v2
36+
with:
37+
arch: x64
38+
39+
- name: Install Ninja
40+
if: runner.os == 'Linux'
41+
run: |
42+
sudo apt-get -y install ninja-build
43+
44+
- name: Install Qt from giallu/qt-lgpl
45+
uses: giallu/qt-lgpl@v1
46+
with:
47+
qt-version: 6.8.1-3
48+
os: ${{ matrix.os }}
49+
50+
- name: Configure CMake
51+
run: cmake -S . -B build -G Ninja
52+
53+
- name: Build
54+
run: cmake --build build
55+
56+
- name: Run test binary
57+
shell: bash
58+
run: |
59+
build/testapp${{ runner.os == 'Windows' && '.exe' || '' }}

CMakeLists.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Minimum required CMake version
2+
cmake_minimum_required(VERSION 3.12)
3+
4+
# Project name
5+
project(testapp)
6+
7+
# Set C++ standard to C++17
8+
set(CMAKE_CXX_STANDARD 17)
9+
10+
# Find the QT package
11+
find_package(Qt6 COMPONENTS Network REQUIRED)
12+
13+
# Add the executable
14+
add_executable(testapp main.cpp)
15+
16+
# Link the QT SSLSocket library
17+
target_link_libraries(testapp PRIVATE Qt6::Network)

main.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include <QSslSocket>
2+
#include <iostream>
3+
4+
int main(){
5+
6+
bool isSSLSupported = QSslSocket::supportsSsl();
7+
8+
std::cout << "SSL is ";
9+
if (isSSLSupported)
10+
std::cout << "supported\n";
11+
else
12+
std::cout << "not supported\n";
13+
14+
}

0 commit comments

Comments
 (0)