Skip to content

Commit 0103979

Browse files
authoredOct 28, 2024
Merge pull request #21 from HeatXD/docs
Docs
2 parents a986d7a + 487fed4 commit 0103979

File tree

2 files changed

+93
-8
lines changed

2 files changed

+93
-8
lines changed
 

‎.github/workflows/deploy.yml

+39-4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ permissions:
66
contents: write
77
packages: write
88
deployments: write
9+
pages: write
910
jobs:
1011
build:
1112
strategy:
@@ -59,7 +60,6 @@ jobs:
5960
- name: Build
6061
run: cmake --build build --config Release
6162

62-
# Debugging step: Print out directory contents (after build)
6363
- name: List output directory contents
6464
run: |
6565
if [ -d "out" ];then
@@ -70,10 +70,8 @@ jobs:
7070
7171
- name: Prepare files for packaging
7272
run: |
73-
# Create the directory structure for the package
7473
mkdir -p package/Release/${{ matrix.platform }}/lib
7574
76-
# Only copy binaries if the output directory exists
7775
if [ -d "out" ]; then
7876
cp -r out/* package/Release/${{ matrix.platform }}/lib/ || true
7977
else
@@ -113,7 +111,6 @@ jobs:
113111

114112
- name: Create OS-specific packages
115113
run: |
116-
# Group by OS platform
117114
for os_platform in windows linux macos; do
118115
mkdir -p "GekkoNet-${os_platform}"
119116
mkdir -p "GekkoNet-${os_platform}/${os_platform}/include"
@@ -136,3 +133,41 @@ jobs:
136133
draft: false
137134
prerelease: false
138135
files: GekkoNet-*-Release.tar.gz
136+
137+
generate_docs:
138+
needs: create_release
139+
runs-on: ubuntu-latest
140+
if: ${{ success() }}
141+
permissions:
142+
contents: write
143+
pages: write
144+
145+
steps:
146+
- uses: actions/checkout@v4
147+
148+
- name: Install Doxygen
149+
run: sudo apt-get update && sudo apt-get install -y doxygen graphviz
150+
151+
- name: Configure CMake for Documentation
152+
run: |
153+
cmake -B build \
154+
-DBUILD_DOCS=ON \
155+
-DCMAKE_BUILD_TYPE=Release \
156+
GekkoLib
157+
158+
- name: Generate Documentation
159+
run: cmake --build build --target docs
160+
161+
- name: Setup Pages
162+
uses: actions/configure-pages@v4
163+
164+
- name: Upload Documentation
165+
uses: actions/upload-pages-artifact@v3
166+
with:
167+
path: 'build/docs/html'
168+
169+
- name: Deploy to GitHub Pages
170+
id: deployment
171+
uses: actions/deploy-pages@v4
172+
with:
173+
token: ${{ secrets.GITHUB_TOKEN }}

‎GekkoLib/CMakeLists.txt

+54-4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED True)
1010

1111
# Option to build both shared and static libraries
1212
option(BUILD_SHARED_LIBS "Build using shared libraries" OFF)
13+
option(BUILD_DOCS "Build documentation" OFF)
1314

1415
if(MSVC)
1516
# Visual Studio specific flags
@@ -28,7 +29,6 @@ option(NO_ASIO_BUILD "Exclude ASIO from the build" OFF)
2829

2930
# Include directories for your project headers
3031
include_directories(${PROJECT_SOURCE_DIR}/include)
31-
3232
# Include directories for third-party header-only libraries
3333
include_directories(${PROJECT_SOURCE_DIR}/thirdparty)
3434
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/asio)
@@ -49,7 +49,6 @@ set(SRC_FILES
4949
# Shared libraries
5050
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/out)
5151
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/out)
52-
5352
# Static libraries
5453
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/out)
5554

@@ -58,11 +57,9 @@ add_library(GekkoNet ${SRC_FILES})
5857

5958
# Set the output names conditionally based on used options
6059
set(TARGET_SUFFIX "")
61-
6260
if(NOT BUILD_SHARED_LIBS)
6361
set(TARGET_SUFFIX "${TARGET_SUFFIX}_STATIC")
6462
endif()
65-
6663
if(NO_ASIO_BUILD)
6764
set(TARGET_SUFFIX "${TARGET_SUFFIX}_NO_ASIO")
6865
endif()
@@ -79,4 +76,57 @@ endif()
7976

8077
if(NO_ASIO_BUILD)
8178
target_compile_definitions(GekkoNet PRIVATE GEKKONET_NO_ASIO)
79+
endif()
80+
81+
# Documentation configuration
82+
if(BUILD_DOCS)
83+
find_package(Doxygen
84+
REQUIRED dot
85+
OPTIONAL_COMPONENTS mscgen dia)
86+
87+
# Get all header files
88+
file(GLOB_RECURSE HEADER_FILES
89+
${PROJECT_SOURCE_DIR}/include/*.h
90+
)
91+
92+
# Combine sources and headers for documentation
93+
set(DOXYGEN_INPUT_FILES
94+
${SRC_FILES}
95+
${HEADER_FILES}
96+
${PROJECT_SOURCE_DIR}/README.md
97+
)
98+
99+
# Configure Doxygen settings
100+
set(DOXYGEN_PROJECT_NAME "GekkoNet")
101+
set(DOXYGEN_PROJECT_VERSION ${PROJECT_VERSION})
102+
set(DOXYGEN_PROJECT_BRIEF "C/C++ Peer to Peer Game Networking SDK")
103+
set(DOXYGEN_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/docs)
104+
set(DOXYGEN_GENERATE_HTML YES)
105+
set(DOXYGEN_GENERATE_TREEVIEW YES)
106+
set(DOXYGEN_EXTRACT_ALL YES)
107+
set(DOXYGEN_EXTRACT_PRIVATE YES)
108+
set(DOXYGEN_EXTRACT_STATIC YES)
109+
set(DOXYGEN_RECURSIVE YES)
110+
set(DOXYGEN_SOURCE_BROWSER YES)
111+
set(DOXYGEN_GENERATE_LATEX NO)
112+
set(DOXYGEN_USE_MDFILE_AS_MAINPAGE "README.md")
113+
set(DOXYGEN_COLLABORATION_GRAPH YES)
114+
set(DOXYGEN_CLASS_GRAPH YES)
115+
set(DOXYGEN_CALL_GRAPH YES)
116+
set(DOXYGEN_CALLER_GRAPH YES)
117+
set(DOXYGEN_HIDE_UNDOC_RELATIONS NO)
118+
119+
# Add custom settings for networking library
120+
set(DOXYGEN_BUILTIN_STL_SUPPORT YES)
121+
set(DOXYGEN_EXTRACT_LOCAL_CLASSES YES)
122+
set(DOXYGEN_SHOW_INCLUDE_FILES YES)
123+
set(DOXYGEN_GENERATE_TODOLIST YES)
124+
set(DOXYGEN_WARNINGS YES)
125+
set(DOXYGEN_WARN_IF_UNDOCUMENTED YES)
126+
127+
# Generate documentation
128+
doxygen_add_docs(docs
129+
${DOXYGEN_INPUT_FILES}
130+
COMMENT "Generating API documentation with Doxygen"
131+
)
82132
endif()

0 commit comments

Comments
 (0)