Skip to content

Commit 2caefcf

Browse files
docs: add doxygen docs (#21)
1 parent 9c4801d commit 2caefcf

17 files changed

+347
-82
lines changed

.codeql-prebuild-cpp-Linux.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,12 @@ sudo rm -rf /var/lib/apt/lists/*
2020

2121
# build
2222
mkdir -p build
23-
cd build || exit 1
24-
cmake -G Ninja ..
25-
ninja
23+
cmake \
24+
-DBUILD_DOCS=OFF \
25+
-B build \
26+
-G Ninja \
27+
-S .
28+
ninja -C build
2629

2730
# skip autobuild
2831
echo "skip_autobuild=true" >> "$GITHUB_OUTPUT"

.codeql-prebuild-cpp-Windows.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@ pacman --noconfirm -S \
1313

1414
# build
1515
mkdir -p build
16-
cd build || exit 1
17-
cmake -G Ninja ..
18-
ninja
16+
cmake \
17+
-DBUILD_DOCS=OFF \
18+
-B build \
19+
-G Ninja \
20+
-S .
21+
ninja -C build
1922

2023
# skip autobuild
2124
echo "skip_autobuild=true" >> "$GITHUB_OUTPUT"

.codeql-prebuild-cpp-macOS.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ brew install \
88

99
# build
1010
mkdir -p build
11-
cd build || exit 1
12-
cmake -G Ninja ..
13-
ninja
11+
cmake \
12+
-DBUILD_DOCS=OFF \
13+
-B build \
14+
-G Ninja \
15+
-S .
16+
ninja -C build
1417

1518
# skip autobuild
1619
echo "skip_autobuild=true" >> "$GITHUB_OUTPUT"

.github/workflows/ci.yml

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ jobs:
6464
run: |
6565
brew install \
6666
cmake \
67-
ninja
67+
doxygen \
68+
graphviz \
69+
ninja \
70+
node
6871
6972
- name: Setup Dependencies Windows
7073
if: runner.os == 'Windows'
@@ -73,9 +76,12 @@ jobs:
7376
msystem: ucrt64
7477
update: true
7578
install: >-
79+
doxygen
7680
mingw-w64-ucrt-x86_64-binutils
7781
mingw-w64-ucrt-x86_64-cmake
82+
mingw-w64-ucrt-x86_64-graphviz
7883
mingw-w64-ucrt-x86_64-ninja
84+
mingw-w64-ucrt-x86_64-nodejs
7985
mingw-w64-ucrt-x86_64-toolchain
8086
8187
- name: Setup python
@@ -101,20 +107,32 @@ jobs:
101107
- name: Build
102108
run: |
103109
mkdir -p build
104-
cd build
105-
cmake -DCMAKE_BUILD_TYPE:STRING=Debug -G Ninja ..
106-
ninja
110+
111+
if [ "${{ runner.os }}" = "Linux" ]; then
112+
# Doxygen from Ubuntu is too old, need Doxygen >= 1.10
113+
DOCS=OFF
114+
else
115+
DOCS=ON
116+
fi
117+
118+
cmake \
119+
-DBUILD_DOCS=${DOCS} \
120+
-DCMAKE_BUILD_TYPE:STRING=Debug \
121+
-B build \
122+
-G Ninja \
123+
-S .
124+
ninja -C build
107125
108126
- name: Run tests
109127
id: test
110-
working-directory: build
128+
working-directory: build/tests
111129
run: |
112130
if [ "${{ runner.os }}" = "Linux" ]; then
113131
export DISPLAY=:1
114132
Xvfb ${DISPLAY} -screen 0 1024x768x24 &
115133
fi
116134
117-
./tests/test_tray --gtest_color=yes
135+
./test_tray --gtest_color=yes
118136
119137
- name: Generate gcov report
120138
# any except canceled or skipped

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,6 @@
4040
# build directories
4141
build/
4242
cmake-*/
43+
44+
# doxyconfig
45+
docs/*-doxyconfig*

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
[submodule "third-party/doxyconfig"]
2+
path = third-party/doxyconfig
3+
url = https://github.com/LizardByte/doxyconfig.git
4+
branch = master
15
[submodule "third-party/googletest"]
26
path = third-party/googletest
37
url = https://github.com/google/googletest.git

.readthedocs.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
# .readthedocs.yaml
3+
# Read the Docs configuration file
4+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
5+
6+
version: 2
7+
8+
build:
9+
os: ubuntu-24.04
10+
tools:
11+
python: "miniconda-latest"
12+
commands:
13+
# because we are overriding the build commands, we need to setup the environment ourselves
14+
- cat third-party/doxyconfig/environment.yml
15+
- conda env create --quiet --name ${READTHEDOCS_VERSION} --file third-party/doxyconfig/environment.yml
16+
- npm install "@fortawesome/fontawesome-free"
17+
- mkdir -p ${READTHEDOCS_OUTPUT}html/assets/fontawesome/css
18+
- mkdir -p ${READTHEDOCS_OUTPUT}html/assets/fontawesome/js
19+
- cp node_modules/@fortawesome/fontawesome-free/css/all.min.css ${READTHEDOCS_OUTPUT}html/assets/fontawesome/css
20+
- cp node_modules/@fortawesome/fontawesome-free/js/all.min.js ${READTHEDOCS_OUTPUT}html/assets/fontawesome/js
21+
- cp -r node_modules/@fortawesome/fontawesome-free/webfonts ${READTHEDOCS_OUTPUT}html/assets/fontawesome/
22+
- |
23+
wget "https://raw.githubusercontent.com/LizardByte/.github/master/branding/logos/favicon.ico" \
24+
-O ${READTHEDOCS_OUTPUT}lizardbyte.ico
25+
- |
26+
wget "https://raw.githubusercontent.com/LizardByte/.github/master/branding/logos/logo-128x128.png" \
27+
-O ${READTHEDOCS_OUTPUT}lizardbyte.png
28+
- cp ./third-party/doxyconfig/Doxyfile ./docs/Doxyfile-doxyconfig
29+
- cp ./third-party/doxyconfig/header.html ./docs/header-doxyconfig.html
30+
- cat ./docs/Doxyfile >> ./docs/Doxyfile-doxyconfig
31+
- cd docs && doxygen Doxyfile-doxyconfig
32+
33+
# using conda, we can get newer doxygen and graphviz than ubuntu provide
34+
# https://github.com/readthedocs/readthedocs.org/issues/8151#issuecomment-890359661
35+
conda:
36+
environment: third-party/doxyconfig/environment.yml
37+
38+
submodules:
39+
include: all
40+
recursive: true

CMakeLists.txt

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
#
2+
# Project configuration
3+
#
14
cmake_minimum_required(VERSION 3.13 FATAL_ERROR) # target_link_directories
2-
3-
project(tray
4-
LANGUAGES C
5-
DESCRIPTION "A cross-platform system tray library")
5+
project(tray VERSION 0.0.0
6+
DESCRIPTION "A cross-platform system tray library"
7+
HOMEPAGE_URL "https://app.lizardbyte.dev"
8+
LANGUAGES C)
69

710
set(PROJECT_LICENSE "MIT")
811

@@ -11,11 +14,22 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
1114
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build." FORCE)
1215
endif()
1316

17+
# Add our custom CMake modules to the global path
1418
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
1519

16-
# options
20+
#
21+
# Project optional configuration
22+
#
23+
option(BUILD_DOCS "Build documentation" ON)
1724
option(BUILD_TESTS "Build tests" ON)
1825

26+
#
27+
# Documentation
28+
#
29+
if(BUILD_DOCS)
30+
add_subdirectory(third-party/doxyconfig docs)
31+
endif()
32+
1933
# Generate 'compile_commands.json' for clang_complete
2034
set(CMAKE_COLOR_MAKEFILE ON)
2135
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

README.md

Lines changed: 62 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,90 @@
1-
# Cross-platform Linux/macOS/Windows Tray
1+
# Overview
22

3-
[![codecov](https://img.shields.io/codecov/c/gh/LizardByte/tray?token=HSX66JNEOL&style=for-the-badge&logo=codecov&label=codecov)](https://codecov.io/gh/LizardByte/tray)
3+
[![GitHub Workflow Status (CI)](https://img.shields.io/github/actions/workflow/status/lizardbyte/tray/ci.yml.svg?branch=master&label=CI%20build&logo=github&style=for-the-badge)](https://github.com/LizardByte/tray/actions/workflows/ci.yml?query=branch%3Amaster)
4+
[![Codecov](https://img.shields.io/codecov/c/gh/LizardByte/tray?token=HSX66JNEOL&style=for-the-badge&logo=codecov&label=codecov)](https://codecov.io/gh/LizardByte/tray)
5+
[![GitHub stars](https://img.shields.io/github/stars/lizardbyte/tray.svg?logo=github&style=for-the-badge)](https://github.com/LizardByte/tray)
46

5-
<img src="docs/images/screenshot_macosx.png">
7+
## About
68

7-
<img src="docs/images/screenshot_windows.png">
9+
Cross-platform, super tiny C99 implementation of a system tray icon with a popup menu and notifications.
810

9-
<img src="docs/images/screenshot_linux.png">
11+
The code is C++ friendly and will compile fine in C++98 and up. This is a fork of
12+
[dmikushin/tray](https://github.com/dmikushin/tray) and is intended to add additional features required for our own
13+
[Sunshine](https://github.com/LizardByte/Sunshine) project.
1014

11-
Cross-platform, super tiny C99 implementation of a system tray icon with a popup menu.
15+
This fork adds the following features:
1216

13-
Works well on:
17+
- system tray notifications
18+
- support for both linux appindicator versions
19+
- unit tests
20+
- code coverage
21+
- refactored code, e.g. moved source code into the `src` directory
22+
- doxygen documentation, and readthedocs configuration
23+
24+
## Screenshots
25+
26+
<div class="tabbed">
27+
28+
- <b class="tab-title">Linux</b>![linux](docs/images/screenshot_linux.png)
29+
- <b class="tab-title">macOS</b>![macOS](docs/images/screenshot_macos.png)
30+
- <b class="tab-title">Windows</b>![windows](docs/images/screenshot_windows.png)
31+
32+
</div>
33+
34+
## Supported platforms
1435

1536
* Linux/Gtk (libayatana-appindicator3 or libappindicator3)
1637
* Windows XP or newer (shellapi.h)
1738
* MacOS (Cocoa/AppKit)
1839

19-
The code is C++ friendly and will compile fine in C++98 and up.
40+
## Prerequisites
2041

21-
This fork is intended to bring together the [original work of Serge Zaitsev](https://github.com/zserge/tray) and the most interesting forks and PRs of respectable contributors:
42+
* CMake
43+
* [Ninja](https://ninja-build.org/), in order to have the same build commands on all platforms
2244

23-
* [Only process messages coming from the tray window on Windows](https://github.com/zserge/tray/pull/18)
24-
* [Become C++-friendly](https://github.com/zserge/tray/pull/16)
25-
* [Fix all menu items have a check box](https://github.com/zserge/tray/pull/11)
26-
* [Add support for tooltip](https://github.com/zserge/tray/pull/11)
27-
* Darwin implementation translated from C to Objective C adapted from [@trevex fork](https://github.com/trevex/tray)
45+
### Linux Dependencies
2846

29-
## Prerequisites
47+
<div class="tabbed">
3048

31-
* CMake
32-
* [Ninja](https://ninja-build.org/), in order to have the same build commands on all platforms
33-
* AppIndicator on Linux:
49+
- <b class="tab-title">Arch</b>
50+
```bash
51+
sudo pacman -S libayatana-appindicator
52+
```
3453

35-
```
36-
sudo apt install libappindicator3-dev
37-
```
54+
- <b class="tab-title">Debian/Ubuntu</b>
55+
```bash
56+
sudo apt install libappindicator3-dev
57+
```
58+
59+
- <b class="tab-title">Fedora</b>
60+
```bash
61+
sudo dnf install libappindicator-gtk3-devel
62+
```
63+
64+
</div>
3865

3966
## Building
4067

41-
```
42-
mkdir build
43-
cd build
44-
cmake -G Ninja ..
45-
ninja
68+
```bash
69+
mkdir -p build
70+
cmake -G Ninja -B build -S .
71+
ninja -C build
4672
```
4773

4874
## Demo
4975

5076
Execute the `tray_example` application:
5177

78+
```bash
79+
./build/tray_example
5280
```
53-
./tray_example
81+
82+
## Tests
83+
84+
Execute the `tests` application:
85+
86+
```bash
87+
./build/tests/test_tray
5488
```
5589

5690
## API
@@ -91,4 +125,4 @@ array must have text field set to NULL.
91125
## License
92126
93127
This software is distributed under [MIT license](http://www.opensource.org/licenses/mit-license.php),
94-
so feel free to integrate it in your commercial products.
128+
so feel free to integrate it in your commercial products.

docs/Doxyfile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# This file describes the settings to be used by the documentation system
2+
# doxygen (www.doxygen.org) for a project.
3+
#
4+
# All text after a double hash (##) is considered a comment and is placed in
5+
# front of the TAG it is preceding.
6+
#
7+
# All text after a single hash (#) is considered a comment and will be ignored.
8+
# The format is:
9+
# TAG = value [value, ...]
10+
# For lists, items can also be appended using:
11+
# TAG += value [value, ...]
12+
# Values that contain spaces should be placed between quotes (\" \").
13+
#
14+
# Note:
15+
#
16+
# Use doxygen to compare the used configuration file with the template
17+
# configuration file:
18+
# doxygen -x [configFile]
19+
# Use doxygen to compare the used configuration file with the template
20+
# configuration file without replacing the environment variables or CMake type
21+
# replacement variables:
22+
# doxygen -x_noenv [configFile]
23+
24+
# project metadata
25+
DOCSET_BUNDLE_ID = dev.lizardbyte.tray
26+
DOCSET_PUBLISHER_ID = dev.lizardbyte.tray.documentation
27+
PROJECT_BRIEF = "Cross-platform, super tiny C99 implementation of a system tray icon with a popup menu and notifications."
28+
PROJECT_NAME = tray
29+
30+
# project specific settings
31+
DOT_GRAPH_MAX_NODES = 50
32+
IMAGE_PATH = ../docs/images
33+
INCLUDE_PATH =
34+
35+
# files and directories to process
36+
USE_MDFILE_AS_MAINPAGE = ../README.md
37+
INPUT = ../README.md \
38+
../third-party/doxyconfig/docs/source_code.md \
39+
../src
File renamed without changes.

0 commit comments

Comments
 (0)