pax_global_header 0000666 0000000 0000000 00000000064 14773571425 0014531 g ustar 00root root 0000000 0000000 52 comment=ef1231ae490465b4f592ca326eee6d56a3d802ae
qcoro-0.12.0/ 0000775 0000000 0000000 00000000000 14773571425 0012734 5 ustar 00root root 0000000 0000000 qcoro-0.12.0/.clang-format 0000664 0000000 0000000 00000010225 14773571425 0015307 0 ustar 00root root 0000000 0000000 ---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: false
AlignConsecutiveAssignments: false
AlignConsecutiveBitFields: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands: Align
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortEnumsOnASingleLine: false
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 100
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(qcoro)/'
Priority: 2
SortPriority: 0
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
SortPriority: 0
- Regex: '.*'
Priority: 1
SortPriority: 0
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IndentCaseLabels: false
IndentCaseBlocks: false
IndentGotoLabels: true
IndentPPDirectives: None
IndentExternBlock: AfterExternBlock
IndentWidth: 4
IndentWrappedFunctionNames: false
InsertTrailingCommas: None
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
ReflowComments: false
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
Standard: Latest
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
- addTest
TabWidth: 8
UseCRLF: false
UseTab: Never
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
- BOOST_PP_STRINGIZE
...
qcoro-0.12.0/.git-blame-ignore-revs 0000664 0000000 0000000 00000000107 14773571425 0017032 0 ustar 00root root 0000000 0000000 # Initial run of clang-format
0c01ca40fd8bd337ecae3ea21be1e5a97ba40e4b
qcoro-0.12.0/.github/ 0000775 0000000 0000000 00000000000 14773571425 0014274 5 ustar 00root root 0000000 0000000 qcoro-0.12.0/.github/FUNDING.yml 0000664 0000000 0000000 00000000174 14773571425 0016113 0 ustar 00root root 0000000 0000000 # Thanks for any donations! :)
github: [danvratil]
liberapay: dvratil
ko_fi: dvratil
custom: ['https://paypal.me/dvratil']
qcoro-0.12.0/.github/actions/ 0000775 0000000 0000000 00000000000 14773571425 0015734 5 ustar 00root root 0000000 0000000 qcoro-0.12.0/.github/actions/install-compiler/ 0000775 0000000 0000000 00000000000 14773571425 0021212 5 ustar 00root root 0000000 0000000 qcoro-0.12.0/.github/actions/install-compiler/action.yml 0000664 0000000 0000000 00000002074 14773571425 0023215 0 ustar 00root root 0000000 0000000 name: Install Compiler
description: Installs compiler
inputs:
compiler:
description: Compiler to install (gcc|clang)
required: true
version:
description: Version of compiler to install
required: true
runs:
using: composite
steps:
- name: Install GCC
if: ${{ inputs.compiler == 'gcc' }}
shell: bash
run: |
GCC_VERSION_MAJOR=$(echo ${{ inputs.version }} | cut -d '.' -f1)
sudo add-apt-repository "deb https://ppa.launchpadcontent.net/ubuntu-toolchain-r/ppa/ubuntu focal main"
sudo apt-get update
sudo apt-get install -y \
gcc-${GCC_VERSION_MAJOR} g++-${GCC_VERSION_MAJOR} libstdc++-${GCC_VERSION_MAJOR}-dev
echo "CXX=/usr/bin/g++-${GCC_VERSION_MAJOR}" >> $GITHUB_ENV
- name: Install Clang
if : ${{ inputs.compiler == 'clang' }}
shell: bash
run: |
wget https://apt.llvm.org/llvm.sh -O llvm.sh
chmod a+x llvm.sh
sed -i "s/libunwind-\$LLVM_VERSION-dev//" llvm.sh
sudo ./llvm.sh ${{ inputs.version }} all
echo "CXX=/usr/bin/clang++-${{ inputs.version }}" >> $GITHUB_ENV qcoro-0.12.0/.github/actions/install-qt/ 0000775 0000000 0000000 00000000000 14773571425 0020024 5 ustar 00root root 0000000 0000000 qcoro-0.12.0/.github/actions/install-qt/action.yml 0000664 0000000 0000000 00000004713 14773571425 0022031 0 ustar 00root root 0000000 0000000 name: 'Install Qt'
description: 'Install Qt'
inputs:
qt_version:
description: 'Version of Qt to install'
required: true
qt_archives:
description: 'List of Qt archives to intall'
qt_modules:
description: 'List of Qt modules to install'
platform:
description: 'Operating system (linux|windows|macos)'
required: true
runs:
using: composite
steps:
- name: Install dependencies
if: ${{ inputs.platform == 'linux' }}
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
python3 python3-pip \
build-essential \
dbus dbus-x11 \
libgl-dev libegl-dev
- name: Install Qt
shell: bash
run: |
pip3 install aqtinstall~=2.1
case "${{ inputs.platform }}" in
"windows")
QT_ARCH="win64_msvc2019_64"
QT_INSTALL_PATH="C:\\Qt"
QT_BASE_DIR="${QT_INSTALL_PATH}\\${{ inputs.qt_version }}\\msvc2019_64"
QT_OS="windows"
;;
"linux")
QT_ARCH="gcc_64"
QT_INSTALL_PATH="/opt/qt"
QT_BASE_DIR="${QT_INSTALL_PATH}/${{ inputs.qt_version }}/${QT_ARCH}"
QT_OS="linux"
;;
"macos")
QT_ARCH=""
QT_INSTALL_PATH="/Users/runner/qt"
if [[ "$(echo ${{ inputs.qt_version }} | cut -d'.' -f1)" == "6" ]]; then
QT_BASE_DIR="${QT_INSTALL_PATH}/${{ inputs.qt_version }}/macos"
else
QT_BASE_DIR="${QT_INSTALL_PATH}/${{ inputs.qt_version }}/clang_64"
fi
QT_OS="mac"
;;
esac
if [[ -n "${{ inputs.qt_archives }}" ]]; then
qt_archives="--archives ${{ inputs.qt_archives }}"
fi
if [[ -n "${{ inputs.qt_modules }}" ]]; then
qt_modules="--modules ${{ inputs.qt_modules }}"
fi
python3 -m aqt install-qt -O ${QT_INSTALL_PATH} ${QT_OS} desktop ${{ inputs.qt_version }} ${QT_ARCH} ${qt_archives} ${qt_modules}
echo "${QT_BASE_DIR}/bin" >> $GITHUB_PATH
echo "CMAKE_PREFIX_PATH=${QT_BASE_DIR}/lib/cmake" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=${QT_BASE_DIR}/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
echo "XDG_DATA_DIRS=${QT_BASE_DIR}/share:${XDG_DATA_DIRS}" >> $GITHUB_ENV
if [[ "${{ inputs.platform }}" == "windows" ]]; then
powershell "./.github/actions/install-qt/install-dbus.ps1" "$QT_BASE_DIR"
fi
qcoro-0.12.0/.github/actions/install-qt/install-dbus.ps1 0000664 0000000 0000000 00000001102 14773571425 0023044 0 ustar 00root root 0000000 0000000 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Set-PSRepository -Name 'PSGallery' -SourceLocation "https://www.powershellgallery.com/api/v2" -InstallationPolicy Trusted
Install-Module -Name 7Zip4PowerShell -Force
Invoke-WebRequest -Uri https://files.kde.org/craft/master/23.09/windows/cl/msvc2019/x86_64/RelWithDebInfo/libs/dbus/dbus-1.14.8-20230912T142911-windows-cl-msvc2019-x86_64.7z -OutFile C:\Qt\dbus.7z
Expand-7Zip -ArchiveFileName C:\Qt\dbus.7z -TargetPath $args[0]
qcoro-0.12.0/.github/dependabot.yml 0000664 0000000 0000000 00000000353 14773571425 0017125 0 ustar 00root root 0000000 0000000 version: 2
updates:
- package-ecosystem: "pip"
directory: "/" # Location of package manifests
schedule:
interval: "daily"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
qcoro-0.12.0/.github/workflows/ 0000775 0000000 0000000 00000000000 14773571425 0016331 5 ustar 00root root 0000000 0000000 qcoro-0.12.0/.github/workflows/build-docker-images.yml 0000664 0000000 0000000 00000004111 14773571425 0022660 0 ustar 00root root 0000000 0000000 name: Build Docker images
on:
push:
branches:
- main
paths:
- 'docker/**'
pull_request:
types: [opened, synchronize, reopened, edited]
paths:
- 'docker/**'
workflow_dispatch:
env:
BUILD_TYPE: RelWithDebInfo
QTEST_FUNCTION_TIMEOUT: 60000
jobs:
generate-matrix:
name: Generate build matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- id: set-matrix
name: Generate matrix
run: |
matrix_json=$(python3 ./.github/workflows/generate-matrix.py --platform linux)
echo "::set-output name=matrix::${matrix_json}"
build:
needs: generate-matrix
strategy:
matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }}
fail-fast: false
runs-on: ${{ matrix.runs_on }}
name: Build Docker image for ${{ matrix.platform }}-${{ matrix.compiler_full }}-qt-${{ matrix.qt_version }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Docker Buildx setup
uses: docker/setup-buildx-action@v3
- name: Login to GCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}/build-${{ matrix.compiler_full }}-qt-${{ matrix.qt_version }}
- name: Build and push image
uses: docker/build-push-action@v6
with:
build-args: |
compiler_image=${{ matrix.compiler_base_image }}
compiler_version=${{ matrix.compiler_version }}
qt_version=${{ matrix.qt_version }}
qt_modules=${{ matrix.qt_modules }}
qt_archives=${{ matrix.qt_archives }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: docker/Dockerfile.${{ matrix.compiler }}
context: docker
qcoro-0.12.0/.github/workflows/build-linux.yml 0000664 0000000 0000000 00000010546 14773571425 0021316 0 ustar 00root root 0000000 0000000 name: Linux CI
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, edited]
env:
BUILD_TYPE: Debug
QTEST_FUNCTION_TIMEOUT: 60000
jobs:
detect_run:
name: Check changes
outputs: { "source_code_changed": "${{ steps.source_code_changed.outputs.source_code_changed}}" }
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- id: changed_files
uses: tj-actions/changed-files@v46
name: Get changed files
with:
files_ignore: |
docs/**
docker/**
requirements.txt
mkdocs.yml
README.md
.github/**
- id: source_code_changed
name: Check for source code changes
if: steps.changed_files.outputs.any_changed == 'true'
run: |
echo "Detected changed files:"
echo "${{ steps.changed_files.outputs.all_changed_files }}"
echo "::set-output name=source_code_changed::true"
generate-matrix:
name: Generate build matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- id: set-matrix
name: Generate matrix
run: |
matrix_json=$(python3 ./.github/workflows/generate-matrix.py --platform=linux)
echo "::set-output name=matrix::${matrix_json}"
build:
needs: [ generate-matrix, detect_run ]
strategy:
matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }}
fail-fast: false
defaults:
run:
shell: bash -l {0}
runs-on: ${{ matrix.runs_on }}
name: ${{ matrix.platform }}-${{ matrix.compiler_full }}-qt-${{ matrix.qt_version }}
container:
image: ghcr.io/${{ github.repository }}/build-${{ matrix.compiler_full }}-qt-${{ matrix.qt_version }}:main
steps:
- name: Checkout sources
uses: actions/checkout@v4
if: ${{ needs.detect_run.outputs.source_code_changed == 'true' }}
- name: Create Build Environment
if: ${{ needs.detect_run.outputs.source_code_changed == 'true' }}
run: |
cmake -E make_directory build
- name: Configure CMake
if: ${{ needs.detect_run.outputs.source_code_changed == 'true' }}
run: |
QT_VERSION_MAJOR=$(echo ${{ matrix.qt_version }} | cut -d'.' -f1)
EXTRA_CMAKE_FLAGS="${EXTRA_CMAKE_FLAGS} -DBUILD_SHARED_LIBS=ON"
# Disable ASAN for clang-11 - we are hitting some bugs in ASAN & generators
if [[ "${{ matrix.compiler }}" == "clang" && "${{ matrix.compiler_version }}" == "11" ]]; then
EXTRA_CMAKE_FLAGS="${EXTRA_CMAKE_FLAGS} -DQCORO_ENABLE_ASAN=OFF"
fi
cmake -B build \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DUSE_QT_VERSION=$QT_VERSION_MAJOR \
-DQCORO_WITH_QTDBUS=${{ matrix.with_qtdbus }} \
-DQCORO_ENABLE_ASAN=ON \
${EXTRA_CMAKE_FLAGS}
- name: Build
if: ${{ needs.detect_run.outputs.source_code_changed == 'true' }}
run: |
cmake --build build --config $BUILD_TYPE --parallel $(nproc) --verbose
- name: Test
if: ${{ needs.detect_run.outputs.source_code_changed == 'true' }}
run: |
cd build
QT_LOGGING_TO_CONSOLE=1 ctest -C $BUILD_TYPE \
--output-on-failure \
--verbose \
--output-junit ${{ matrix.platform }}-${{ matrix.compiler_full }}-qt-${{ matrix.qt_version }}.xml
- name: Upload Test Results
if: ${{ needs.detect_run.outputs.source_code_changed == 'true' && always() }}
uses: actions/upload-artifact@v4
with:
name: Unit Tests Results (${{ matrix.platform }}-${{ matrix.compiler_full }}-qt-${{ matrix.qt_version }})
path: |
${{ github.workspace }}/build/${{ matrix.platform }}-${{ matrix.compiler_full }}-qt-${{ matrix.qt_version }}.xml
- name: Upload build logs on failure
if: ${{ needs.detect_run.outputs.source_code_changed == 'true' && failure() }}
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.platform }}-${{ matrix.compiler_full }}-qt-${{ matrix.qt_version }}
path: build/**
event_file:
name: "Event File"
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@v4
with:
name: Event File
path: ${{ github.event_path }}
qcoro-0.12.0/.github/workflows/build-macos.yml 0000664 0000000 0000000 00000011031 14773571425 0021247 0 ustar 00root root 0000000 0000000 name: MacOS CI
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, edited]
env:
BUILD_TYPE: Debug
QTEST_FUNCTION_TIMEOUT: 60000
jobs:
detect_run:
name: Check changes
outputs: { "source_code_changed": "${{ steps.source_code_changed.outputs.source_code_changed}}" }
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- id: changed_files
uses: tj-actions/changed-files@v46
name: Get changed files
with:
files_ignore: |
docs/**
docker/**
requirements.txt
mkdocs.yml
README.md
.github/**
- id: source_code_changed
name: Check for source code changes
if: steps.changed_files.outputs.any_changed == 'true'
run: |
echo "Detected changed files:"
echo "${{ steps.changed_files.outputs.all_changed_files }}"
echo "::set-output name=source_code_changed::true"
generate-matrix:
name: Generate build matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- id: set-matrix
name: Generate matrix
run: |
matrix_json=$(python3 ./.github/workflows/generate-matrix.py --platform=macos)
echo "::set-output name=matrix::${matrix_json}"
build:
needs: [ generate-matrix, detect_run ]
strategy:
matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }}
fail-fast: false
runs-on: ${{ matrix.runs_on }}
name: ${{ matrix.platform }}-${{ matrix.compiler_full }}-qt-${{ matrix.qt_version }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
if: ${{ needs.detect_run.outputs.source_code_changed == 'true' }}
- name: Install Qt
if: ${{ needs.detect_run.outputs.source_code_changed == 'true' }}
uses: ./.github/actions/install-qt
with:
qt_version: ${{ matrix.qt_version }}
qt_archives: ${{ matrix.qt_archives }}
qt_modules: ${{ matrix.qt_modules }}
platform: ${{ matrix.platform }}
- name: Create Build Environment
if: ${{ needs.detect_run.outputs.source_code_changed == 'true' }}
run: |
cmake -E make_directory ${{ github.workspace }}/build
- name: Configure CMake
if: ${{ needs.detect_run.outputs.source_code_changed == 'true' }}
shell: bash
working-directory: ${{ github.workspace }}/build
run: |
QT_VERSION_MAJOR=$(echo ${{ matrix.qt_version }} | cut -d'.' -f1)
# Don't fiddle with dlls in Windows, it makes things complicated...
EXTRA_CMAKE_FLAGS="${EXTRA_CMAKE_FLAGS} -DBUILD_SHARED_LIBS=ON"
cmake $GITHUB_WORKSPACE \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DUSE_QT_VERSION=$QT_VERSION_MAJOR \
-DQCORO_WITH_QTDBUS=${{ matrix.with_qtdbus }} \
-DQCORO_ENABLE_ASAN=ON \
${EXTRA_CMAKE_FLAGS}
- name: Build
if: ${{ needs.detect_run.outputs.source_code_changed == 'true' }}
shell: bash
working-directory: ${{ github.workspace }}/build
run: |
cmake --build . --config $BUILD_TYPE --parallel $(nproc) --verbose
- name: Test
if: ${{ needs.detect_run.outputs.source_code_changed == 'true' }}
shell: bash
working-directory: ${{ github.workspace }}/build
run: |
QT_LOGGING_TO_CONSOLE=1 ctest -C $BUILD_TYPE \
--output-on-failure \
--verbose \
--output-junit ${{ matrix.platform }}-${{ matrix.compiler_full }}-qt-${{ matrix.qt_version }}.xml
- name: Upload Test Results
if: ${{ needs.detect_run.outputs.source_code_changed == 'true' && always() }}
uses: actions/upload-artifact@v4
with:
name: Unit Tests Results (${{ matrix.platform }}-${{ matrix.compiler_full }}-qt-${{ matrix.qt_version }})
path: |
${{ github.workspace }}/build/${{ matrix.platform }}-${{ matrix.compiler_full }}-qt-${{ matrix.qt_version }}.xml
- name: Upload build logs on failure
if: ${{ needs.detect_run.outputs.source_code_changed == 'true' && failure() }}
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.platform }}-${{ matrix.compiler_full }}-qt-${{ matrix.qt_version }}
path: build/**
event_file:
name: "Event File"
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@v4
with:
name: Event File
path: ${{ github.event_path }}
qcoro-0.12.0/.github/workflows/build-windows.yml 0000664 0000000 0000000 00000013752 14773571425 0021653 0 ustar 00root root 0000000 0000000 name: Windows CI
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, edited]
env:
BUILD_TYPE: Debug
QTEST_FUNCTION_TIMEOUT: 60000
jobs:
detect_run:
name: Check changes
outputs: { "source_code_changed": "${{ steps.source_code_changed.outputs.source_code_changed}}" }
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- id: changed_files
uses: tj-actions/changed-files@v46
name: Get changed files
with:
files_ignore: |
docs/**
docker/**
requirements.txt
mkdocs.yml
README.md
.github/**
- id: source_code_changed
name: Check for source code changes
if: steps.changed_files.outputs.any_changed == 'true'
run: |
echo "Detected changed files:"
echo "${{ steps.changed_files.outputs.all_changed_files }}"
echo '::set-output name=source_code_changed::true'
generate-matrix:
name: Generate build matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- id: set-matrix
name: Generate matrix
run: |
matrix_json=$(python3 ./.github/workflows/generate-matrix.py --platform=windows)
echo "::set-output name=matrix::${matrix_json}"
build:
needs: [ generate-matrix, detect_run ]
strategy:
matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }}
fail-fast: false
runs-on: ${{ matrix.runs_on }}
name: ${{ matrix.platform }}-${{ matrix.compiler_full }}-qt-${{ matrix.qt_version }}
steps:
- name: Checkout sources
if: ${{ needs.detect_run.outputs.source_code_changed == 'true' }}
uses: actions/checkout@v4
- name: Install Qt
if: ${{ needs.detect_run.outputs.source_code_changed == 'true' }}
uses: ./.github/actions/install-qt
with:
qt_version: ${{ matrix.qt_version }}
qt_archives: ${{ matrix.qt_archives }}
qt_modules: ${{ matrix.qt_modules }}
platform: ${{ matrix.platform }}
- name: Create Build Environment
if: ${{ needs.detect_run.outputs.source_code_changed == 'true' }}
run: |
cmake -E make_directory ${{ github.workspace }}/build
- name: Configure CMake
if: ${{ needs.detect_run.outputs.source_code_changed == 'true' }}
shell: bash
working-directory: ${{ github.workspace }}/build
run: |
QT_VERSION_MAJOR=$(echo ${{ matrix.qt_version }} | cut -d'.' -f1)
if [[ "${{ matrix.compiler }}" == "clang-cl" ]]; then
# FIXME: allow ASAN with clang-cl
EXTRA_CMAKE_FLAGS="${EXTRA_CMAKE_FLAGS} -T ClangCL -DQCORO_ENABLE_ASAN=OFF"
fi
if [[ "${QT_VERSION_MAJOR}" == "5" ]]; then
EXTRA_CMAKE_FLAGS="${EXTRA_CMAKE_FLAGS} -DQCORO_ENABLE_ASAN=OFF"
fi
cmake $GITHUB_WORKSPACE \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DUSE_QT_VERSION=$QT_VERSION_MAJOR \
-DQCORO_WITH_QTDBUS=${{ matrix.with_qtdbus }} \
-DQCORO_ENABLE_ASAN=ON \
${EXTRA_CMAKE_FLAGS}
- name: Add ASAN DLL directory to PATH
if: ${{ needs.detect_run.outputs.source_code_changed == 'true' }}
shell: pwsh
run: |
$installDir=(& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath)
echo "Detected MSVC install dir: \"${installDir}\""
if ("${{ matrix.compiler}}" -eq "msvc") {
if (Test-Path -Path "${installDir}\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt") {
$vctoolsVersion=(Get-Content -Path "${installDir}\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt")
echo "Detected VCTools version: ${vctoolsVersion}"
} else {
echo "Failed to detect MSVC version"
exit 1
}
"${installDir}\VC\Tools\MSVC\${vctoolsVersion}\bin\HostX64\x64" >> $env:GITHUB_PATH
} else {
$clangVersion=((& "${installDir}\VC\Tools\Llvm\x64\bin\clang.exe" --version) | Select-String -Pattern "\d+.\d+.\d+" | % { $_.Matches } | % { $_.Value })
echo "Detected clang version: ${clangVersion}"
"${installDir}\VC\Tools\Llvm\x64\lib\clang\${clangVersion}\lib\windows" >> $env:GITHUB_PATH
}
- name: Build
if: ${{ needs.detect_run.outputs.source_code_changed == 'true' }}
shell: bash
working-directory: ${{ github.workspace }}/build
run: |
cmake --build . --config $BUILD_TYPE --parallel $(nproc) --verbose
- name: Test
if: ${{ needs.detect_run.outputs.source_code_changed == 'true' }}
shell: bash
working-directory: ${{ github.workspace }}/build
run: |
QT_LOGGING_TO_CONSOLE=1 ctest -C $BUILD_TYPE \
--output-on-failure \
--verbose \
--output-junit ${{ matrix.platform }}-${{ matrix.compiler_full }}-qt-${{ matrix.qt_version }}.xml
- name: Upload Test Results
if: ${{ needs.detect_run.outputs.source_code_changed == 'true' && always() }}
uses: actions/upload-artifact@v4
with:
name: Unit Tests Results (${{ matrix.platform }}-${{ matrix.compiler_full }}-qt-${{ matrix.qt_version }})
path: |
${{ github.workspace }}/build/${{ matrix.platform }}-${{ matrix.compiler_full }}-qt-${{ matrix.qt_version }}.xml
- name: Upload build logs on failure
if: ${{ needs.detect_run.outputs.source_code_changed == 'true' && failure() }}
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.platform }}-${{ matrix.compiler_full }}-qt-${{ matrix.qt_version }}
path: build/**
event_file:
name: "Event File"
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@v4
with:
name: Event File
path: ${{ github.event_path }}
qcoro-0.12.0/.github/workflows/generate-matrix.py 0000664 0000000 0000000 00000006003 14773571425 0021776 0 ustar 00root root 0000000 0000000 import json
from argparse import ArgumentParser
from typing import Any, Optional
qt5_config = {
"archives": ["qtbase", "icu", "qtwebsockets", "qtdeclarative", "qtwebchannel", "qtlocation"],
"modules": ["qtwebengine"]
}
qt6_config = {
"archives": ["qtbase", "icu", "qtdeclarative"],
"modules": ["qtwebsockets", "qtwebengine", "qtwebchannel", "qtpositioning"]
}
qt = [
{
"version": "5.15.2",
**qt5_config
},
{
"version": "6.2.0",
**qt6_config
},
{
"version": "6.5.0",
**qt6_config
}
]
platforms = [
{
"name": "windows",
"compilers": [
{"name": "msvc"},
{"name": "clang-cl"}
]
},
{
"name": "macos",
"compilers": [{"name": "apple-clang"}]
},
{
"name": "linux",
"compilers": [
{
"name": "gcc",
"versions": ["11", "12", "13", "14"]
},
{
"name": "clang",
"versions": ["15", "16", "17", "20", "dev"]
}
]
}
]
output = {
"include": []
}
def get_os_for_platform(platform: str) -> str:
if platform == "windows":
return "windows-2022"
if platform == "linux":
return "ubuntu-20.04"
if platform == "macos":
return "macos-13"
raise RuntimeError(f"Invalid platform '{platform}'.")
def get_base_image_for_compiler(compiler: str) -> Optional[str]:
if compiler == "gcc":
return "gcc"
if compiler == "clang":
return "debian"
return None
def create_configuration(
qt: dict[str, Any], platform: str, compiler: str,
compiler_version: str = ""
) -> dict[str, Any]:
return {
"qt_version": qt["version"],
"qt_modules": ' '.join(qt["modules"]),
"qt_archives": ' '.join(qt["archives"]),
"platform": platform,
"compiler": compiler,
"compiler_base_image": get_base_image_for_compiler(compiler),
"compiler_version": compiler_version,
"compiler_full": compiler if not compiler_version else f"{compiler}-{compiler_version}",
"runs_on": get_os_for_platform(platform),
"with_qtdbus": "OFF" if platform == "macos" else "ON"
}
parser = ArgumentParser()
parser.add_argument('--platform')
args = parser.parse_args()
filtered_platforms = list(filter(lambda p: p['name'] == args.platform, platforms))
for qt_version in qt:
for platform in filtered_platforms:
for compiler in platform["compilers"]:
if "versions" in compiler:
for compiler_version in compiler["versions"]:
output["include"].append(
create_configuration(
qt_version, platform["name"], compiler["name"], compiler_version
)
)
else:
output["include"].append(
create_configuration(qt_version, platform["name"], compiler["name"]))
print(json.dumps(output))
qcoro-0.12.0/.github/workflows/unit_tests_results.yml 0000664 0000000 0000000 00000002125 14773571425 0023036 0 ustar 00root root 0000000 0000000 name: Unit Test Results
on:
workflow_run:
workflows: ["Build and Test"]
types:
- completed
jobs:
unit-test-results:
name: Unit Test Results
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion != 'skipped'
steps:
- name: Download and Extract Artifacts
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
mkdir -p artifacts && cd artifacts
artifacts_url=${{ github.event.workflow_run.artifacts_url }}
gh api "$artifacts_url" -q '.artifacts[] | [.name, .archive_download_url] | @tsv' | while read artifact
do
IFS=$'\t' read name url <<< "$artifact"
gh api $url > "$name.zip"
unzip -d "$name" "$name.zip"
done
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
commit: ${{ github.event.workflow_run.head_sha }}
event_file: artifacts/Event File/event.json
event_name: ${{ github.event.workflow_run.event }}
files: "artifacts/**/*.xml"
qcoro-0.12.0/.github/workflows/update-docs.yml 0000664 0000000 0000000 00000006057 14773571425 0021274 0 ustar 00root root 0000000 0000000 name: Build and Deploy Documentation
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
detect_run:
name: Check changes
outputs: { "docs_changed": "${{ steps.docs_changed.outputs.docs_changed}}" }
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- id: changed_files
uses: tj-actions/changed-files@v46
name: Get changed files
with:
files: |
docs/**
requirements.txt
mkdocs.yml
README.md
.github/workflows/update-docs.yml
- id: docs_changed
name: Check for documentatio nchanges
if: steps.changed_files.outputs.any_changed == 'true'
run: |
echo "Detected changed files:"
echo "${{ steps.changed_files.outputs.all_changed_files }}"
echo "::set-output name=docs_changed::true"
build:
name: Build
runs-on: ubuntu-latest
needs: detect_run
if: ${{ needs.detect_run.outputs.docs_changed == 'true' }}
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install -r requirements.txt
- name: Build
run: |
echo "{% extends \"base.html\" %}{% block analytics %}
{% endblock %}" > docs/overrides/main.html
mkdocs build --verbose
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: site
path: site
deploy:
name: Deploy
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' }}
environment:
name: cloudflare-pages
url: ${{ steps.deploy.outputs.url }}
needs: build
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: site
path: site
- name: Deploy to Cloudflare Pages
id: deploy
uses: cloudflare/pages-action@1
env:
CLOUDFLARE_ACCOUNT_ID: ${{ SECRETS.CLOUDFLARE_ACCOUNT_ID }}
with:
apiToken: ${{ SECRETS.CLOUDFLARE_PAGES_TOKEN }}
accountId: ${{ SECRETS.CLOUDFLARE_ACCOUNT_ID }}
projectName: ${{ vars.CLOUDFLARE_PAGES_NAME }}
directory: ./site
githubToken: ${{ SECRETS.GITHUB_TOKEN }}
qcoro-0.12.0/.gitignore 0000664 0000000 0000000 00000000213 14773571425 0014720 0 ustar 00root root 0000000 0000000 build/
build-*/
.*.swp
.ccls-cache
.cache
compile_commands.json
/.vs
/.vscode
/CMakeSettings.json
# Python (from mkdocs)
__pycache__
venv
qcoro-0.12.0/.reuse/ 0000775 0000000 0000000 00000000000 14773571425 0014135 5 ustar 00root root 0000000 0000000 qcoro-0.12.0/.reuse/dep5 0000664 0000000 0000000 00000000433 14773571425 0014715 0 ustar 00root root 0000000 0000000 Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: QCoro
Upstream-Contact: Daniel Vrátil
Source: https://qcoro.github.io
# Sample paragraph, commented out:
#
# Files: src/*
# Copyright: $YEAR $NAME <$CONTACT>
# License: ...
qcoro-0.12.0/CMakeLists.txt 0000664 0000000 0000000 00000016547 14773571425 0015511 0 ustar 00root root 0000000 0000000 cmake_minimum_required(VERSION 3.18.4)
set(qcoro_VERSION 0.12.0)
set(qcoro_SOVERSION 0)
project(qcoro LANGUAGES CXX VERSION ${qcoro_VERSION})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(GNUInstallDirs)
include(CTest)
include(FeatureSummary)
#-----------------------------------------------------------#
# Options
#-----------------------------------------------------------#
# Allow QCORO_BUILD_TESTING to override BUILD_TESTING, but default to BUILD_TESTING if not set
if (DEFINED QCORO_BUILD_TESTING)
set(BUILD_TESTING ${QCORO_BUILD_TESTING})
endif()
option(QCORO_BUILD_EXAMPLES "Build examples" ON)
add_feature_info(Examples QCORO_BUILD_EXAMPLES "Build examples")
option(QCORO_BUILD_TESTING "Build QCoro tests" ${BUILD_TESTING})
add_feature_info(Testing QCORO_BUILD_TESTING "Build QCoro tests")
option(QCORO_ENABLE_ASAN "Build with AddressSanitizer" OFF)
add_feature_info(Asan QCORO_ENABLE_ASAN "Build with AddressSanitizer")
option(QCORO_DISABLE_DEPRECATED_TASK_H "Disable deprecated task.h header" OFF)
if(WIN32 OR APPLE OR ANDROID)
option(QCORO_WITH_QTDBUS "Build QtDBus support" OFF)
else()
option(QCORO_WITH_QTDBUS "Build QtDBus support" ON)
endif()
add_feature_info(QtDBus QCORO_WITH_QTDBUS "Build QtDBus support")
option(QCORO_WITH_QTNETWORK "Build QtNetwork support" ON)
add_feature_info(QtNetwork QCORO_WITH_QTNETWORK "Build QtNetwork support")
option(QCORO_WITH_QTWEBSOCKETS "Build QtWebSockets support" ON)
add_feature_info(QtWebSockets QCORO_WITH_QTWEBSOCKETS "Build QtWebSockets support")
option(QCORO_WITH_QTQUICK "Build QtQuick support" ON)
add_feature_info(QtQuick QCORO_WITH_QTQUICK "Build QtQuick support")
option(QCORO_WITH_QML "Build QML integration features" ON)
add_feature_info(QtQml QCORO_WITH_QML "Build QML integration features")
option(QCORO_WITH_QTTEST "Build QtTest support" ON)
add_feature_info(QtTest QCORO_WITH_QTTEST "Build QtTest support")
#-----------------------------------------------------------#
# Dependencies
#-----------------------------------------------------------#
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)
include(cmake/CheckAtomic.cmake)
set(REQUIRED_QT_COMPONENTS Core)
set(REQUIRED_QT5_COMPONENTS)
set(REQUIRED_QT6_COMPONENTS)
if (QCORO_WITH_QTDBUS)
list(APPEND REQUIRED_QT_COMPONENTS DBus)
endif()
if (QCORO_WITH_QTNETWORK)
list(APPEND REQUIRED_QT_COMPONENTS Network)
endif()
if (QCORO_WITH_QTWEBSOCKETS)
list(APPEND REQUIRED_QT_COMPONENTS WebSockets)
endif()
if (QCORO_WITH_QTQUICK)
list(APPEND REQUIRED_QT_COMPONENTS Gui Quick QuickPrivate)
endif()
if (QCORO_WITH_QML)
list(APPEND REQUIRED_QT_COMPONENTS Qml)
# Qt6 needs access to private API
list(APPEND REQUIRED_QT6_COMPONENTS QmlPrivate)
endif()
if (QCORO_WITH_QTTEST)
list(APPEND REQUIRED_QT_COMPONENTS Test)
endif()
if (QCORO_BUILD_EXAMPLES)
list(APPEND REQUIRED_QT_COMPONENTS Widgets Concurrent)
endif()
if (BUILD_TESTING)
list(APPEND REQUIRED_QT_COMPONENTS Test Concurrent)
endif()
set(MIN_REQUIRED_QT5_VERSION "5.12")
set(MIN_REQUIRED_QT6_VERSION "6.2.0")
include(cmake/QCoroFindQt.cmake)
# Find Qt. If USE_QT_VERSION is not set, it will try to look for Qt6 first
# and fallback to Qt5 otherwise.
qcoro_find_qt(
QT_VERSION "${USE_QT_VERSION}"
COMPONENTS "${REQUIRED_QT_COMPONENTS}"
QT5_COMPONENTS "${REQUIRED_QT5_COMPONENTS}"
QT6_COMPONENTS "${REQUIRED_QT6_COMPONENTS}"
FOUND_VER_VAR QT_VERSION_MAJOR
)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/config.h
)
#-----------------------------------------------------------#
# Compiler Settings
#-----------------------------------------------------------#
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_AUTOMOC ON)
if (MSVC)
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# Explicitly enable exceptions support for clang-cl (it's only enabled by CMake when targeting the Windows-MSVC platform,
# see https://github.com/danvratil/qcoro/issues/90 for details)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
endif()
else()
if (ANDROID)
include(DetectAndroidNDKVersion)
detectAndroidNDKVersion(NDK_VERSION)
if ("${NDK_VERSION}" VERSION_LESS 26)
# Android NDK < 26 ships mismatching versions of clang and libc++ - libc++ is older and doesn't have coroutine support
# which forces us to use coroutines from std::experimental. But the clang itself is newer and emits an error about
# std::experimental coroutines being deprecated in LLVM 14. This option is needed to suppress the error.
add_compile_options(-Wno-error=deprecated-experimental-coroutine)
endif()
endif()
endif()
if (QCORO_ENABLE_ASAN)
if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /INCREMENTAL:NO")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /INCREMENTAL:NO")
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fsanitize=address")
endif()
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -fsanitize-recover=address")
endif()
endif()
include(qcoro/QCoroMacros.cmake)
qcoro_enable_coroutines()
include(cmake/CodeCoverage.cmake)
add_code_coverage()
add_code_coverage_all_targets(EXCLUDE "${CMAKE_BINARY_DIR}" tests/utils/*)
#-----------------------------------------------------------#
# Definitions
#-----------------------------------------------------------#
# debug suffixes for qmake compatibility
if(WIN32)
set(CMAKE_DEBUG_POSTFIX "d")
elseif(APPLE)
set(CMAKE_DEBUG_POSTFIX "_debug")
else()
set(CMAKE_DEBUG_POSTFIX "")
endif()
set(QCORO_TARGET_PREFIX "QCoro${QT_VERSION_MAJOR}")
set(QCORO_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}/qcoro${QT_VERSION_MAJOR}")
#-----------------------------------------------------------#
# Sources
#-----------------------------------------------------------#
set(QCORO_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
add_subdirectory(qcoro)
if (QCORO_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
if (QCORO_BUILD_TESTING)
add_subdirectory(tests)
endif()
#-----------------------------------------------------------#
# Installation
#-----------------------------------------------------------#
include(CMakePackageConfigHelpers)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/config.h
DESTINATION ${QCORO_INSTALL_INCLUDEDIR}/qcoro
COMPONENT Devel
)
configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/QCoroConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/QCoro${QT_VERSION_MAJOR}Config.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/QCoro${QT_VERSION_MAJOR}"
PATH_VARS CMAKE_INSTALL_INCLUDEDIR
)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/QCoro${QT_VERSION_MAJOR}ConfigVersion.cmake"
VERSION ${qcoro_VERSION}
COMPATIBILITY SameMajorVersion
)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/QCoro${QT_VERSION_MAJOR}Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/QCoro${QT_VERSION_MAJOR}ConfigVersion.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/QCoro${QT_VERSION_MAJOR}"
COMPONENT Devel
)
#-----------------------------------------------------------#
# Summary
#-----------------------------------------------------------#
feature_summary(FATAL_ON_MISSING_REQUIRED_PACKAGES WHAT ALL)
qcoro-0.12.0/LICENSE 0000664 0000000 0000000 00000002101 14773571425 0013733 0 ustar 00root root 0000000 0000000 MIT License
Copyright (c) 2022 Daniel Vrátil
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
qcoro-0.12.0/LICENSES/ 0000775 0000000 0000000 00000000000 14773571425 0014141 5 ustar 00root root 0000000 0000000 qcoro-0.12.0/LICENSES/BSD-3-Clause.txt 0000664 0000000 0000000 00000002664 14773571425 0016674 0 ustar 00root root 0000000 0000000 Copyright (c) .
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
qcoro-0.12.0/LICENSES/GFDL-1.3-or-later.txt 0000664 0000000 0000000 00000054407 14773571425 0017452 0 ustar 00root root 0000000 0000000 GNU Free Documentation License
Version 1.3, 3 November 2008
Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
0. PREAMBLE
The purpose of this License is to make a manual, textbook, or other functional and useful document "free" in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others.
This License is a kind of "copyleft", which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software.
We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference.
1. APPLICABILITY AND DEFINITIONS
This License applies to any manual or other work, in any medium, that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The "Document", below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as "you". You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law.
A "Modified Version" of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language.
A "Secondary Section" is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document's overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them.
The "Invariant Sections" are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License. If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant. The Document may contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none.
The "Cover Texts" are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words.
A "Transparent" copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is not "Transparent" is called "Opaque".
Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML, PostScript or PDF designed for human modification. Examples of transparent image formats include PNG, XCF and JPG. Opaque formats include proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML, PostScript or PDF produced by some word processors for output purposes only.
The "Title Page" means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, "Title Page" means the text near the most prominent appearance of the work's title, preceding the beginning of the body of the text.
The "publisher" means any person or entity that distributes copies of the Document to the public.
A section "Entitled XYZ" means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific section name mentioned below, such as "Acknowledgements", "Dedications", "Endorsements", or "History".) To "Preserve the Title" of such a section when you modify the Document means that it remains a section "Entitled XYZ" according to this definition.
The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document. These Warranty Disclaimers are considered to be included by reference in this License, but only as regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this License.
2. VERBATIM COPYING
You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3.
You may also lend copies, under the same conditions stated above, and you may publicly display copies.
3. COPYING IN QUANTITY
If you publish printed copies (or copies in media that commonly have printed covers) of the Document, numbering more than 100, and the Document's license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects.
If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages.
If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a computer-network location from which the general network-using public has access to download using public-standard network protocols a complete Transparent copy of the Document, free of added material. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public.
It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document.
4. MODIFICATIONS
You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version:
A. Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission.
B. List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has fewer than five), unless they release you from this requirement.
C. State on the Title page the name of the publisher of the Modified Version, as the publisher.
D. Preserve all the copyright notices of the Document.
E. Add an appropriate copyright notice for your modifications adjacent to the other copyright notices.
F. Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below.
G. Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document's license notice. H. Include an unaltered copy of this License.
I. Preserve the section Entitled "History", Preserve its Title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no section Entitled "History" in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence.
J. Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the "History" section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission.
K. For any section Entitled "Acknowledgements" or "Dedications", Preserve the Title of the section, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein.
L. Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles.
M. Delete any section Entitled "Endorsements". Such a section may not be included in the Modified Version.
N. Do not retitle any existing section to be Entitled "Endorsements" or to conflict in title with any Invariant Section.
O. Preserve any Warranty Disclaimers.
If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version's license notice. These titles must be distinct from any other section titles.
You may add a section Entitled "Endorsements", provided it contains nothing but endorsements of your Modified Version by various parties--for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard.
You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one.
The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version.
5. COMBINING DOCUMENTS
You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers.
The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work.
In the combination, you must combine any sections Entitled "History" in the various original documents, forming one section Entitled "History"; likewise combine any sections Entitled "Acknowledgements", and any sections Entitled "Dedications". You must delete all sections Entitled "Endorsements".
6. COLLECTIONS OF DOCUMENTS
You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects.
You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document.
7. AGGREGATION WITH INDEPENDENT WORKS
A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, is called an "aggregate" if the copyright resulting from the compilation is not used to limit the legal rights of the compilation's users beyond what the individual works permit. When the Document is included in an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document.
If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half of the entire aggregate, the Document's Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form. Otherwise they must appear on printed covers that bracket the whole aggregate.
8. TRANSLATION
Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License, and all the license notices in the Document, and any Warranty Disclaimers, provided that you also include the original English version of this License and the original versions of those notices and disclaimers. In case of a disagreement between the translation and the original version of this License or a notice or disclaimer, the original version will prevail.
If a section in the Document is Entitled "Acknowledgements", "Dedications", or "History", the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title.
9. TERMINATION
You may not copy, modify, sublicense, or distribute the Document except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, or distribute it is void, and will automatically terminate your rights under this License.
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, receipt of a copy of some or all of the same material does not give you any rights to use it.
10. FUTURE REVISIONS OF THIS LICENSE
The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See http://www.gnu.org/copyleft/.
Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License "or any later version" applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation. If the Document specifies that a proxy can decide which future versions of this License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Document.
11. RELICENSING
"Massive Multiauthor Collaboration Site" (or "MMC Site") means any World Wide Web server that publishes copyrightable works and also provides prominent facilities for anybody to edit those works. A public wiki that anybody can edit is an example of such a server. A "Massive Multiauthor Collaboration" (or "MMC") contained in the site means any set of copyrightable works thus published on the MMC site.
"CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0 license published by Creative Commons Corporation, a not-for-profit corporation with a principal place of business in San Francisco, California, as well as future copyleft versions of that license published by that same organization.
"Incorporate" means to publish or republish a Document, in whole or in part, as part of another Document.
An MMC is "eligible for relicensing" if it is licensed under this License, and if all works that were first published under this License somewhere other than this MMC, and subsequently incorporated in whole or in part into the MMC, (1) had no cover texts or invariant sections, and (2) were thus incorporated prior to November 1, 2008.
The operator of an MMC Site may republish an MMC contained in the site under CC-BY-SA on the same site at any time before August 1, 2009, provided the MMC is eligible for relicensing.
ADDENDUM: How to use this License for your documents
To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page:
Copyright (c) YEAR YOUR NAME. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace the "with...Texts." line with this:
with the Invariant Sections being LIST THEIR TITLES, with the Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
If you have Invariant Sections without Cover Texts, or some other combination of the three, merge those two alternatives to suit the situation.
If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software.
qcoro-0.12.0/LICENSES/MIT.txt 0000664 0000000 0000000 00000002101 14773571425 0015325 0 ustar 00root root 0000000 0000000 MIT License
Copyright (c) 2021 Daniel Vrátil
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
qcoro-0.12.0/QCoroConfig.cmake.in 0000664 0000000 0000000 00000003161 14773571425 0016515 0 ustar 00root root 0000000 0000000 if (CMAKE_VERSION VERSION_LESS 3.1.0)
message(FATAL_ERROR \"QCoro@QT_VERSION_MAJOR@ requires at least CMake version 3.1.0\")
endif()
if (NOT QCoro@QT_VERSION_MAJOR@_FIND_COMPONENTS)
set(QCoro@QT_VERSION_MAJOR@_NOT_FOUND_MESSAGE "The QCoro@QT_VERSION_MAJOR@ package requires at least one component")
set(QCoro@QT_VERSION_MAJOR@_FOUND FALSE)
return()
endif()
set(_QCoro_FIND_PARTS_REQUIRED)
if (QCoro@QT_VERSION_MAJOR@_FIND_REQUIRED)
set(_QCoro_FIND_PARTS_REQUIRED REQUIRED)
endif()
set(_QCoro_FIND_PARTS_QUIET)
if (QCoro@QT_VERSION_MAJOR@_FIND_QUIET)
set(_QCoro_FIND_PARTS_QUIET QUIET)
endif()
get_filename_component(_qcoro_install_prefix "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE)
set(_QCoro_NOTFOUND_MESSAGE)
foreach(module ${QCoro@QT_VERSION_MAJOR@_FIND_COMPONENTS})
find_package(QCoro@QT_VERSION_MAJOR@${module}
${_QCoro_FIND_PARTS_QUIET}
${_QCoro_FIND_PARTS_REQUIRED}
PATHS ${_qcoro_install_prefix} NO_DEFAULT_PATH
)
if (NOT QCoro@QT_VERSION_MAJOR@${module}_FOUND)
if (QCoro@QT_VERSION_MAJOR@_FIND_REQUIRED_${module})
set(_QCoro_NOTFOUND_MESSAGE "${_QCoro_NOTFOUND_MESSAGE}Failed to find QCoro component \"${module}\" config file at \"${_qcoro_install_prefix}\"\n")
elseif (NOT QCoro@QT_VERSION_MAJOR@_FIND_QUIETLY)
message(WARNING "Failed to find QCoro@QT_VERSION_MAJOR@ component \"${module}\" config file at \"${_qcoro_install_prefix}\"")
endif()
endif()
endforeach()
if (_QCoro_NOTFOUND_MESSAGE)
set(QCoro@QT_VERSION_MAJOR@_NOT_FOUND_MESSAGE "${_QCoro_NOTFOUND_MESSAGE}")
set(QCoro@QT_VERSION_MAJOR@_FOUND FALSE)
endif()
qcoro-0.12.0/README.md 0000664 0000000 0000000 00000020364 14773571425 0014220 0 ustar 00root root 0000000 0000000 [](https://github.com/qcoro/qcoro/actions/workflows/build-linux.yml)
[](https://github.com/qcoro/qcoro/actions/workflows/build-windows.yml)
[](https://github.com/qcoro/qcoro/actions/workflows/build-macos.yml)
[](https://github.com/qcoro/qcoro/actions/workflows/update-docs.yml)
[](https://github.com/qcoro/qcoro/releases)



# QCoro - Coroutines for Qt5 and Qt6
The QCoro library provides set of tools to make use of C++20 coroutines with Qt.
Take a look at the example below to see what an amazing thing coroutines are:
```cpp
QNetworkAccessManager networkAccessManager;
// co_await the reply - the coroutine is suspended until the QNetworkReply is finished.
// While the coroutine is suspended, *the Qt event loop runs as usual*.
const QNetworkReply *reply = co_await networkAccessManager.get(url);
// Once the reply is finished, your code resumes here as if nothing amazing has just happened ;-)
const auto data = reply->readAll();
```
It requires a compiler with support for the couroutines TS, see [documentation](https://qcoro.dev/#supported-compilers) for a list of supported compilers and versions.
## Documentation
👉 📘 [Documentation](https://qcoro.dev/)
## Supported Qt Types
QCoro provides the tools necessary to make easy use of C++20 coroutines with Qt. The cornerstone of
the library is `QCoro::Task`, which represents an executed coroutine and allows the result of
the coroutine to be asynchronously awaited by its caller. Additionally, QCoro provides a set of
wrappers for common Qt types, such as `QTimer`, `QNetworkReply`, `QDBusPendingCall`, `QFuture`
and others, that allow to `co_await` their asynchronous operations directly.
Additionally, there's a magical `qCoro()` function that can wrap many native Qt functions and types
to make them coroutine-friendly.
Go check the [documentation](https://qcoro.dev/reference) for a full list of all supported
features and Qt types.
### `QDBusPendingCall`
QCoro can wait for an asynchronous D-Bus call to finish. There's no need to use `QDBusPendingCallWatcher`
with QCoro - just `co_await` the result instead. While co_awaiting, the Qt event loop runs as usual.
```cpp
QDBusInterface remoteServiceInterface{serviceName, objectPath, interface};
const QDBusReply isReady = co_await remoteServiceInterface.asyncCall(QStringLiteral("isReady"));
```
📘 [Full documentation here](https://qcoro.dev/reference/dbus/qdbuspendingcall).
### `QFuture`
QFuture represents a result of an asynchronous task. Normally you have to use `QFutureWatcher` to get
notified when the future is ready. With QCoro, you can just `co_await` it!
```cpp
const QFuture task1 = QtConcurrent::run(....);
const QFuture task2 = QtConcurrent::run(....);
const int a = co_await task1;
const int b = co_await task2;
co_return a + b;
```
📘 [Full documentation here](https://qcoro.dev/reference/core/qfuture).
### `QNetworkReply`
Doing network requests with Qt can be tedious - the signal/slot approach breaks the flow
of your code. Chaining requests and error handling quickly become mess and your code is
broken into numerous functions. But not with QCoro, where you can simply `co_await` the
`QNetworkReply` to finish:
```cpp
QNetworkAccessManager qnam;
QNetworkReply *reply = qnam.get(QStringLiteral("https://github.com/qcoro/qcoro"));
const auto contents = co_await reply;
reply->deleteLater();
if (reply->error() != QNetworkReply::NoError) {
co_return handleError(reply);
}
const auto link = findLinkInReturnedHtmlCode(contents);
reply = qnam.get(link);
const auto data = co_await reply;
reply->deleteLater();
if (reply->error() != QNetworkReply::NoError) {
co_return handleError(reply);
}
...
```
📘 [Full documentation here](https://qcoro.dev/reference/network/qnetworkreply).
### `QTimer`
Maybe you want to delay executing your code for a second, maybe you want to execute some
code in repeated interval. This becomes super-trivial with `co_await`:
```cpp
QTimer timer;
timer.setInterval(1s);
timer.start();
for (int i = 1; i <= 100; ++i) {
co_await timer;
qDebug() << "Waiting for " << i << " seconds...";
}
qDebug() << "Done!";
```
📘 [Full documentation here](https://qcoro.dev/reference/core/qtimer).
### `QIODevice`
`QIODevice` is a base-class for many classes in Qt that allow data to be asynchronously
written and read. How do you find out that there are data ready to be read? You could
connect to `QIODevice::readyRead()` singal, or you could use QCoro and `co_await` the object:
```cpp
socket->write("PING");
// Waiting for "pong"
const auto data = co_await socket;
co_return calculateLatency(data);
```
📘 [Full documentation here](https://qcoro.dev/reference/core/qiodevice).
### ...and more!
Go check the [full documentation](https://qcoro.dev) to learn more.
## .then() continuations
Sometimes it's not possible to use `co_await` to handle result of a coroutine - usually
when interfacing with a 3rd party code that does not support coroutines. In those
scenarios it's possible to chain a continuation callback to the coroutine which will
get invoked asynchronously when the coroutine finishes.
```cpp
void regularFunction() {
someCoroutineReturningInt().then([](int result) {
// handle result
});
}
```
The continuation callback can also be a coroutine and the result of the entire
expression is Task where T is the return type of the continuation. Thanks to
that it's possible to `co_await` the entire chain, or chain multiple `.then()`
continuations.
📘 [Full documentation here](https://qcoro.dev/reference/coro/task).
## Generators
Generator is a coroutine that lazily produces multiple values. While there's
nothing Qt-specific, QCoro provides the necessary tools for users to create
custom generators in their Qt applications.
QCoro provides API for both synchronous generators (`QCoro::Generator`)
and asynchronous generators (`QCoro::AsyncGenerator`). Both generators provide
container-like API: `begin()` and `end()` member functions that return iterator-like
objects, which is well-known and established API and makes generators compatible
with existing algorithms.
```cpp
QCoro::Generator fibonacci() {
quint64 a = 0, b = 0;
Q_FOREVER {
co_yield b;
const auto tmp = b;
a = b;
b += tmp;
}
}
void printFib(quint64 max) {
for (auto fib : fibonacci()) {
if (fib > max) {
break;
}
std::cout << fib << std::endl;
}
}
```
📘 [Full documentation here](https://qcoro.dev/reference/coro/generator).
## License
```text
MIT License
Copyright (c) 2022 Daniel Vrátil
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```
qcoro-0.12.0/cmake/ 0000775 0000000 0000000 00000000000 14773571425 0014014 5 ustar 00root root 0000000 0000000 qcoro-0.12.0/cmake/AddQCoroLibrary.cmake 0000664 0000000 0000000 00000021632 14773571425 0020003 0 ustar 00root root 0000000 0000000 # SPDX-FileCopyrightText: 2022 Daniel Vrátil
#
# SPDX-License-Identifier: MIT
include(GenerateHeaders)
include(GenerateExportHeader)
include(GenerateModuleConfigFile)
include(ECMGeneratePriFile)
function(set_target_defaults target_name)
set(DEFAULT_QT_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII QT_NO_URL_CAST_FROM_STRING QT_NO_CAST_FROM_BYTEARRAY QT_USE_STRINGBUILDER QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_KEYWORDS QT_NO_FOREACH)
get_target_property(target_type ${target_name} TYPE)
if (target_type STREQUAL "INTERFACE_LIBRARY")
# We can't set compile definitions for interface libraries as that would leak into user code
return()
endif()
target_compile_definitions(${target_name} PRIVATE ${DEFAULT_QT_DEFINITIONS})
if (NOT WIN32)
# strict iterators on MSVC only work when Qt itself is also built with them,
# which is not usually the case. Otherwise there are linking issues.
target_compile_definitions(${target_name} PRIVATE QT_STRICT_ITERATORS)
endif()
string(TOLOWER "${CMAKE_BUILD_TYPE}" build_type_lowercase)
if ("${build_type_lowercase}" STREQUAL "debug")
if (MSVC)
target_compile_options(${target_name} PRIVATE /W4 /WX)
# Disable warning C5054: "operator '&': deprecated between enumerations of different types" caused by QtWidgets/qsizepolicy.h
# Disable warning C4127: "conditional expression is constant" caused by QtCore/qiterable.h
target_compile_options(${target_name} PRIVATE /wd5054 /wd4127)
if ("${QT_VERSION_MAJOR}" STREQUAL "6" AND "${Qt6_VERSION}" VERSION_GREATER_EQUAL "6.4.0" AND "${Qt6_VERSION}" VERSION_LESS "6.5.3")
# Disable warning C4702: "unreachable code" caused by QtTest/qtestcase.h - fixed in Qt 6.5.3
target_compile_options(${target_name} PRIVATE /wd4702)
endif()
else()
target_compile_options(${target_name} PRIVATE -Wall -Wextra -Werror -pedantic -Wno-language-extension-token)
endif()
endif()
endfunction()
function(add_qcoro_library)
function(prefix_libraries)
set(oneValueArgs PREFIX OUTPUT)
set(multiValueArgs LIBRARIES)
cmake_parse_arguments(prf "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(_libs)
foreach(libname ${prf_LIBRARIES})
if ("${libname}" MATCHES "PUBLIC|PRIVATE|INTERFACE")
list(APPEND _libs "${libname}")
else()
list(APPEND _libs "${prf_PREFIX}::${libname}")
endif()
endforeach()
set(${prf_OUTPUT} ${_libs} PARENT_SCOPE)
endfunction()
function(process_qmake_deps)
set(oneValueArgs PREFIX OUTPUT)
set(multiValueArgs LIBRARIES)
cmake_parse_arguments(pqd "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(_libs_priv FALSE)
set(_deps)
foreach (dep ${pqd_LIBRARIES})
if ("${dep}" MATCHES "PUBLIC|INTERFACE|public|interface")
set(_libs_priv FALSE)
continue()
elseif ("${dep}" MATCHES "PRIVATE|private")
set(_libs_priv TRUE)
continue()
endif()
if (NOT _libs_priv)
set(_deps "${_deps} ${pqd_PREFIX}${dep}")
endif()
endforeach()
set(${pqd_OUTPUT} ${_deps} PARENT_SCOPE)
endfunction()
set(params INTERFACE NO_CMAKE_CONFIG)
set(oneValueArgs NAME)
set(multiValueArgs SOURCES CAMELCASE_HEADERS HEADERS QCORO_LINK_LIBRARIES QT_LINK_LIBRARIES)
cmake_parse_arguments(LIB "${params}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(target_name "${QCORO_TARGET_PREFIX}${LIB_NAME}")
string(TOLOWER "${target_name}" target_name_lowercase)
set(target_interface)
set(target_include_interface "PUBLIC")
if (LIB_INTERFACE)
set(target_interface "INTERFACE")
set(target_include_interface "INTERFACE")
endif()
prefix_libraries(
PREFIX ${QCORO_TARGET_PREFIX}
LIBRARIES ${LIB_QCORO_LINK_LIBRARIES}
OUTPUT qcoro_LIBS
)
prefix_libraries(
PREFIX Qt${QT_VERSION_MAJOR}
LIBRARIES ${LIB_QT_LINK_LIBRARIES}
OUTPUT qt_LIBS
)
# TODO: How is it done in Qt?
# We want to export target QCoro5::Network but so far we are exporting
# QCoro5::QCoro5Network :shrug:
add_library(${target_name} ${target_interface})
add_library(${QCORO_TARGET_PREFIX}::${LIB_NAME} ALIAS ${target_name})
if (LIB_SOURCES)
target_sources(${target_name} PRIVATE ${LIB_SOURCES})
endif()
target_include_directories(
${target_name}
${target_include_interface} $
${target_include_interface} $
${target_include_interface} $
${target_include_interface} $
${target_include_interface} $
${target_include_interface} $
${target_include_interface} $
${target_include_interface} $
)
target_link_libraries(${target_name} ${qcoro_LIBS})
target_link_libraries(${target_name} ${qt_LIBS})
if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB AND NOT LIB_INTERFACE)
target_link_libraries(${target_name} PUBLIC atomic)
endif()
set_target_properties(
${target_name}
PROPERTIES
EXPORT_NAME ${LIB_NAME}
)
set_target_defaults(${target_name})
if (NOT LIB_INTERFACE)
set_target_properties(
${target_name}
PROPERTIES
WINDOWS_EXPORT_ALL_SYMBOLS 1
VERSION ${qcoro_VERSION}
SOVERSION ${qcoro_SOVERSION}
)
target_code_coverage(${target_name} AUTO)
else()
target_code_coverage(${target_name} AUTO INTERFACE)
endif()
generate_headers(
camelcase_HEADERS
HEADER_NAMES ${LIB_CAMELCASE_HEADERS}
OUTPUT_DIR QCoro
ORIGINAL_HEADERS_VAR source_HEADERS
)
if (NOT LIB_INTERFACE)
string(TOUPPER "qcoro${LIB_NAME}" export_name)
string(TOLOWER "${export_name}" export_file)
generate_export_header(
${target_name}
BASE_NAME ${export_name}
)
endif()
if (NOT LIB_NO_CMAKE_CONFIG)
generate_cmake_module_config_file(
NAME ${LIB_NAME}
TARGET_NAME ${target_name}
QT_DEPENDENCIES ${LIB_QT_LINK_LIBRARIES}
QCORO_DEPENDENCIES ${LIB_QCORO_LINK_LIBRARIES}
)
endif()
string(TOLOWER "${LIB_QT_LINK_LIBRARIES}" lc_qt_link_libraries)
process_qmake_deps(
OUTPUT qmake_qt_deps
LIBRARIES ${lc_qt_link_libraries}
)
process_qmake_deps(
PREFIX QCoro
OUTPUT qmake_qcoro_deps
LIBRARIES ${LIB_QCORO_LINK_LIBRARIES}
)
set(egp_INTERFACE)
if (LIB_INTERFACE)
set(egp_INTERFACE "INTERFACE")
endif()
ecm_generate_pri_file(
${egp_INTERFACE}
BASE_NAME QCoro${LIB_NAME}
LIB_NAME ${target_name}
VERSION ${qcoro_VERSION}
INCLUDE_INSTALL_DIRS ${QCORO_INSTALL_INCLUDEDIR}/qcoro;${QCORO_INSTALL_INCLUDEDIR}/QCoro
DEPS "${qmake_qt_deps} ${qmake_qcoro_deps}"
)
install(
TARGETS ${target_name}
EXPORT ${target_name}Targets
)
install(
FILES ${source_HEADERS}
DESTINATION ${QCORO_INSTALL_INCLUDEDIR}/qcoro/
COMPONENT Devel
)
foreach(lib_header ${LIB_HEADERS})
get_filename_component(header_prefix_dir ${lib_header} DIRECTORY)
install(
FILES ${lib_header}
DESTINATION ${QCORO_INSTALL_INCLUDEDIR}/qcoro/${header_prefix_dir}
COMPONENT Devel
)
endforeach()
install(
FILES ${camelcase_HEADERS}
DESTINATION ${QCORO_INSTALL_INCLUDEDIR}/QCoro/
COMPONENT Devel
)
if (NOT LIB_INTERFACE)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${export_file}_export.h
DESTINATION ${QCORO_INSTALL_INCLUDEDIR}/qcoro
COMPONENT Devel
)
endif()
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/${target_name}Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${target_name}ConfigVersion.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${target_name}"
COMPONENT Devel
)
install(
EXPORT ${target_name}Targets
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${target_name}"
FILE "${target_name}Targets.cmake"
NAMESPACE ${QCORO_TARGET_PREFIX}::
COMPONENT Devel
)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/qt_QCoro${LIB_NAME}.pri"
DESTINATION "${ECM_MKSPECS_INSTALL_DIR}"
COMPONENT Devel
)
endfunction()
qcoro-0.12.0/cmake/CheckAtomic.cmake 0000664 0000000 0000000 00000002317 14773571425 0017173 0 ustar 00root root 0000000 0000000 # std::atomic may need libatomic to function correctly.
INCLUDE(CheckCXXSourceCompiles)
INCLUDE(CheckLibraryExists)
# Sometimes linking against libatomic is required for atomic ops, if
# the platform doesn't support lock-free atomics.
function(check_working_cxx_atomics varname)
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++20")
CHECK_CXX_SOURCE_COMPILES("
#include
std::atomic x;
std::atomic y;
std::atomic z;
int main() {
++z;
++y;
return ++x;
}
" ${varname})
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
endfunction(check_working_cxx_atomics)
# Check for (non-64-bit) atomic operations.
if(MSVC)
set(HAVE_CXX_ATOMICS_WITHOUT_LIB True)
else()
# First check if atomics work without the library.
check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB)
# If not, check if the library exists, and atomics work with it.
if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB)
list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB)
if (NOT HAVE_CXX_ATOMICS_WITH_LIB)
message(FATAL_ERROR "Host compiler must support std::atomic!")
endif()
endif()
endif()
qcoro-0.12.0/cmake/CodeCoverage.cmake 0000664 0000000 0000000 00000067377 14773571425 0017370 0 ustar 00root root 0000000 0000000 #
# Copyright (C) 2018-2020 by George Cave - gcave@stablecoder.ca
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
# USAGE: To enable any code coverage instrumentation/targets, the single CMake
# option of `CODE_COVERAGE` needs to be set to 'ON', either by GUI, ccmake, or
# on the command line.
#
# From this point, there are two primary methods for adding instrumentation to
# targets: 1 - A blanket instrumentation by calling `add_code_coverage()`, where
# all targets in that directory and all subdirectories are automatically
# instrumented. 2 - Per-target instrumentation by calling
# `target_code_coverage()`, where the target is given and thus only
# that target is instrumented. This applies to both libraries and executables.
#
# To add coverage targets, such as calling `make ccov` to generate the actual
# coverage information for perusal or consumption, call
# `target_code_coverage()` on an *executable* target.
#
# Example 1: All targets instrumented
#
# In this case, the coverage information reported will will be that of the
# `theLib` library target and `theExe` executable.
#
# 1a: Via global command
#
# ~~~
# add_code_coverage() # Adds instrumentation to all targets
#
# add_library(theLib lib.cpp)
#
# add_executable(theExe main.cpp)
# target_link_libraries(theExe PRIVATE theLib)
# target_code_coverage(theExe) # As an executable target, adds the 'ccov-theExe' target (instrumentation already added via global anyways) for generating code coverage reports.
# ~~~
#
# 1b: Via target commands
#
# ~~~
# add_library(theLib lib.cpp)
# target_code_coverage(theLib) # As a library target, adds coverage instrumentation but no targets.
#
# add_executable(theExe main.cpp)
# target_link_libraries(theExe PRIVATE theLib)
# target_code_coverage(theExe) # As an executable target, adds the 'ccov-theExe' target and instrumentation for generating code coverage reports.
# ~~~
#
# Example 2: Target instrumented, but with regex pattern of files to be excluded
# from report
#
# ~~~
# add_executable(theExe main.cpp non_covered.cpp)
# target_code_coverage(theExe EXCLUDE non_covered.cpp test/*) # As an executable target, the reports will exclude the non-covered.cpp file, and any files in a test/ folder.
# ~~~
#
# Example 3: Target added to the 'ccov' and 'ccov-all' targets
#
# ~~~
# add_code_coverage_all_targets(EXCLUDE test/*) # Adds the 'ccov-all' target set and sets it to exclude all files in test/ folders.
#
# add_executable(theExe main.cpp non_covered.cpp)
# target_code_coverage(theExe AUTO ALL EXCLUDE non_covered.cpp test/*) # As an executable target, adds to the 'ccov' and ccov-all' targets, and the reports will exclude the non-covered.cpp file, and any files in a test/ folder.
# ~~~
# Options
option(
CODE_COVERAGE
"Builds targets with code coverage instrumentation. (Requires GCC or Clang)"
OFF)
# Programs
find_program(LLVM_COV_PATH llvm-cov)
find_program(LLVM_PROFDATA_PATH llvm-profdata)
find_program(LCOV_PATH lcov)
find_program(GENHTML_PATH genhtml)
# Hide behind the 'advanced' mode flag for GUI/ccmake
mark_as_advanced(FORCE LLVM_COV_PATH LLVM_PROFDATA_PATH LCOV_PATH GENHTML_PATH)
# Variables
set(CMAKE_COVERAGE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/ccov)
set_property(GLOBAL PROPERTY JOB_POOLS ccov_serial_pool=1)
# Common initialization/checks
if(CODE_COVERAGE AND NOT CODE_COVERAGE_ADDED)
set(CODE_COVERAGE_ADDED ON)
# Common Targets
add_custom_target(
ccov-preprocessing
COMMAND ${CMAKE_COMMAND} -E make_directory
${CMAKE_COVERAGE_OUTPUT_DIRECTORY}
DEPENDS ccov-clean)
if(CMAKE_C_COMPILER_ID MATCHES "(Apple)?[Cc]lang"
OR CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?[Cc]lang")
# Messages
message(STATUS "Building with llvm Code Coverage Tools")
if(NOT LLVM_COV_PATH)
message(FATAL_ERROR "llvm-cov not found! Aborting.")
else()
# Version number checking for 'EXCLUDE' compatibility
execute_process(COMMAND ${LLVM_COV_PATH} --version
OUTPUT_VARIABLE LLVM_COV_VERSION_CALL_OUTPUT)
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" LLVM_COV_VERSION
${LLVM_COV_VERSION_CALL_OUTPUT})
if(LLVM_COV_VERSION VERSION_LESS "7.0.0")
message(
WARNING
"target_code_coverage()/add_code_coverage_all_targets() 'EXCLUDE' option only available on llvm-cov >= 7.0.0"
)
endif()
endif()
# Targets
if(${CMAKE_VERSION} VERSION_LESS "3.17.0")
add_custom_target(
ccov-clean
COMMAND ${CMAKE_COMMAND} -E remove -f
${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list
COMMAND ${CMAKE_COMMAND} -E remove -f
${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/profraw.list)
else()
add_custom_target(
ccov-clean
COMMAND ${CMAKE_COMMAND} -E rm -f
${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list
COMMAND ${CMAKE_COMMAND} -E rm -f
${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/profraw.list)
endif()
# Used to get the shared object file list before doing the main all-
# processing
add_custom_target(
ccov-libs
COMMAND ;
COMMENT "libs ready for coverage report.")
elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES
"GNU")
# Messages
message(STATUS "Building with lcov Code Coverage Tools")
if(CMAKE_BUILD_TYPE)
string(TOUPPER ${CMAKE_BUILD_TYPE} upper_build_type)
if(NOT ${upper_build_type} STREQUAL "DEBUG")
message(
WARNING
"Code coverage results with an optimized (non-Debug) build may be misleading"
)
endif()
else()
message(
WARNING
"Code coverage results with an optimized (non-Debug) build may be misleading"
)
endif()
if(NOT LCOV_PATH)
message(FATAL_ERROR "lcov not found! Aborting...")
endif()
if(NOT GENHTML_PATH)
message(FATAL_ERROR "genhtml not found! Aborting...")
endif()
# Targets
add_custom_target(ccov-clean COMMAND ${LCOV_PATH} --directory
${CMAKE_BINARY_DIR} --zerocounters)
else()
message(FATAL_ERROR "Code coverage requires Clang or GCC. Aborting.")
endif()
endif()
# Adds code coverage instrumentation to a library, or instrumentation/targets
# for an executable target.
# ~~~
# EXECUTABLE ADDED TARGETS:
# GCOV/LCOV:
# ccov : Generates HTML code coverage report for every target added with 'AUTO' parameter.
# ccov-${TARGET_NAME} : Generates HTML code coverage report for the associated named target.
# ccov-all : Generates HTML code coverage report, merging every target added with 'ALL' parameter into a single detailed report.
#
# LLVM-COV:
# ccov : Generates HTML code coverage report for every target added with 'AUTO' parameter.
# ccov-report : Generates HTML code coverage report for every target added with 'AUTO' parameter.
# ccov-${TARGET_NAME} : Generates HTML code coverage report.
# ccov-report-${TARGET_NAME} : Prints to command line summary per-file coverage information.
# ccov-export-${TARGET_NAME} : Exports the coverage report to a JSON file.
# ccov-show-${TARGET_NAME} : Prints to command line detailed per-line coverage information.
# ccov-all : Generates HTML code coverage report, merging every target added with 'ALL' parameter into a single detailed report.
# ccov-all-report : Prints summary per-file coverage information for every target added with ALL' parameter to the command line.
# ccov-all-export : Exports the coverage report to a JSON file.
#
# Required:
# TARGET_NAME - Name of the target to generate code coverage for.
# Optional:
# PUBLIC - Sets the visibility for added compile options to targets to PUBLIC instead of the default of PRIVATE.
# INTERFACE - Sets the visibility for added compile options to targets to INTERFACE instead of the default of PRIVATE.
# PLAIN - Do not set any target visibility (backward compatibility with old cmake projects)
# AUTO - Adds the target to the 'ccov' target so that it can be run in a batch with others easily. Effective on executable targets.
# ALL - Adds the target to the 'ccov-all' and 'ccov-all-report' targets, which merge several executable targets coverage data to a single report. Effective on executable targets.
# EXTERNAL - For GCC's lcov, allows the profiling of 'external' files from the processing directory
# COVERAGE_TARGET_NAME - For executables ONLY, changes the outgoing target name so instead of `ccov-${TARGET_NAME}` it becomes `ccov-${COVERAGE_TARGET_NAME}`.
# EXCLUDE - Excludes files of the patterns provided from coverage. Note that GCC/lcov excludes by glob pattern, and clang/LLVM excludes via regex! **These do not copy to the 'all' targets.**
# OBJECTS - For executables ONLY, if the provided targets are shared libraries, adds coverage information to the output
# ARGS - For executables ONLY, appends the given arguments to the associated ccov-* executable call
# ~~~
function(target_code_coverage TARGET_NAME)
# Argument parsing
set(options AUTO ALL EXTERNAL PUBLIC INTERFACE PLAIN)
set(single_value_keywords COVERAGE_TARGET_NAME)
set(multi_value_keywords EXCLUDE OBJECTS ARGS)
cmake_parse_arguments(
target_code_coverage "${options}" "${single_value_keywords}"
"${multi_value_keywords}" ${ARGN})
# Set the visibility of target functions to PUBLIC, INTERFACE or default to
# PRIVATE.
if(target_code_coverage_PUBLIC)
set(TARGET_VISIBILITY PUBLIC)
set(TARGET_LINK_VISIBILITY PUBLIC)
elseif(target_code_coverage_INTERFACE)
set(TARGET_VISIBILITY INTERFACE)
set(TARGET_LINK_VISIBILITY INTERFACE)
elseif(target_code_coverage_PLAIN)
set(TARGET_VISIBILITY PUBLIC)
set(TARGET_LINK_VISIBILITY)
else()
set(TARGET_VISIBILITY PRIVATE)
set(TARGET_LINK_VISIBILITY PRIVATE)
endif()
if(NOT target_code_coverage_COVERAGE_TARGET_NAME)
# If a specific name was given, use that instead.
set(target_code_coverage_COVERAGE_TARGET_NAME ${TARGET_NAME})
endif()
if(CODE_COVERAGE)
# Add code coverage instrumentation to the target's linker command
if(CMAKE_C_COMPILER_ID MATCHES "(Apple)?[Cc]lang"
OR CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?[Cc]lang")
target_compile_options(${TARGET_NAME} ${TARGET_VISIBILITY}
-fprofile-instr-generate -fcoverage-mapping)
target_link_options(${TARGET_NAME} ${TARGET_VISIBILITY}
-fprofile-instr-generate -fcoverage-mapping)
elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES
"GNU")
target_compile_options(${TARGET_NAME} ${TARGET_VISIBILITY} -fprofile-arcs
-ftest-coverage)
target_link_libraries(${TARGET_NAME} ${TARGET_LINK_VISIBILITY} gcov)
endif()
# Targets
get_target_property(target_type ${TARGET_NAME} TYPE)
# Add shared library to processing for 'all' targets
if(target_type STREQUAL "SHARED_LIBRARY" AND target_code_coverage_ALL)
if(CMAKE_C_COMPILER_ID MATCHES "(Apple)?[Cc]lang"
OR CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?[Cc]lang")
add_custom_target(
ccov-run-${target_code_coverage_COVERAGE_TARGET_NAME}
COMMAND
${CMAKE_COMMAND} -E echo "-object=$" >>
${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list
DEPENDS ccov-preprocessing ${TARGET_NAME})
if(NOT TARGET ccov-libs)
message(
FATAL_ERROR
"Calling target_code_coverage with 'ALL' must be after a call to 'add_code_coverage_all_targets'."
)
endif()
add_dependencies(ccov-libs
ccov-run-${target_code_coverage_COVERAGE_TARGET_NAME})
endif()
endif()
# For executables add targets to run and produce output
if(target_type STREQUAL "EXECUTABLE")
if(CMAKE_C_COMPILER_ID MATCHES "(Apple)?[Cc]lang"
OR CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?[Cc]lang")
# If there are shared objects to also work with, generate the string to
# add them here
foreach(SO_TARGET ${target_code_coverage_OBJECTS})
# Check to see if the target is a shared object
if(TARGET ${SO_TARGET})
get_target_property(SO_TARGET_TYPE ${SO_TARGET} TYPE)
if(${SO_TARGET_TYPE} STREQUAL "SHARED_LIBRARY")
set(SO_OBJECTS ${SO_OBJECTS} -object=$)
endif()
endif()
endforeach()
# Run the executable, generating raw profile data Make the run data
# available for further processing. Separated to allow Windows to run
# this target serially.
add_custom_target(
ccov-run-${target_code_coverage_COVERAGE_TARGET_NAME}
COMMAND
${CMAKE_COMMAND} -E env
LLVM_PROFILE_FILE=${target_code_coverage_COVERAGE_TARGET_NAME}.profraw
$ ${target_code_coverage_ARGS}
COMMAND
${CMAKE_COMMAND} -E echo "-object=$"
${SO_OBJECTS} >> ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list
COMMAND
${CMAKE_COMMAND} -E echo
"${CMAKE_CURRENT_BINARY_DIR}/${target_code_coverage_COVERAGE_TARGET_NAME}.profraw"
>> ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/profraw.list
JOB_POOL ccov_serial_pool
DEPENDS ccov-preprocessing ccov-libs ${TARGET_NAME})
# Merge the generated profile data so llvm-cov can process it
add_custom_target(
ccov-processing-${target_code_coverage_COVERAGE_TARGET_NAME}
COMMAND
${LLVM_PROFDATA_PATH} merge -sparse
${target_code_coverage_COVERAGE_TARGET_NAME}.profraw -o
${target_code_coverage_COVERAGE_TARGET_NAME}.profdata
DEPENDS ccov-run-${target_code_coverage_COVERAGE_TARGET_NAME})
# Ignore regex only works on LLVM >= 7
if(LLVM_COV_VERSION VERSION_GREATER_EQUAL "7.0.0")
foreach(EXCLUDE_ITEM ${target_code_coverage_EXCLUDE})
set(EXCLUDE_REGEX ${EXCLUDE_REGEX}
-ignore-filename-regex='${EXCLUDE_ITEM}')
endforeach()
endif()
# Print out details of the coverage information to the command line
add_custom_target(
ccov-show-${target_code_coverage_COVERAGE_TARGET_NAME}
COMMAND
${LLVM_COV_PATH} show $ ${SO_OBJECTS}
-instr-profile=${target_code_coverage_COVERAGE_TARGET_NAME}.profdata
-show-line-counts-or-regions ${EXCLUDE_REGEX}
DEPENDS ccov-processing-${target_code_coverage_COVERAGE_TARGET_NAME})
# Print out a summary of the coverage information to the command line
add_custom_target(
ccov-report-${target_code_coverage_COVERAGE_TARGET_NAME}
COMMAND
${LLVM_COV_PATH} report $ ${SO_OBJECTS}
-instr-profile=${target_code_coverage_COVERAGE_TARGET_NAME}.profdata
${EXCLUDE_REGEX}
DEPENDS ccov-processing-${target_code_coverage_COVERAGE_TARGET_NAME})
# Export coverage information so continuous integration tools (e.g.
# Jenkins) can consume it
add_custom_target(
ccov-export-${target_code_coverage_COVERAGE_TARGET_NAME}
COMMAND
${LLVM_COV_PATH} export $ ${SO_OBJECTS}
-instr-profile=${target_code_coverage_COVERAGE_TARGET_NAME}.profdata
-format="text" ${EXCLUDE_REGEX} >
${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/${target_code_coverage_COVERAGE_TARGET_NAME}.json
DEPENDS ccov-processing-${target_code_coverage_COVERAGE_TARGET_NAME})
# Generates HTML output of the coverage information for perusal
add_custom_target(
ccov-${target_code_coverage_COVERAGE_TARGET_NAME}
COMMAND
${LLVM_COV_PATH} show $ ${SO_OBJECTS}
-instr-profile=${target_code_coverage_COVERAGE_TARGET_NAME}.profdata
-show-line-counts-or-regions
-output-dir=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/${target_code_coverage_COVERAGE_TARGET_NAME}
-format="html" ${EXCLUDE_REGEX}
DEPENDS ccov-processing-${target_code_coverage_COVERAGE_TARGET_NAME})
elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES
"GNU")
set(COVERAGE_INFO
"${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/${target_code_coverage_COVERAGE_TARGET_NAME}.info"
)
# Run the executable, generating coverage information
add_custom_target(
ccov-run-${target_code_coverage_COVERAGE_TARGET_NAME}
COMMAND $ ${target_code_coverage_ARGS}
DEPENDS ccov-preprocessing ${TARGET_NAME})
# Generate exclusion string for use
foreach(EXCLUDE_ITEM ${target_code_coverage_EXCLUDE})
set(EXCLUDE_REGEX ${EXCLUDE_REGEX} --remove ${COVERAGE_INFO}
'${EXCLUDE_ITEM}')
endforeach()
if(EXCLUDE_REGEX)
set(EXCLUDE_COMMAND ${LCOV_PATH} ${EXCLUDE_REGEX} --output-file
${COVERAGE_INFO})
else()
set(EXCLUDE_COMMAND ;)
endif()
if(NOT ${target_code_coverage_EXTERNAL})
set(EXTERNAL_OPTION --no-external)
endif()
# Capture coverage data
if(${CMAKE_VERSION} VERSION_LESS "3.17.0")
add_custom_target(
ccov-capture-${target_code_coverage_COVERAGE_TARGET_NAME}
COMMAND ${CMAKE_COMMAND} -E remove -f ${COVERAGE_INFO}
COMMAND ${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} --zerocounters
COMMAND $ ${target_code_coverage_ARGS}
COMMAND
${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} --base-directory
${CMAKE_SOURCE_DIR} --capture ${EXTERNAL_OPTION} --output-file
${COVERAGE_INFO}
COMMAND ${EXCLUDE_COMMAND}
DEPENDS ccov-preprocessing ${TARGET_NAME})
else()
add_custom_target(
ccov-capture-${target_code_coverage_COVERAGE_TARGET_NAME}
COMMAND ${CMAKE_COMMAND} -E rm -f ${COVERAGE_INFO}
COMMAND ${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} --zerocounters
COMMAND $ ${target_code_coverage_ARGS}
COMMAND
${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} --base-directory
${CMAKE_SOURCE_DIR} --capture ${EXTERNAL_OPTION} --output-file
${COVERAGE_INFO}
COMMAND ${EXCLUDE_COMMAND}
DEPENDS ccov-preprocessing ${TARGET_NAME})
endif()
# Generates HTML output of the coverage information for perusal
add_custom_target(
ccov-${target_code_coverage_COVERAGE_TARGET_NAME}
COMMAND
${GENHTML_PATH} -o
${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/${target_code_coverage_COVERAGE_TARGET_NAME}
${COVERAGE_INFO}
DEPENDS ccov-capture-${target_code_coverage_COVERAGE_TARGET_NAME})
endif()
add_custom_command(
TARGET ccov-${target_code_coverage_COVERAGE_TARGET_NAME}
POST_BUILD
COMMAND ;
COMMENT
"Open ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/${target_code_coverage_COVERAGE_TARGET_NAME}/index.html in your browser to view the coverage report."
)
# AUTO
if(target_code_coverage_AUTO)
if(NOT TARGET ccov)
add_custom_target(ccov)
endif()
add_dependencies(ccov ccov-${target_code_coverage_COVERAGE_TARGET_NAME})
if(NOT CMAKE_C_COMPILER_ID MATCHES "GNU" AND NOT CMAKE_CXX_COMPILER_ID
MATCHES "GNU")
if(NOT TARGET ccov-report)
add_custom_target(ccov-report)
endif()
add_dependencies(
ccov-report
ccov-report-${target_code_coverage_COVERAGE_TARGET_NAME})
endif()
endif()
# ALL
if(target_code_coverage_ALL)
if(NOT TARGET ccov-all-processing)
message(
FATAL_ERROR
"Calling target_code_coverage with 'ALL' must be after a call to 'add_code_coverage_all_targets'."
)
endif()
add_dependencies(ccov-all-processing
ccov-run-${target_code_coverage_COVERAGE_TARGET_NAME})
endif()
endif()
endif()
endfunction()
# Adds code coverage instrumentation to all targets in the current directory and
# any subdirectories. To add coverage instrumentation to only specific targets,
# use `target_code_coverage`.
function(add_code_coverage)
if(CODE_COVERAGE)
if(CMAKE_C_COMPILER_ID MATCHES "(Apple)?[Cc]lang"
OR CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?[Cc]lang")
add_compile_options(-fprofile-instr-generate -fcoverage-mapping)
add_link_options(-fprofile-instr-generate -fcoverage-mapping)
elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES
"GNU")
add_compile_options(-fprofile-arcs -ftest-coverage)
link_libraries(gcov)
endif()
endif()
endfunction()
# Adds the 'ccov-all' type targets that calls all targets added via
# `target_code_coverage` with the `ALL` parameter, but merges all the coverage
# data from them into a single large report instead of the numerous smaller
# reports. Also adds the ccov-all-capture Generates an all-merged.info file, for
# use with coverage dashboards (e.g. codecov.io, coveralls).
# ~~~
# Optional:
# EXCLUDE - Excludes files of the patterns provided from coverage. Note that GCC/lcov excludes by glob pattern, and clang/LLVM excludes via regex!
# ~~~
function(add_code_coverage_all_targets)
# Argument parsing
set(multi_value_keywords EXCLUDE)
cmake_parse_arguments(add_code_coverage_all_targets "" ""
"${multi_value_keywords}" ${ARGN})
if(CODE_COVERAGE)
if(CMAKE_C_COMPILER_ID MATCHES "(Apple)?[Cc]lang"
OR CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?[Cc]lang")
# Merge the profile data for all of the run executables
if(WIN32)
add_custom_target(
ccov-all-processing
COMMAND
powershell -Command $$FILELIST = Get-Content
${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/profraw.list\; llvm-profdata.exe
merge -o ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata
-sparse $$FILELIST)
else()
add_custom_target(
ccov-all-processing
COMMAND
${LLVM_PROFDATA_PATH} merge -o
${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata -sparse `cat
${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/profraw.list`)
endif()
# Regex exclude only available for LLVM >= 7
if(LLVM_COV_VERSION VERSION_GREATER_EQUAL "7.0.0")
foreach(EXCLUDE_ITEM ${add_code_coverage_all_targets_EXCLUDE})
set(EXCLUDE_REGEX ${EXCLUDE_REGEX}
-ignore-filename-regex='${EXCLUDE_ITEM}')
endforeach()
endif()
# Print summary of the code coverage information to the command line
if(WIN32)
add_custom_target(
ccov-all-report
COMMAND
powershell -Command $$FILELIST = Get-Content
${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list\; llvm-cov.exe
report $$FILELIST
-instr-profile=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata
${EXCLUDE_REGEX}
DEPENDS ccov-all-processing)
else()
add_custom_target(
ccov-all-report
COMMAND
${LLVM_COV_PATH} report `cat
${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list`
-instr-profile=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata
${EXCLUDE_REGEX}
DEPENDS ccov-all-processing)
endif()
# Export coverage information so continuous integration tools (e.g.
# Jenkins) can consume it
add_custom_target(
ccov-all-export
COMMAND
${LLVM_COV_PATH} export `cat
${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list`
-instr-profile=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata
-format="text" ${EXCLUDE_REGEX} >
${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/coverage.json
DEPENDS ccov-all-processing)
# Generate HTML output of all added targets for perusal
if(WIN32)
add_custom_target(
ccov-all
COMMAND
powershell -Command $$FILELIST = Get-Content
${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list\; llvm-cov.exe show
$$FILELIST
-instr-profile=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata
-show-line-counts-or-regions
-output-dir=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged
-format="html" ${EXCLUDE_REGEX}
DEPENDS ccov-all-processing)
else()
add_custom_target(
ccov-all
COMMAND
${LLVM_COV_PATH} show `cat
${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list`
-instr-profile=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata
-show-line-counts-or-regions
-output-dir=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged
-format="html" ${EXCLUDE_REGEX}
DEPENDS ccov-all-processing)
endif()
elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES
"GNU")
set(COVERAGE_INFO "${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.info")
# Nothing required for gcov
add_custom_target(ccov-all-processing COMMAND ;)
# Exclusion regex string creation
set(EXCLUDE_REGEX)
foreach(EXCLUDE_ITEM ${add_code_coverage_all_targets_EXCLUDE})
set(EXCLUDE_REGEX ${EXCLUDE_REGEX} --remove ${COVERAGE_INFO}
'${EXCLUDE_ITEM}')
endforeach()
if(EXCLUDE_REGEX)
set(EXCLUDE_COMMAND ${LCOV_PATH} ${EXCLUDE_REGEX} --output-file
${COVERAGE_INFO})
else()
set(EXCLUDE_COMMAND ;)
endif()
# Capture coverage data
if(${CMAKE_VERSION} VERSION_LESS "3.17.0")
add_custom_target(
ccov-all-capture
COMMAND ${CMAKE_COMMAND} -E remove -f ${COVERAGE_INFO}
COMMAND ${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} --capture
--output-file ${COVERAGE_INFO}
COMMAND ${EXCLUDE_COMMAND}
DEPENDS ccov-preprocessing ccov-all-processing)
else()
add_custom_target(
ccov-all-capture
COMMAND ${CMAKE_COMMAND} -E rm -f ${COVERAGE_INFO}
COMMAND ${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} --capture
--output-file ${COVERAGE_INFO}
COMMAND ${EXCLUDE_COMMAND}
DEPENDS ccov-preprocessing ccov-all-processing)
endif()
# Generates HTML output of all targets for perusal
add_custom_target(
ccov-all
COMMAND ${GENHTML_PATH} -o ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged
${COVERAGE_INFO} -p ${CMAKE_SOURCE_DIR}
DEPENDS ccov-all-capture)
endif()
add_custom_command(
TARGET ccov-all
POST_BUILD
COMMAND ;
COMMENT
"Open ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged/index.html in your browser to view the coverage report."
)
endif()
endfunction()
qcoro-0.12.0/cmake/DetectAndroidNDKVersion.cmake 0000664 0000000 0000000 00000002413 14773571425 0021432 0 ustar 00root root 0000000 0000000 # SPDX-FileCopyrightText: 2023 Daniel Vrátil
#
# SPDX-License-Identifier: MIT
cmake_policy(SET CMP0140 NEW)
function(detectAndroidNDKVersion outVar)
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.20)
# CMAKE_ANDROID_NDK_VERSION introduced in CMake 3.20
set(${outVar} "${CMAKE_ANDROID_NDK_VERSION}")
else()
if (NOT CMAKE_ANDROID_NDK)
message(STATUS "Couldn't detect Android NDK version: CMAKE_ANDROID_NDK not set")
return()
endif()
if (NOT EXISTS "${CMAKE_ANDROID_NDK}/source.properties")
message(STATUS "Couldn't detect Android NDK version: ${CMAKE_ANDROID_NDK}/source.properties doesn't exist")
return()
endif()
file(STRINGS "${CMAKE_ANDROID_NDK}/source.properties" _sources REGEX "^Pkg\.Revision = [0-9]+\.[0-9]+\.[0-9]+$")
string(REGEX MATCH "= ([0-9]+\.[0-9]+)\." _match "${_sources}")
set(${outVar} "${CMAKE_MATCH_1}")
if (NOT ${outVar})
message(STATUS "Couldn't detect Android NDK version: ${CMAKE_ANDROID_NDK}/source.properties doesn't contain Pkg.Revision")
return()
endif()
endif()
message(STATUS "Detected Android NDK version ${${outVar}}")
return(PROPAGATE ${outVar})
endfunction()
qcoro-0.12.0/cmake/ECMGeneratePriFile.cmake 0000664 0000000 0000000 00000025453 14773571425 0020361 0 ustar 00root root 0000000 0000000 # SPDX-FileCopyrightText: 2014 David Faure
#
# SPDX-License-Identifier: BSD-3-Clause
#[=======================================================================[.rst:
ECMGeneratePriFile
------------------
Generate a ``.pri`` file for the benefit of qmake-based projects.
As well as the function below, this module creates the cache variable
``ECM_MKSPECS_INSTALL_DIR`` and sets the default value to ``mkspecs/modules``.
This assumes Qt and the current project are both installed to the same
non-system prefix. Packagers who use ``-DCMAKE_INSTALL_PREFIX=/usr`` will
certainly want to set ``ECM_MKSPECS_INSTALL_DIR`` to something like
``share/qt5/mkspecs/modules``.
The main thing is that this should be the ``modules`` subdirectory of either
the default qmake ``mkspecs`` directory or of a directory that will be in the
``$QMAKEPATH`` environment variable when qmake is run.
::
ecm_generate_pri_file(BASE_NAME
LIB_NAME
[VERSION ] # since 5.83
[DEPS " [ [...]]"]
[FILENAME_VAR ]
[INCLUDE_INSTALL_DIRS [ [...]]] # since 5.92
[INCLUDE_INSTALL_DIR ] # deprecated since 5.92
[LIB_INSTALL_DIR ])
If your CMake project produces a Qt-based library, you may expect there to be
applications that wish to use it that use a qmake-based build system, rather
than a CMake-based one. Creating a ``.pri`` file will make use of your
library convenient for them, in much the same way that CMake config files make
things convenient for CMake-based applications. ``ecm_generate_pri_file()``
generates just such a file.
VERSION specifies the version of the library the ``.pri`` file describes. If
not set, the value is taken from the context variable ``PROJECT_VERSION``.
This variable is usually set by the ``project(... VERSION ...)`` command or,
if CMake policy CMP0048 is not NEW, by :module:`ECMSetupVersion`.
For backward-compatibility with older ECM versions the
``PROJECT_VERSION_STRING`` variable as set by :module:`ECMSetupVersion`
will be preferred over ``PROJECT_VERSION`` if set, unless the minimum
required version of ECM is 5.83 and newer. Since 5.83.
BASE_NAME specifies the name qmake project (.pro) files should use to refer to
the library (eg: KArchive). LIB_NAME is the name of the actual library to
link to (ie: the first argument to add_library()). DEPS is a space-separated
list of the base names of other libraries (for Qt libraries, use the same
names you use with the ``QT`` variable in a qmake project file, such as "core"
for QtCore). FILENAME_VAR specifies the name of a variable to store the path
to the generated file in.
INCLUDE_INSTALL_DIRS are the paths (relative to ``CMAKE_INSTALL_PREFIX``) that
include files will be installed to. It defaults to
``${INCLUDE_INSTALL_DIR}/`` if the ``INCLUDE_INSTALL_DIR`` variable
is set. If that variable is not set, the ``CMAKE_INSTALL_INCLUDEDIR`` variable
is used instead, and if neither are set ``include`` is used. LIB_INSTALL_DIR
operates similarly for the installation location for libraries; it defaults to
``${LIB_INSTALL_DIR}``, ``${CMAKE_INSTALL_LIBDIR}`` or ``lib``, in that order.
INCLUDE_INSTALL_DIR is the old variant of INCLUDE_INSTALL_DIRS, taking only one
directory.
Example usage:
.. code-block:: cmake
ecm_generate_pri_file(
BASE_NAME KArchive
LIB_NAME KF5KArchive
DEPS "core"
FILENAME_VAR pri_filename
VERSION 4.2.0
)
install(FILES ${pri_filename} DESTINATION ${ECM_MKSPECS_INSTALL_DIR})
A qmake-based project that wished to use this would then do::
QT += KArchive
in their ``.pro`` file.
Since pre-1.0.0.
#]=======================================================================]
# Replicate the logic from KDEInstallDirs.cmake as we can't depend on it
# Ask qmake if we're using the same prefix as Qt
set(_should_query_qt OFF)
if(NOT DEFINED KDE_INSTALL_USE_QT_SYS_PATHS)
include(ECMQueryQt)
ecm_query_qt(qt_install_prefix_dir QT_INSTALL_PREFIX TRY)
if(qt_install_prefix_dir STREQUAL "${CMAKE_INSTALL_PREFIX}")
set(_should_query_qt ON)
endif()
endif()
if(KDE_INSTALL_USE_QT_SYS_PATHS OR _should_query_qt)
include(ECMQueryQt)
ecm_query_qt(qt_install_prefix_dir QT_INSTALL_PREFIX)
ecm_query_qt(qt_host_data_dir QT_HOST_DATA)
if(qt_install_prefix_dir STREQUAL "${CMAKE_INSTALL_PREFIX}")
file(RELATIVE_PATH qt_host_data_dir ${qt_install_prefix_dir} ${qt_host_data_dir})
endif()
if(qt_host_data_dir STREQUAL "")
set(mkspecs_install_dir mkspecs/modules)
else()
set(mkspecs_install_dir ${qt_host_data_dir}/mkspecs/modules)
endif()
set(ECM_MKSPECS_INSTALL_DIR ${mkspecs_install_dir} CACHE PATH "The directory where mkspecs will be installed to.")
else()
set(ECM_MKSPECS_INSTALL_DIR mkspecs/modules CACHE PATH "The directory where mkspecs will be installed to.")
endif()
function(ECM_GENERATE_PRI_FILE)
set(options INTERFACE)
set(oneValueArgs BASE_NAME LIB_NAME DEPS FILENAME_VAR INCLUDE_INSTALL_DIR LIB_INSTALL_DIR VERSION)
set(multiValueArgs INCLUDE_INSTALL_DIRS)
cmake_parse_arguments(EGPF "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(EGPF_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "Unknown keywords given to ECM_GENERATE_PRI_FILE(): \"${EGPF_UNPARSED_ARGUMENTS}\"")
endif()
if(ECM_GLOBAL_FIND_VERSION VERSION_LESS 5.83.0)
set(_support_backward_compat_version_string_var TRUE)
else()
set(_support_backward_compat_version_string_var FALSE)
endif()
if(NOT EGPF_BASE_NAME)
message(FATAL_ERROR "Required argument BASE_NAME missing in ECM_GENERATE_PRI_FILE() call")
endif()
if(NOT EGPF_LIB_NAME)
message(FATAL_ERROR "Required argument LIB_NAME missing in ECM_GENERATE_PRI_FILE() call")
endif()
if(NOT EGPF_VERSION)
if(_support_backward_compat_version_string_var)
if(NOT PROJECT_VERSION_STRING AND NOT PROJECT_VERSION)
message(FATAL_ERROR "Required variable PROJECT_VERSION_STRING or PROJECT_VERSION not set before ECM_GENERATE_PRI_FILE() call. Missing call of ecm_setup_version() or project(VERSION)?")
endif()
else()
if(NOT PROJECT_VERSION)
message(FATAL_ERROR "Required variable PROJECT_VERSION not set before ECM_GENERATE_PRI_FILE() call. Missing call of ecm_setup_version() or project(VERSION)?")
endif()
endif()
endif()
if(EGPF_INCLUDE_INSTALL_DIR)
if(EGPF_INCLUDE_INSTALL_DIRS)
message(FATAL_ERROR "Only one argument of INCLUDE_INSTALL_DIR & INCLUDE_INSTALL_DIRS can be used in ECM_GENERATE_PRI_FILE() call")
endif()
set(EGPF_INCLUDE_INSTALL_DIRS ${EGPF_INCLUDE_INSTALL_DIR})
endif()
if(NOT EGPF_INCLUDE_INSTALL_DIRS)
if(INCLUDE_INSTALL_DIR)
set(EGPF_INCLUDE_INSTALL_DIRS "${INCLUDE_INSTALL_DIR}/${EGPF_BASE_NAME}")
elseif(CMAKE_INSTALL_INCLUDEDIR)
set(EGPF_INCLUDE_INSTALL_DIRS "${CMAKE_INSTALL_INCLUDEDIR}/${EGPF_BASE_NAME}")
else()
set(EGPF_INCLUDE_INSTALL_DIRS "include/${EGPF_BASE_NAME}")
endif()
endif()
if(NOT EGPF_LIB_INSTALL_DIR)
if(LIB_INSTALL_DIR)
set(EGPF_LIB_INSTALL_DIR "${LIB_INSTALL_DIR}")
elseif(CMAKE_INSTALL_LIBDIR)
set(EGPF_LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}")
else()
set(EGPF_LIB_INSTALL_DIR "lib")
endif()
endif()
if(EGPF_VERSION)
set(PRI_VERSION "${EGPF_VERSION}")
else()
if(_support_backward_compat_version_string_var AND PROJECT_VERSION_STRING)
set(PRI_VERSION "${PROJECT_VERSION_STRING}")
if(NOT PROJECT_VERSION_STRING STREQUAL PROJECT_VERSION)
message(DEPRECATION "ECM_GENERATE_PRI_FILE() will no longer support PROJECT_VERSION_STRING when the required minimum version of ECM is 5.83 or newer. Set VERSION parameter or use PROJECT_VERSION instead.")
endif()
else()
set(PRI_VERSION "${PROJECT_VERSION}")
endif()
endif()
string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" PRI_VERSION_MAJOR "${PRI_VERSION}")
string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" PRI_VERSION_MINOR "${PRI_VERSION}")
string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" PRI_VERSION_PATCH "${PRI_VERSION}")
# Prepare the right number of "../.." to go from ECM_MKSPECS_INSTALL_DIR to the install prefix
# This allows to make the generated pri files relocatable (no absolute paths)
if (IS_ABSOLUTE ${ECM_MKSPECS_INSTALL_DIR})
set(BASEPATH ${CMAKE_INSTALL_PREFIX})
else()
string(REGEX REPLACE "[^/]+" ".." PRI_ROOT_RELATIVE_TO_MKSPECS ${ECM_MKSPECS_INSTALL_DIR})
set(BASEPATH "$$PWD/${PRI_ROOT_RELATIVE_TO_MKSPECS}")
endif()
set(PRI_TARGET_BASENAME ${EGPF_BASE_NAME})
set(PRI_TARGET_LIBNAME ${EGPF_LIB_NAME})
set(PRI_TARGET_QTDEPS ${EGPF_DEPS})
set(PRI_TARGET_INCLUDES)
foreach(_dir ${EGPF_INCLUDE_INSTALL_DIRS})
# separate list entries with space
if(IS_ABSOLUTE "${_dir}")
string(APPEND PRI_TARGET_INCLUDES " ${_dir}")
else()
string(APPEND PRI_TARGET_INCLUDES " ${BASEPATH}/${_dir}")
endif()
endforeach()
if(IS_ABSOLUTE "${EGPF_LIB_INSTALL_DIR}")
set(PRI_TARGET_LIBS "${EGPF_LIB_INSTALL_DIR}")
else()
set(PRI_TARGET_LIBS "${BASEPATH}/${EGPF_LIB_INSTALL_DIR}")
endif()
set(PRI_TARGET_DEFINES "")
set(PRI_FILENAME ${CMAKE_CURRENT_BINARY_DIR}/qt_${PRI_TARGET_BASENAME}.pri)
if (EGPF_FILENAME_VAR)
set(${EGPF_FILENAME_VAR} ${PRI_FILENAME} PARENT_SCOPE)
endif()
set(PRI_TARGET_MODULE_CONFIG "")
# backward compat: it was not obvious LIB_NAME needs to be a target name,
# and some projects where the target name was not the actual library output name
# passed the output name for LIB_NAME, so .name & .module prperties are correctly set.
# TODO: improve API dox, allow control over module name if target name != output name
if(TARGET ${EGPF_LIB_NAME})
get_target_property(target_type ${EGPF_LIB_NAME} TYPE)
if (target_type STREQUAL "STATIC_LIBRARY")
set(PRI_TARGET_MODULE_CONFIG "staticlib")
endif()
endif()
if (EGPF_INTERFACE)
set(PRI_TARGET_MODULE "")
else()
set(PRI_TARGET_MODULE "${PRI_TARGET_LIBNAME}")
endif()
file(GENERATE
OUTPUT ${PRI_FILENAME}
CONTENT
"QT.${PRI_TARGET_BASENAME}.VERSION = ${PRI_VERSION}
QT.${PRI_TARGET_BASENAME}.MAJOR_VERSION = ${PRI_VERSION_MAJOR}
QT.${PRI_TARGET_BASENAME}.MINOR_VERSION = ${PRI_VERSION_MINOR}
QT.${PRI_TARGET_BASENAME}.PATCH_VERSION = ${PRI_VERSION_PATCH}
QT.${PRI_TARGET_BASENAME}.name = ${PRI_TARGET_LIBNAME}
QT.${PRI_TARGET_BASENAME}.module = ${PRI_TARGET_MODULE}
QT.${PRI_TARGET_BASENAME}.defines = ${PRI_TARGET_DEFINES}
QT.${PRI_TARGET_BASENAME}.includes = ${PRI_TARGET_INCLUDES}
QT.${PRI_TARGET_BASENAME}.private_includes =
QT.${PRI_TARGET_BASENAME}.libs = ${PRI_TARGET_LIBS}
QT.${PRI_TARGET_BASENAME}.depends = ${PRI_TARGET_QTDEPS}
QT.${PRI_TARGET_BASENAME}.module_config = ${PRI_TARGET_MODULE_CONFIG}
"
)
endfunction()
qcoro-0.12.0/cmake/ECMQueryQt.cmake 0000664 0000000 0000000 00000006076 14773571425 0016766 0 ustar 00root root 0000000 0000000 # SPDX-FileCopyrightText: 2014 Rohan Garg
# SPDX-FileCopyrightText: 2014 Alex Merry
# SPDX-FileCopyrightText: 2014-2016 Aleix Pol
# SPDX-FileCopyrightText: 2017 Friedrich W. H. Kossebau
# SPDX-FileCopyrightText: 2022 Ahmad Samir
#
# SPDX-License-Identifier: BSD-3-Clause
#[=======================================================================[.rst:
ECMQueryQt
---------------
This module can be used to query the installation paths used by Qt.
For Qt5 this uses ``qmake``, and for Qt6 this used ``qtpaths`` (the latter has built-in
support to query the paths of a target platform when cross-compiling).
This module defines the following function:
::
ecm_query_qt( [TRY])
Passing ``TRY`` will result in the method not making the build fail if the executable
used for querying has not been found, but instead simply print a warning message and
return an empty string.
Example usage:
.. code-block:: cmake
include(ECMQueryQt)
ecm_query_qt(bin_dir QT_INSTALL_BINS)
If the call succeeds ``${bin_dir}`` will be set to ``/path/to/bin/dir`` (e.g.
``/usr/lib64/qt/bin/``).
Since: 5.93
#]=======================================================================]
if (QT_VERSION_MAJOR STREQUAL "5")
find_package(Qt${QT_VERSION_MAJOR}Core QUIET)
get_target_property(_qmake_executable_default Qt5::qmake LOCATION)
set(QUERY_EXECUTABLE ${_qmake_executable_default}
CACHE FILEPATH "Location of the Qt5 qmake executable")
set(_exec_name_text "Qt5 qmake")
set(_cli_option "-query")
elseif(QT_VERSION_MAJOR STREQUAL "6")
find_package(Qt6 COMPONENTS CoreTools REQUIRED CONFIG)
get_target_property(_qtpaths_executable Qt6::qtpaths LOCATION)
set(QUERY_EXECUTABLE ${_qtpaths_executable}
CACHE FILEPATH "Location of the Qt6 qtpaths executable")
set(_exec_name_text "Qt6 qtpaths")
set(_cli_option "--query")
endif()
function(ecm_query_qt result_variable qt_variable)
set(options TRY)
set(oneValueArgs)
set(multiValueArgs)
cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(NOT QUERY_EXECUTABLE)
if(ARGS_TRY)
set(${result_variable} "" PARENT_SCOPE)
message(STATUS "No ${_exec_name_text} executable found. Can't check ${qt_variable}")
return()
else()
message(FATAL_ERROR "No ${_exec_name_text} executable found. Can't check ${qt_variable} as required")
endif()
endif()
execute_process(
COMMAND ${QUERY_EXECUTABLE} ${_cli_option} "${qt_variable}"
RESULT_VARIABLE return_code
OUTPUT_VARIABLE output
)
if(return_code EQUAL 0)
string(STRIP "${output}" output)
file(TO_CMAKE_PATH "${output}" output_path)
set(${result_variable} "${output_path}" PARENT_SCOPE)
else()
message(WARNING "Failed call: ${_command} \"${qt_variable}\"")
message(FATAL_ERROR "${_exec_name_text} call failed: ${return_code}")
endif()
endfunction()
qcoro-0.12.0/cmake/GenerateHeaders.cmake 0000664 0000000 0000000 00000002264 14773571425 0020050 0 ustar 00root root 0000000 0000000 function(generate_headers output_var)
set(options)
set(oneValueArgs OUTPUT_DIR ORIGINAL_PREFIX ORIGINAL_HEADERS_VAR)
set(multiValueArgs HEADER_NAMES)
cmake_parse_arguments(GH "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if (GH_OUTPUT_DIR)
set(GH_OUTPUT_DIR "${GH_OUTPUT_DIR}/")
endif()
foreach(_headername ${GH_HEADER_NAMES})
string(TOLOWER "${_headername}" originalbase)
set(CC_ORIGINAL_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${GH_ORIGINAL_PREFIX}/${originalbase}.h")
if (NOT EXISTS ${CC_ORIGINAL_FILE})
message(FATAL_ERROR "Could not find header \"${CC_ORIGINAL_FILE}\"")
endif()
set(CC_HEADER_FILE "${CMAKE_CURRENT_BINARY_DIR}/${GH_OUTPUT_DIR}/${_headername}")
if (NOT EXISTS ${CC_HEADER_FILE})
file(WRITE ${CC_HEADER_FILE} "#include \"${GH_ORIGINAL_PREFIX}${originalbase}.h\"")
endif()
list(APPEND ${output_var} ${CC_HEADER_FILE})
list(APPEND ${GH_ORIGINAL_HEADERS_VAR} ${CC_ORIGINAL_FILE})
endforeach()
set(${output_var} ${${output_var}} PARENT_SCOPE)
set(${GH_ORIGINAL_HEADERS_VAR} ${${GH_ORIGINAL_HEADERS_VAR}} PARENT_SCOPE)
endfunction()
qcoro-0.12.0/cmake/GenerateModuleConfigFile.cmake 0000664 0000000 0000000 00000003541 14773571425 0021647 0 ustar 00root root 0000000 0000000 include(CMakePackageConfigHelpers)
function(generate_cmake_module_config_file)
function(process_dependencies)
set(oneValueArgs PREFIX OUTPUT)
set(multiValueArgs LIBRARIES)
cmake_parse_arguments(deps "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(_deps)
set(_deps_private FALSE)
foreach(dep ${deps_LIBRARIES})
if ("${dep}" MATCHES "PUBLIC|INTERFACE")
set(_deps_private FALSE)
continue()
elseif ("${dep}" STREQUAL "PRIVATE")
set(_deps_private TRUE)
continue()
endif()
if (NOT _deps_private)
set(_deps "${_deps}find_dependency(${deps_PREFIX}${dep})\n")
endif()
endforeach()
set(${deps_OUTPUT} ${_deps} PARENT_SCOPE)
endfunction()
set(options)
set(oneValueArgs TARGET_NAME NAME)
set(multiValueArgs QT_DEPENDENCIES QCORO_DEPENDENCIES)
cmake_parse_arguments(cmc "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
process_dependencies(
PREFIX "Qt${QT_VERSION_MAJOR}"
LIBRARIES ${cmc_QT_DEPENDENCIES}
OUTPUT QT_DEPENDENCIES
)
process_dependencies(
PREFIX "QCoro${QT_VERSION_MAJOR}"
LIBRARIES ${cmc_QCORO_DEPENDENCIES}
OUTPUT QCORO_DEPENDENCIES
)
set(MODULE_NAME "${cmc_NAME}")
configure_package_config_file(
"${qcoro_SOURCE_DIR}/cmake/QCoroModuleConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/${cmc_TARGET_NAME}Config.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${cmc_TARGET_NAME}
PATH_VARS CMAKE_INSTALL_INCLUDEDIR
)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/${cmc_TARGET_NAME}ConfigVersion.cmake"
VERSION ${qcoro_VERSION}
COMPATIBILITY SameMajorVersion
)
endfunction()
qcoro-0.12.0/cmake/QCoroFindQt.cmake 0000664 0000000 0000000 00000002352 14773571425 0017151 0 ustar 00root root 0000000 0000000 macro(qcoro_find_qt)
set(options)
set(oneValueArgs QT_VERSION FOUND_VER_VAR)
set(multiValueArgs COMPONENTS QT5_COMPONENTS QT6_COMPONENTS)
cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if (NOT ARGS_QT_VERSION)
find_package(Qt6Core QUIET)
if (Qt6Core_FOUND)
set(ARGS_QT_VERSION 6)
else()
set(ARGS_QT_VERSION 5)
endif()
endif()
list(APPEND REQUIRED_QT_COMPONENTS "${ARGS_QT${ARGS_QT_VERSION}_COMPONENTS}")
list(FILTER REQUIRED_QT_COMPONENTS EXCLUDE REGEX "Private$$")
find_package(Qt${ARGS_QT_VERSION} REQUIRED COMPONENTS ${REQUIRED_QT_COMPONENTS})
if ("${ARGS_QT_VERSION}" STREQUAL "6" AND Qt6_VERSION VERSION_GREATER_EQUAL "6.10.0")
list(APPEND REQUIRED_PRIVATE_QT_COMPONENTS "${ARGS_COMPONENTS}")
list(APPEND REQUIRED_PRIVATE_QT_COMPONENTS "${ARGS_QT${ARGS_QT_VERSION}_COMPONENTS}")
list(FILTER REQUIRED_PRIVATE_QT_COMPONENTS INCLUDE REGEX "Private$$")
if (REQUIRED_PRIVATE_QT_COMPONENTS)
find_package(Qt${ARGS_QT_VERSION} REQUIRED COMPONENTS ${REQUIRED_PRIVATE_QT_COMPONENTS})
endif()
endif()
set(${ARGS_FOUND_VER_VAR} ${ARGS_QT_VERSION})
endmacro()
qcoro-0.12.0/cmake/QCoroModuleConfig.cmake.in 0000664 0000000 0000000 00000001004 14773571425 0020735 0 ustar 00root root 0000000 0000000 @PACKAGE_INIT@
include(CMakeFindDependencyMacro)
@QT_DEPENDENCIES@
@QCORO_DEPENDENCIES@
include("${CMAKE_CURRENT_LIST_DIR}/QCoro@QT_VERSION_MAJOR@@MODULE_NAME@Targets.cmake")
# Versionless target, for compatiblity with Qt6
if (TARGET QCoro@QT_VERSION_MAJOR@::@MODULE_NAME@ AND NOT TARGET QCoro::@MODULE_NAME@)
add_library(QCoro::@MODULE_NAME@ INTERFACE IMPORTED)
set_target_properties(QCoro::@MODULE_NAME@ PROPERTIES
INTERFACE_LINK_LIBRARIES "QCoro@QT_VERSION_MAJOR@::@MODULE_NAME@"
)
endif()
qcoro-0.12.0/config.cmake.in 0000664 0000000 0000000 00000000045 14773571425 0015607 0 ustar 00root root 0000000 0000000 #cmakedefine QCORO_QT_HAS_COMPAT_ABI
qcoro-0.12.0/docker/ 0000775 0000000 0000000 00000000000 14773571425 0014203 5 ustar 00root root 0000000 0000000 qcoro-0.12.0/docker/Dockerfile.clang 0000664 0000000 0000000 00000005443 14773571425 0017266 0 ustar 00root root 0000000 0000000 # SPDX-FileCopyrightText: 2022 Daniel Vrátil
# SPDX-License-Identifier: MIT
#
# Docker image for specific versions of clang and specific version of Qt.
FROM debian:bullseye
ARG compiler_version
ARG qt_version
ARG qt_modules
ARG qt_archives
SHELL ["/bin/bash", "-c"]
# Install build & runtime dependencies
RUN apt-get update \
&& apt-get upgrade --yes \
&& apt-get install --yes --no-install-recommends \
cmake=3.18.4\* cmake-data=3.18.4\* \
make \
python3-pip python3-setuptools python3-wheel python3-dev \
dbus dbus-x11 \
libglib2.0-dev libxkbcommon-dev libfreetype6-dev libfontconfig1-dev \
libssl-dev \
libegl-dev libgl-dev libegl1=1.3.2\* libgl1=1.3.2\* libglx0=1.3.2\* libglvnd0=1.3.2\* \
libvulkan-dev
# Install and set up clang
RUN \
# Set up env \
if [ "${compiler_version}" == "dev" ]; then \
export CLANG_VERSION_SUFFIX=""; \
else \
export CLANG_VERSION_SUFFIX="-${compiler_version}"; \
fi && \
echo "export CC=\"/usr/bin/clang${CLANG_VERSION_SUFFIX}\"" >> /etc/profile.d/clang.sh && \
echo "export CXX=\"/usr/bin/clang++${CLANG_VERSION_SUFFIX}\"" >> /etc/profile.d/clang.sh && \
# Install tools needed to add the clang repository \
apt-get install --yes --no-install-recommends ca-certificates wget gnupg && \
# Add clang repository \
echo "deb http://apt.llvm.org/bullseye/ llvm-toolchain-bullseye${CLANG_VERSION_SUFFIX} main" > /etc/apt/sources.list.d/llvm.list && \
echo "deb-src http://apt.llvm.org/bullseye/ llvm-toolchain-bullseye${CLANG_VERSION_SUFFIX} main" >> /etc/apt/sources.list.d/llvm.list && \
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \
# Install clang \
apt-get update && \
apt-get install --yes --install-recommends clang${CLANG_VERSION_SUFFIX} && \
clang_major_version=$(clang${CLANG_VERSION_SUFFIX} --version | grep -Eo "[0-9]+.[0-9]+.[0-9]+" | cut -d'.' -f1) && \
if [ ${clang_major_version} -gt 11 ]; then \
apt-get install --yes --no-install-recommends libclang-rt-${clang_major_version}-dev; \
fi
# Workaround a bug in CMake (?) which tries to look for OpenGL-related libraries
# in /usr/lib/x86_64-unknown-linux-gnu instead of /usr/lib/x86_64-linux-gnu
RUN ln -s x86_64-linux-gnu /usr/lib/x86_64-unknown-linux-gnu
# Install Qt
WORKDIR /root
RUN pip3 install 'aqtinstall==3.2.0'
COPY install-qt.sh ./install-qt.sh
RUN ./install-qt.sh "${qt_version}" "${qt_modules}" "${qt_archives}"
# Set Qt up environment
ENV QT_BASE_DIR "/opt/qt/${qt_version}/gcc_64"
ENV PATH "${QT_BASE_DIR}/bin:${PATH}"
ENV CMAKE_PREFIX_PATH "${QT_BASE_DIR}/lib/cmake"
ENV LD_LIBRARY_PATH "${QT_BASE_DIR}/lib:${LD_LIBRARY_PATH}"
ENV XDG_DATA_DIRS "${QT_BASE_DIR}/share:${XDG_DATA_DIRS}"
ENTRYPOINT [ "/bin/bash", "-l" ]
qcoro-0.12.0/docker/Dockerfile.gcc 0000664 0000000 0000000 00000003550 14773571425 0016733 0 ustar 00root root 0000000 0000000 # SPDX-FileCopyrightText: 2022 Daniel Vrátil
# SPDX-License-Identifier: MIT
#
# Docker image for specific versions of gcc and specific version of Qt.
ARG compiler_version
FROM gcc:${compiler_version}
ARG qt_version
ARG qt_modules
ARG qt_archives
SHELL ["/bin/bash", "-c"]
# Enable backports in older GCC images to get access to newer cmake
RUN source /etc/os-release && \
if [[ "${VERSION_ID}" == "10" ]]; then \
echo "deb http://deb.debian.org/debian buster-backports main" > /etc/apt/sources.list.d/backports.list; \
fi
# Install build-time and runtime dependencies
RUN apt-get update \
&& apt-get upgrade --yes \
&& apt-get install --yes --no-install-recommends \
cmake cmake-data \
python3-pip python3-setuptools python3-wheel python3-dev \
dbus dbus-x11 \
libglib2.0-dev libxkbcommon-dev libfreetype6-dev libfontconfig1-dev \
libssl-dev \
libegl-dev libgl-dev libegl1 libgl1 libglx0 libglvnd0 \
libvulkan-dev \
&& apt-get clean
# Workaround a bug in CMake (?) which tries to look for OpenGL-related libraries
# in /usr/lib/x86_64-unknown-linux-gnu instead of /usr/lib/x86_64-linux-gnu
RUN ln -s x86_64-linux-gnu /usr/lib/x86_64-unknown-linux-gnu
# Install Qt
WORKDIR /root
# Necessary to allow using pip on newer images (--break-system-packages doesn't work on older images)
RUN rm -f /usr/lib/python$(python3 --version | grep -oE "3.[0-9]+")/EXTERNALLY-MANAGED \
&& pip3 install 'aqtinstall==3.2.0'
COPY install-qt.sh ./install-qt.sh
RUN ./install-qt.sh "${qt_version}" "${qt_modules}" "${qt_archives}"
# Set up environment
ENV QT_BASE_DIR "/opt/qt/${qt_version}/gcc_64"
ENV PATH "${QT_BASE_DIR}/bin:${PATH}"
ENV CMAKE_PREFIX_PATH="${QT_BASE_DIR}/lib/cmake"
ENV LD_LIBRARY_PATH "${QT_BASE_DIR}/lib:${LD_LIBRARY_PATH}"
ENV XDG_DATA_DIRS "${QT_BASE_DIR}/share:${XDG_DATA_DIRS}"
qcoro-0.12.0/docker/install-qt.sh 0000775 0000000 0000000 00000000666 14773571425 0016642 0 ustar 00root root 0000000 0000000 #!/bin/bash
set -e
qt_version="$1"
qt_modules="$2"
qt_archives="$3"
if [[ -n "${qt_archives}" ]]; then
opt_archives="--archives ${qt_archives}"
fi
if [[ -n "${qt_modules}" ]]; then
opt_modules="--modules ${qt_modules}"
fi
echo "Installing Qt ${qt_version}"
echo "Modules: ${qt_modules}"
echo "Archives: ${qt_archives}"
aqt install-qt -O /opt/qt linux desktop "${qt_version}" gcc_64 ${opt_archives} ${opt_modules}
echo "Done."
qcoro-0.12.0/docs/ 0000775 0000000 0000000 00000000000 14773571425 0013664 5 ustar 00root root 0000000 0000000 qcoro-0.12.0/docs/about/ 0000775 0000000 0000000 00000000000 14773571425 0014776 5 ustar 00root root 0000000 0000000 qcoro-0.12.0/docs/about/license.md 0000664 0000000 0000000 00000002362 14773571425 0016745 0 ustar 00root root 0000000 0000000
# License
---
QCoro is published under the MIT License
## MIT License
Copyright (c) 2021 Daniel Vrátil
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
qcoro-0.12.0/docs/assets/ 0000775 0000000 0000000 00000000000 14773571425 0015166 5 ustar 00root root 0000000 0000000 qcoro-0.12.0/docs/assets/qcoro.svg 0000664 0000000 0000000 00000022611 14773571425 0017034 0 ustar 00root root 0000000 0000000