Skip to content
Merged
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
5 changes: 3 additions & 2 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
branches:
- master
- dev
- setup-ci
pull_request:
branches:
- master
Expand All @@ -22,9 +21,11 @@ jobs:
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: "5.15.2"
aqtversion: "==3.1.*"
version: "6.8.0"
host: linux
target: desktop
arch: linux_gcc_64

- name: Configure CMake
run: cmake --preset linux
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ on:
branches:
- master
- dev
- setup-ci
pull_request:
branches:
- master
- dev

jobs:
build:
runs-on: macos-latest
runs-on: macos-13

steps:
- name: Check Out
Expand All @@ -22,12 +21,14 @@ jobs:
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: "5.15.2"
aqtversion: "==3.1.*"
version: "6.8.0"
host: mac
target: desktop
arch: clang_64

- name: Configure CMake
run: cmake --preset macos -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED=OFF -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY="-"
run: cmake --preset macos

- name: Build library
run: cmake --build --preset macos
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
branches:
- master
- dev
- setup-ci
pull_request:
branches:
- master
Expand All @@ -22,9 +21,11 @@ jobs:
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: "5.15.2"
aqtversion: "==3.1.*"
version: "6.8.0"
host: windows
target: desktop
arch: win64_msvc2022_64

- name: Configure CMake
run: cmake --preset windows
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v1.3.0

- Switch to Qt6.

## v1.2.1

- Fix deployment on macOS.
Expand Down
14 changes: 12 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,30 @@ cmake_minimum_required(VERSION 3.21.0)
enable_testing()

set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(DeployQt)

# Set project information.
project("QtUtils"
LANGUAGES CXX
VERSION 1.2.1.0
VERSION 1.3.0.0
DESCRIPTION "Set of tools for Qt6"
)
set(PROJECT_NAMESPACE "oclero")

# Global flags.
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
if(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
set(CMAKE_OSX_DEPLOYMENT_TARGET "13.6")
endif()

# Find Qt.
find_package(Qt6 REQUIRED COMPONENTS Core)
qt_standard_project_setup()

# The library.
add_subdirectory(src)
Expand Down
39 changes: 24 additions & 15 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"generator": "Xcode",
"binaryDir": "${sourceDir}/_build",
"cacheVariables": {
"Qt5_DIR": "/opt/homebrew/opt/qt/lib/cmake/Qt5"
"CMAKE_PREFIX_PATH": "/opt/homebrew/opt/qt/lib/cmake/Qt6"
},
"condition": {
"type": "equals",
Expand All @@ -28,7 +28,7 @@
"generator": "Visual Studio 17 2022",
"binaryDir": "${sourceDir}/_build",
"cacheVariables": {
"Qt5_DIR": "C:/Qt/5.15.2/msvc2019_64/lib/cmake/Qt5"
"CMAKE_PREFIX_PATH": "C:/Qt/6.8.0/msvc2022_64"
},
"condition": {
"type": "equals",
Expand All @@ -55,7 +55,9 @@
"displayName": "macOS",
"configurePreset": "macos",
"description": "Release build with Xcode for macOS",
"targets": ["QtUtils"],
"targets": [
"QtUtils"
],
"configuration": "Release",
"condition": {
"type": "equals",
Expand All @@ -68,7 +70,9 @@
"displayName": "Tests for macOS",
"configurePreset": "macos",
"description": "Tests release build with Xcode for macOS",
"targets": ["QtUtilsTests"],
"targets": [
"QtUtilsTests"
],
"configuration": "Release",
"condition": {
"type": "equals",
Expand All @@ -81,7 +85,9 @@
"displayName": "Windows",
"configurePreset": "windows",
"description": "Release build with Visual Studio for Windows",
"targets": ["QtUtils"],
"targets": [
"QtUtils"
],
"configuration": "Release",
"condition": {
"type": "equals",
Expand All @@ -94,7 +100,9 @@
"displayName": "Tests for Windows",
"configurePreset": "windows",
"description": "Tests release build with Visual Studio for Windows",
"targets": ["QtUtilsTests"],
"targets": [
"QtUtilsTests"
],
"configuration": "Release",
"condition": {
"type": "equals",
Expand All @@ -107,7 +115,9 @@
"displayName": "Linux",
"configurePreset": "linux",
"description": "Release build for Linux",
"targets": ["QtUtils"],
"targets": [
"QtUtils"
],
"configuration": "Release",
"condition": {
"type": "equals",
Expand All @@ -120,7 +130,9 @@
"displayName": "Tests for Linux",
"configurePreset": "linux",
"description": "Tests release build for Linux",
"targets": ["QtUtilsTests"],
"targets": [
"QtUtilsTests"
],
"configuration": "Release",
"condition": {
"type": "equals",
Expand All @@ -139,8 +151,7 @@
},
"execution": {
"noTestsAction": "error",
"stopOnFailure": false,
"rerun-failed": true
"stopOnFailure": false
},
"condition": {
"type": "equals",
Expand All @@ -157,8 +168,7 @@
},
"execution": {
"noTestsAction": "error",
"stopOnFailure": false,
"rerun-failed": true
"stopOnFailure": false
},
"condition": {
"type": "equals",
Expand All @@ -175,8 +185,7 @@
},
"execution": {
"noTestsAction": "error",
"stopOnFailure": false,
"rerun-failed": true
"stopOnFailure": false
},
"condition": {
"type": "equals",
Expand All @@ -185,4 +194,4 @@
}
}
]
}
}
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# QtUtils

[![License: MIT](https://img.shields.io/badge/license-MIT-green)](https://mit-license.org/)
[![CMake version](https://img.shields.io/badge/CMake-3.21+-064F8C?logo=cmake)](https://www.qt.io)
[![C++ version](https://img.shields.io/badge/C++-17-00599C?logo=++)](https://www.qt.io)
[![Qt version](https://img.shields.io/badge/Qt-5.15.2+-41CD52?logo=qt)](https://www.qt.io)
[![CMake version](https://img.shields.io/badge/CMake-3.21+-064F8C?logo=cmake)](https://www.cmake.org)
[![C++ version](https://img.shields.io/badge/C++-17-00599C?logo=++)](https://en.cppreference.com)
[![Qt version](https://img.shields.io/badge/Qt-6.0.0+-41CD52?logo=qt)](https://www.qt.io)

**QtUtils** is a set of basic utilities that I consider should be part of Qt API. It contains many helpers that improve the Qt experience, from dealing with `enum` to usage of pointers.

Expand All @@ -27,7 +27,7 @@

- Platform: Windows, MacOS, Linux.
- [CMake 3.21+](https://cmake.org/download/)
- [Qt 5.15+](https://www.qt.io/download-qt-installer)
- [Qt 6.0.0+](https://www.qt.io/download-qt-installer)

## Usage

Expand Down
32 changes: 0 additions & 32 deletions cmake/DeployQt.cmake

This file was deleted.

42 changes: 21 additions & 21 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
set(LIB_TARGET_NAME ${PROJECT_NAME})

find_package(Qt5
REQUIRED
Core
)

set(HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/include/oclero/QtConnectionUtils.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/oclero/QtEnumUtils.hpp
Expand All @@ -22,16 +17,15 @@ set(SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/source/oclero/QtSettingsUtils.cpp
)

# Configure target.
add_library(${LIB_TARGET_NAME} STATIC)
add_library(${PROJECT_NAMESPACE}::${LIB_TARGET_NAME} ALIAS ${LIB_TARGET_NAME})

target_sources(${LIB_TARGET_NAME}
PRIVATE
${HEADERS}
${SOURCES}
# Create target.
qt_add_library(${LIB_TARGET_NAME} STATIC
${HEADERS}
${SOURCES}
)

# Create a target alias.
add_library(${PROJECT_NAMESPACE}::${LIB_TARGET_NAME} ALIAS ${LIB_TARGET_NAME})

target_include_directories(${LIB_TARGET_NAME}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
Expand All @@ -41,27 +35,33 @@ target_include_directories(${LIB_TARGET_NAME}

target_link_libraries(${LIB_TARGET_NAME}
PRIVATE
Qt5::Core
Qt::Core
)

set_target_properties(${LIB_TARGET_NAME}
PROPERTIES
AUTOMOC ON
AUTORCC ON
OUTPUT_NAME ${LIB_TARGET_NAME}
PROJECT_LABEL ${LIB_TARGET_NAME}
FOLDER lib
SOVERSION ${PROJECT_VERSION_MAJOR}
VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
DEBUG_POSTFIX _debug
CMAKE_AUTORCC ON
CMAKE_AUTOMOC ON
CMAKE_AUTOUIC ON
)

target_compile_options(${LIB_TARGET_NAME} PRIVATE $<$<CXX_COMPILER_ID:MSVC>:/MP>)

target_compile_options(${LIB_TARGET_NAME}
PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:/MP /WX /W4>
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wall -Wextra -Werror>
)

# Create source groups.
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES
${HEADERS}
${SOURCES}
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}
FILES
${HEADERS}
${SOURCES}
)

# Select correct startup project in Visual Studio.
Expand Down
6 changes: 6 additions & 0 deletions src/include/oclero/QtConnectionUtils.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#pragma once

#include <memory>
#include <functional>

#include <QMetaObject>
#include <QObject>

namespace oclero {
/**
* @brief Allows to connect to a signal a callaback that will be executed only once.
Expand Down
Loading
Loading