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
116 changes: 116 additions & 0 deletions .github/workflows/cmake-multi-platform-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: CMake Release Builder
on:
push:
tags:
- 'v*' # This will trigger the workflow on any tag starting with 'v', like v1.0.0, v2.1, etc.
workflow_dispatch:

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations.
fail-fast: false

matrix:
os: [windows-2025, ubuntu-24.04, macos-15]
build_type: [Release]
c_compiler: [gcc]

steps:
# Checkout main repository with submodules
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-tags: true
fetch-depth: 0

- name: Set reusable strings
# Turn repeated input strings (such as the build output directory) into step outputs.
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"

- name: Install CQtDeployer
# The deploy target creates the distribution packages via CQtDeployer.
uses: QuasarApp/cqtdeployer-install-action@main
with:
latest: true

- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ matrix.os }}-${{ matrix.type }}

- name: Configure CMake (Windows)
if: runner.os == 'Windows'
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-G Ninja
-DMRSPAWNER_TESTS=OFF
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }}

- name: Configure CMake (Linux)
if: runner.os == 'Linux'
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-G Ninja
-DMRSPAWNER_TESTS=OFF
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }}

- name: Configure CMake (macOS)
if: runner.os == 'macOS'
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-G Ninja
-DMRSPAWNER_TESTS=OFF
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }}

- name: Build
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --parallel 16

- name: deploy
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --target deploy --parallel 1

- name: Create Release and Upload Assets zip
uses: svenstaro/upload-release-action@v2
with:
tag: v${{ env.MRSPAWNER_VERSION }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: Distro/${{ env.MRSPAWNER_DISTRO_FULL_NAME }}.zip
asset_name: ${{ env.MRSPAWNER_DISTRO_FULL_NAME }}.zip
prerelease: true
overwrite: true
target_commit: ${{ github.head_ref }}
body: Mr.Spawner ${{ env.MRSPAWNER_VERSION }}

- name: Create Release and Upload Assets Deb
if: runner.os == 'Linux'
uses: svenstaro/upload-release-action@v2
with:
tag: v${{ env.MRSPAWNER_VERSION }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: Distro/${{ env.MRSPAWNER_DISTRO_FULL_NAME }}.deb
asset_name: ${{ env.MRSPAWNER_DISTRO_FULL_NAME }}.deb
prerelease: true
overwrite: true
target_commit: ${{ github.head_ref }}
body: Mr.Spawner ${{ env.MRSPAWNER_VERSION }}

- name: Create Release and Upload Assets DMG (macOS)
if: runner.os == 'macOS'
uses: svenstaro/upload-release-action@v2
with:
tag: v${{ env.MRSPAWNER_VERSION }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: Distro/${{ env.MRSPAWNER_DISTRO_FULL_NAME }}.dmg
asset_name: ${{ env.MRSPAWNER_DISTRO_FULL_NAME }}.dmg
prerelease: true
overwrite: true
target_commit: ${{ github.head_ref }}
body: Mr.Spawner ${{ env.MRSPAWNER_VERSION }}
116 changes: 116 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: CMake PR Builder
on:
pull_request:
types: [opened, synchronize, reopened] # Triggers only on pull request events

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [windows-2025, ubuntu-24.04, macos-15]
build_type: [Release]
c_compiler: [gcc]

steps:
- name: Install Qt (Windows)
uses: jurplel/install-qt-action@v4.3.0
if: runner.os == 'Windows'
with:
version: '6.10.3'
target: 'desktop'
arch: 'win64_mingw'
cache: true
tools: 'tools_mingw1310'
aqtversion: ==3.2.*

- name: Install Qt (Linux)
uses: jurplel/install-qt-action@v4.3.0
if: runner.os == 'Linux'
with:
version: '6.10.3'
target: 'desktop'
arch: 'linux_gcc_64'
cache: true
aqtversion: ==3.2.*

- name: Install Qt (macOS)
uses: jurplel/install-qt-action@v4.3.0
if: runner.os == 'macOS'
with:
version: '6.10.3'
target: 'desktop'
arch: 'clang_64'
cache: true
aqtversion: ==3.2.*

# Checkout main repository with submodules
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-tags: true
fetch-depth: 0

- name: Set reusable strings
# Turn repeated input strings (such as the build output directory) into step outputs.
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"

- name: Install CQtDeployer
# The test target deploys and runs the test executables via CQtDeployer.
uses: QuasarApp/cqtdeployer-install-action@main
with:
latest: true

- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ matrix.os }}-${{ matrix.type }}

- name: Configure CMake (Windows)
if: runner.os == 'Windows'
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-G Ninja
-DMRSPAWNER_TESTS=ON
-DCMAKE_PREFIX_PATH='${{ env.QT_ROOT_DIR }}'
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }}

- name: Configure CMake (Linux)
if: runner.os == 'Linux'
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-G Ninja
-DMRSPAWNER_TESTS=ON
-DCMAKE_PREFIX_PATH='${{ env.QT_ROOT_DIR }}'
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }}

- name: Configure CMake (macOS)
if: runner.os == 'macOS'
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-G Ninja
-DMRSPAWNER_TESTS=ON
-DCMAKE_PREFIX_PATH='${{ env.QT_ROOT_DIR }}'
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }}

- name: Build
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --parallel 16

- name: Run unit tests
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --parallel 16 --target test

- name: Upload unit test reports
if: always()
uses: actions/upload-artifact@v4
with:
name: unit-test-reports-${{ matrix.os }}
path: ${{ github.workspace }}/Testing/*/test_report.txt*
if-no-files-found: ignore
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ _deps
# Configured files
build.gradle
AndroidManifest.xml
src/Example/Deploy/RENAME_ME.json
src/Library/src/public/RENAME_ME/global.h
src/mrspawner/deploy/mrspawner.json
src/Core/src/public/Core/global.h
doxygen.conf
Distro
build
Expand Down
61 changes: 32 additions & 29 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#
# Copyright (C) 2020-2025 QuasarApp.
# Copyright (C) 2020-2026 QuasarApp.
# Distributed under the GPLv3 software license, see the accompanying
# Everyone is permitted to copy and distribute verbatim copies
# of this license document, but changing it is not allowed.
#

cmake_minimum_required(VERSION 3.19)
project(RENAME_ME LANGUAGES CXX)
project(MrSpawner LANGUAGES CXX)
if(TARGET ${PROJECT_NAME})
message("The ${PROJECT_NAME} arledy included in main Project")
message("The ${PROJECT_NAME} already included in main Project")
return()
endif()

Expand All @@ -17,43 +17,46 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

option(MRSPAWNER_TESTS "This option disables or enables tests of the ${PROJECT_NAME} project" ON)

find_package(Qt6 COMPONENTS Core Quick REQUIRED)
find_package(Qt6 COMPONENTS Test QUIET)
if (ANDROID OR IOS OR QA_WASM32)
set(MRSPAWNER_TESTS OFF CACHE BOOL "This option force disabled for ANDROID IOS QA_WASM32 and Not Qt projects" FORCE)
endif()

qt_standard_project_setup()
qt_policy(SET QTP0001 NEW)
# Qt is only required by the tests module. The Core, Interfaces and
# mrspawner modules work without Qt. The versionless QT package name sets
# the QT_VERSION_MAJOR variable, so the Qt${QT_VERSION_MAJOR}:: targets can
# be used in the modules.
if (MRSPAWNER_TESTS)
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Test QUIET)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Test REQUIRED)

# Do not use qt_standard_project_setup() here: on Windows it sets
# CMAKE_RUNTIME_OUTPUT_DIRECTORY to the directory where the macro is
# invoked (the build root), so every executable leaves its target
# directory. The CI test targets and the deploy configuration expect
# the executables in their target directories (${CMAKE_BINARY_DIR}/tests
# and ${CMAKE_BINARY_DIR}/src/mrspawner), which is the CMake default.
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
endif()

include(submodules/CMake/QuasarApp.cmake)

updateGitVarsWithHash("a2b556fd8efa14f1aed88329d8310cc53b2582f4")

set(RENAME_ME_VERSION "0.${GIT_COMMIT_COUNT}.${GIT_COMMIT_HASH}")

set(RENAME_ME_PACKAGE_ID "quasarapp.core.RENAME_ME")

option(RENAME_ME_TESTS "This option disables or enables tests of the ${PROJECT_NAME} project" ON)
option(RENAME_ME_EXAMPLE "This option disables or enables example app of the ${PROJECT_NAME} project" ON)
updateGitVarsWithHash("f1ede5ed149fe706e1426e2c76c8fc6172bf349c")

if (ANDROID OR IOS OR QA_WASM32)
set(RENAME_ME_TESTS OFF CACHE BOOL "This option force disbled for ANDROID IOS QA_WASM32 and Not Qt projects" FORCE)
endif()
set(MRSPAWNER_VERSION "0.${GIT_COMMIT_COUNT}.${GIT_COMMIT_HASH}")

make_directory(Distro)
set(MRSPAWNER_PACKAGE_ID "quasarapp.core.MrSpawner")

initAll()

if (RENAME_ME_TESTS)
add_subdirectory(src/testcore)
endif()

add_subdirectory(src/RENAME_ME)

if (DEFINED RENAME_ME_EXAMPLE)
add_subdirectory(src/example)
endif()
add_subdirectory(src/Interfaces)
add_subdirectory(src/Core)
add_subdirectory(src/mrspawner)

if (RENAME_ME_TESTS)
if (MRSPAWNER_TESTS)
add_subdirectory(tests)
else()
message("The ${PROJECT_NAME} tests is disabled.")
Expand Down
54 changes: 44 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,49 @@
# CMakeProject
Template repository for cmake project
Fork me and replase RENAME_ME to Name of your new project.
# Mr.Spawner

1. Clone this repository
2. Run ./init.sh NewProjectName
Light and fast AI agent written on modern C++.

# This template supports next build targets:
## Project structure

| Module | Description |
|--------|-------------|
| **Core** (`src/Core`) | The main implementation of all project functions. Works without Qt. |
| **Interfaces** (`src/Interfaces`) | A super lightweight library that contains all public interfaces of the project. |
| **mrspawner** (`src/mrspawner`) | A CLI tool for running the agent. Depends on all modules except tests. |
| **tests** (`tests`) | The testing tool based on QtTest. Depends on Core and Qt. |

## Building

The project is builded with CMake (3.19+). Qt6 is required only for the
tests module, the `Core`, `Interfaces` and `mrspawner` modules work without Qt.

```sh
cmake -B build -DCMAKE_PREFIX_PATH=<path-to-Qt6> -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release
```

To build without the tests module (no Qt required):

```sh
cmake -B build -DMRSPAWNER_TESTS=OFF
cmake --build build
```

## Build targets

| Command or make target | Description |
|------|------|
| **make test** | The run tests for a project (dependet of Qt Tests, so you need to add Qt in Cmake using CMAKE_PREFIX_PATH) |
| **make doc** | The generate a documentation for a project (dependet of doxygen) |
| **make deploy** | The generate distribution for a project (dependet of CQtDeployer) |
| **make release** | The prepare Qt Installer framework repository for a project, generate a snap package and APK file for android (dependet of CQtDeployer, snapcraft, AndroidDeployer). |
| **make test** | The run tests for a project (dependent of QtTest and CQtDeployer) |
| **make doc** | The generate a documentation for a project (dependent of doxygen) |
| **make deploy** | The generate distribution for a project (dependent of CQtDeployer) |
| **make release** | The prepare the release of a project (dependent of CQtDeployer) |

## CI

* `pr.yml` - pull request test action for Windows, Linux and macOS.
* `cmake-multi-platform-build.yml` - release build action, creates a GitHub
release with the distribution packages on the `v*` tags.

## License

GPLv3 - see the [LICENSE](LICENSE) file.

Loading
Loading