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
10 changes: 5 additions & 5 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 @@ -20,17 +19,18 @@ jobs:
uses: actions/checkout@v4

- name: Install Qt
uses: jurplel/install-qt-action@v3
uses: jurplel/install-qt-action@v4
with:
version: "5.15.2"
version: "6.8.2"
host: linux
target: desktop
arch: linux_gcc_64

- name: Configure CMake
run: cmake --preset linux
run: cmake --preset linux -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install

- name: Build library
run: cmake --build --preset linux
run: cmake --build --preset linux --target install

- name: Build tests
run: cmake --build --preset linux-test
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/macos.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 @@ -19,18 +18,22 @@ jobs:
- name: Check Out
uses: actions/checkout@v4

- name: Install Ninja
run: brew install ninja

- name: Install Qt
uses: jurplel/install-qt-action@v3
uses: jurplel/install-qt-action@v4
with:
version: "5.15.2"
version: "6.8.2"
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 -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install

- name: Build library
run: cmake --build --preset macos
run: cmake --build --preset macos --target install

- name: Build tests
run: cmake --build --preset macos-test
Expand Down
10 changes: 5 additions & 5 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 @@ -20,17 +19,18 @@ jobs:
uses: actions/checkout@v4

- name: Install Qt
uses: jurplel/install-qt-action@v3
uses: jurplel/install-qt-action@v4
with:
version: "5.15.2"
version: "6.8.2"
host: windows
target: desktop
arch: win64_msvc2022_64

- name: Configure CMake
run: cmake --preset windows
run: cmake --preset windows -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install

- name: Build library
run: cmake --build --preset windows
run: cmake --build --preset windows --target install

- name: Build tests
run: cmake --build --preset windows-test
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## v1.3.0

- Switch to Qt6.
- Switch to Ninja for macOS builds.
- Add `QTAPPINSTANCEMANAGER_TESTS` and `QTAPPINSTANCEMANAGER_EXAMPLES` options to enable tests and examples.

## v1.2.1

- Recommend FetchContent instead of submodule.
Expand Down
25 changes: 20 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
cmake_minimum_required(VERSION 3.21.0)

# Enable parallel build (not enabled by default on Windows).
set(CMAKE_BUILD_PARALLEL_LEVEL $ENV{NUMBER_OF_PROCESSORS})

enable_testing()

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

# Set project information.
project("QtAppInstanceManager"
LANGUAGES CXX
VERSION 1.2.1.0
VERSION 1.3.0.0
DESCRIPTION "A tool to communicate between the instances of your Qt application."
HOMEPAGE_URL "https://github.com/oclero/QtAppInstanceManager"
)
set(PROJECT_NAMESPACE "oclero")

Expand All @@ -16,15 +21,25 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
if(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
set(CMAKE_OSX_DEPLOYMENT_TARGET "13.6")
endif()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")

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

# The library.
add_subdirectory(src)

if(${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME})
# Tests.
# Tests.
if(QTAPPINSTANCEMANAGER_TESTS)
add_subdirectory(tests)
endif()

# Examples.
# Examples.
if(QTAPPINSTANCEMANAGER_EXAMPLES)
add_subdirectory(examples/single)
add_subdirectory(examples/multiple)
endif()
110 changes: 93 additions & 17 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": 3,
"version": 6,
"cmakeMinimumRequired": {
"major": 3,
"minor": 21,
Expand All @@ -9,11 +9,13 @@
{
"name": "macos",
"displayName": "macOS",
"description": "Xcode project for macOS",
"generator": "Xcode",
"description": "Ninja Build for macOS",
"generator": "Ninja",
"binaryDir": "${sourceDir}/_build",
"cacheVariables": {
"Qt5_DIR": "/opt/homebrew/opt/qt/lib/cmake/Qt5"
"CMAKE_PREFIX_PATH": "/opt/homebrew/opt/qt/lib/cmake/Qt6",
"QTAPPINSTANCEMANAGER_TESTS": true,
"QTAPPINSTANCEMANAGER_EXAMPLES": true
},
"condition": {
"type": "equals",
Expand All @@ -28,7 +30,9 @@
"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",
"QTAPPINSTANCEMANAGER_TESTS": true,
"QTAPPINSTANCEMANAGER_EXAMPLES": true
},
"condition": {
"type": "equals",
Expand All @@ -39,9 +43,13 @@
{
"name": "linux",
"displayName": "Linux",
"description": "Makefile for Linux",
"generator": "Unix Makefiles",
"description": "Ninja Build for Linux",
"generator": "Ninja",
"binaryDir": "${sourceDir}/_build",
"cacheVariables": {
"QTAPPINSTANCEMANAGER_TESTS": true,
"QTAPPINSTANCEMANAGER_EXAMPLES": true
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
Expand All @@ -54,8 +62,10 @@
"name": "macos",
"displayName": "macOS",
"configurePreset": "macos",
"description": "Release build with Xcode for macOS",
"targets": ["QtAppInstanceManager"],
"description": "Release build for macOS",
"targets": [
"QtAppInstanceManager"
],
"configuration": "Release",
"condition": {
"type": "equals",
Expand All @@ -67,8 +77,10 @@
"name": "macos-test",
"displayName": "Tests for macOS",
"configurePreset": "macos",
"description": "Tests release build with Xcode for macOS",
"targets": ["QtAppInstanceManagerTests"],
"description": "Tests release build for macOS",
"targets": [
"QtAppInstanceManagerTests"
],
"configuration": "Release",
"condition": {
"type": "equals",
Expand All @@ -80,8 +92,10 @@
"name": "windows",
"displayName": "Windows",
"configurePreset": "windows",
"description": "Release build with Visual Studio for Windows",
"targets": ["QtAppInstanceManager"],
"description": "Release build for Windows",
"targets": [
"QtAppInstanceManager"
],
"configuration": "Release",
"condition": {
"type": "equals",
Expand All @@ -93,8 +107,10 @@
"name": "windows-test",
"displayName": "Tests for Windows",
"configurePreset": "windows",
"description": "Tests release build with Visual Studio for Windows",
"targets": ["QtAppInstanceManagerTests"],
"description": "Tests release build for Windows",
"targets": [
"QtAppInstanceManagerTests"
],
"configuration": "Release",
"condition": {
"type": "equals",
Expand All @@ -107,7 +123,9 @@
"displayName": "Linux",
"configurePreset": "linux",
"description": "Release build for Linux",
"targets": ["QtAppInstanceManager"],
"targets": [
"QtAppInstanceManager"
],
"configuration": "Release",
"condition": {
"type": "equals",
Expand All @@ -120,7 +138,9 @@
"displayName": "Tests for Linux",
"configurePreset": "linux",
"description": "Tests release build for Linux",
"targets": ["QtAppInstanceManagerTests"],
"targets": [
"QtAppInstanceManagerTests"
],
"configuration": "Release",
"condition": {
"type": "equals",
Expand Down Expand Up @@ -184,5 +204,61 @@
"rhs": "Windows"
}
}
],
"workflowPresets": [
{
"name": "macos",
"displayName": "macOS",
"steps": [
{
"type": "configure",
"name": "macos"
},
{
"type": "build",
"name": "macos-test"
},
{
"type": "test",
"name": "macos"
}
]
},
{
"name": "windows",
"displayName": "Windows",
"steps": [
{
"type": "configure",
"name": "windows"
},
{
"type": "build",
"name": "windows-test"
},
{
"type": "test",
"name": "windows"
}
]
},
{
"name": "linux",
"displayName": "Linux",
"steps": [
{
"type": "configure",
"name": "linux"
},
{
"type": "build",
"name": "linux-test"
},
{
"type": "test",
"name": "linux"
}
]
}
]
}
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
[![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)
[![Qt version](https://img.shields.io/badge/Qt-6.6.0+-41CD52?logo=qt)](https://www.qt.io)

**QtAppInstanceManager** is a tool to control how many instances of your Qt5 application are running at the same time, and to send messages between instances. It uses a local socket under the hood. You may then build upon this foundation any messaging system or protocol, such as JSON-RPC for instance (NB: not provided because out of the scope of this library).
**QtAppInstanceManager** is a tool to control how many instances of your Qt application are running at the same time, and to send messages between instances. It uses a local socket under the hood. You may then build upon this foundation any messaging system or protocol, such as JSON-RPC for instance (NB: not provided because out of the scope of this library).

It is intended to be a replacement for `QtSingleApplication`, the deprecated Qt4 official project.

Expand All @@ -33,11 +33,11 @@ Also, it differs from [itay-grudev's SingleApplication](https://github.com/itay-

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

## Usage

1. Add the library as a dependency with CMake FetchContent.
1. Add the library as a dependency in your CMakeLists.txt, for example with FetchContent.

```cmake
include(FetchContent)
Expand Down
Loading