@@ -10,6 +10,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED True)
10
10
11
11
# Option to build both shared and static libraries
12
12
option (BUILD_SHARED_LIBS "Build using shared libraries" OFF )
13
+ option (BUILD_DOCS "Build documentation" OFF )
13
14
14
15
if (MSVC )
15
16
# Visual Studio specific flags
@@ -28,7 +29,6 @@ option(NO_ASIO_BUILD "Exclude ASIO from the build" OFF)
28
29
29
30
# Include directories for your project headers
30
31
include_directories (${PROJECT_SOURCE_DIR} /include )
31
-
32
32
# Include directories for third-party header-only libraries
33
33
include_directories (${PROJECT_SOURCE_DIR} /thirdparty)
34
34
include_directories (${PROJECT_SOURCE_DIR} /thirdparty/asio)
@@ -49,7 +49,6 @@ set(SRC_FILES
49
49
# Shared libraries
50
50
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR} /out)
51
51
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR} /out)
52
-
53
52
# Static libraries
54
53
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR} /out)
55
54
@@ -58,11 +57,9 @@ add_library(GekkoNet ${SRC_FILES})
58
57
59
58
# Set the output names conditionally based on used options
60
59
set (TARGET_SUFFIX "" )
61
-
62
60
if (NOT BUILD_SHARED_LIBS )
63
61
set (TARGET_SUFFIX "${TARGET_SUFFIX} _STATIC" )
64
62
endif ()
65
-
66
63
if (NO_ASIO_BUILD)
67
64
set (TARGET_SUFFIX "${TARGET_SUFFIX} _NO_ASIO" )
68
65
endif ()
@@ -79,4 +76,57 @@ endif()
79
76
80
77
if (NO_ASIO_BUILD)
81
78
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
+ )
82
132
endif ()
0 commit comments