Add basic support for generating API documentation using Doxygen
authorJürgen Doser <jurgen.doser@gmail.com>
Wed, 30 Jan 2013 17:21:32 +0000 (18:21 +0100)
committerShadowNinja <shadowninja@minetest.net>
Fri, 12 Dec 2014 19:59:57 +0000 (14:59 -0500)
If CMake is run and Doxygen is found, add a make target called "doc",
which builds API documention in doc/html. This target is not included
in the default "all" target, you have to explicitly run "make doc" to
generate the documentation.

If graphviz is installed, in particular, if the "dot" binary is found,
doxygen is configured to generate various kinds of diagrams. Note that
due to this, the first run of doxygen can take a while.

.gitignore
CMakeLists.txt
doc/Doxyfile.in [new file with mode: 0644]

index 98a7f35b9cde502a73412834189256591e3b37df..680a4415888dc5e478211ee4d1764c20f678ea35 100644 (file)
@@ -26,6 +26,11 @@ tags
 minetest.conf
 debug.txt
 
+## Doxygen files
+doc/Doxyfile
+doc/html/
+doc/doxygen_*
+
 ## Build files
 CMakeFiles/*
 src/CMakeFiles/*
@@ -64,7 +69,7 @@ locale/
 *.layout
 *.o
 
-#build variants
+## Build variants
 build/android/assets
 build/android/bin
 build/android/Debug
@@ -75,5 +80,3 @@ build/android/libs
 build/android/obj
 timestamp
 
-
-
index 5e234eedf126d2c95dd36ffdfefd47725c18fad2..6bfd4c91140c1626b73dbf8f19bb3760a5b89afa 100644 (file)
@@ -229,3 +229,14 @@ endif()
 
 include(CPack)
 
+# Add a target to generate API documentation with Doxygen
+find_package(Doxygen)
+if(DOXYGEN_FOUND)
+       configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/doc/Doxyfile @ONLY)
+       add_custom_target(doc
+               ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doc/Doxyfile
+               WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc
+               COMMENT "Generating API documentation with Doxygen" VERBATIM
+       )
+endif(DOXYGEN_FOUND)
+
diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in
new file mode 100644 (file)
index 0000000..062fc67
--- /dev/null
@@ -0,0 +1,32 @@
+DOXYFILE_ENCODING      = UTF-8
+
+PROJECT_NAME           = "Minetest"
+PROJECT_NUMBER         = @VERSION_STRING@
+
+STRIP_FROM_PATH        = @CMAKE_CURRENT_SOURCE_DIR@/src
+JAVADOC_AUTOBRIEF      = YES
+EXTRACT_ALL            = YES
+EXTRACT_PRIVATE        = YES
+EXTRACT_STATIC         = YES
+SORT_MEMBERS_CTORS_1ST = YES
+WARN_IF_UNDOCUMENTED   = NO
+
+INPUT = @CMAKE_CURRENT_SOURCE_DIR@/src/ \
+       @CMAKE_CURRENT_SOURCE_DIR@/src/util \
+       @CMAKE_CURRENT_SOURCE_DIR@/src/script \
+       @CMAKE_CURRENT_SOURCE_DIR@/src/script/common \
+       @CMAKE_CURRENT_SOURCE_DIR@/src/script/cpp_api \
+       @CMAKE_CURRENT_SOURCE_DIR@/src/script/lua_api
+RECURSIVE              = NO
+
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION    = YES
+GENERATE_LATEX         = NO
+PAPER_TYPE             = a4wide
+
+HAVE_DOT               = @DOXYGEN_DOT_FOUND@
+CALL_GRAPH             = YES
+CALLER_GRAPH           = YES
+MAX_DOT_GRAPH_DEPTH    = 3
+DOT_MULTI_TARGETS      = YES
+