From 73aaa91ceac51a96973965827ebc2fbb23d6c234 Mon Sep 17 00:00:00 2001
From: Matt Ranostay <matt.ranostay@konsulko.com>
Date: Wed, 14 Aug 2019 17:28:51 -0700
Subject: docs: add docs target for generating doxygen output

Bug-AGL: SPEC-2737
Change-Id: I96d1f68aab63b29889d44b72dc45596ff104a96a
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
---
 .gitignore          |  3 +++
 CMakeLists.txt      |  1 +
 docs/CMakeLists.txt | 22 ++++++++++++++++++++++
 docs/Doxyfile.in    | 11 +++++++++++
 4 files changed, 37 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 docs/CMakeLists.txt
 create mode 100644 docs/Doxyfile.in

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..0eb73e1
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+docs/Doxyfile
+docs/html
+docs/latex
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3509b85..9db25fe 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -46,6 +46,7 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qtappfw.pc
 	DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig)
 
 set (SUBDIRS
+	docs
 	bluetooth
 	map
 	mediaplayer
diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt
new file mode 100644
index 0000000..2346aff
--- /dev/null
+++ b/docs/CMakeLists.txt
@@ -0,0 +1,22 @@
+# add a target to generate API documentation with Doxygen
+find_package(Doxygen)
+option(BUILD_DOCUMENTATION "Create and install the HTML based API documentation (requires Doxygen)" ${DOXYGEN_FOUND})
+
+if(BUILD_DOCUMENTATION)
+	if(NOT DOXYGEN_FOUND)
+	message(FATAL_ERROR "Doxygen is needed to build the documentation.")
+	endif()
+
+	set(doxyfile_in ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in)
+	set(doxyfile ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
+
+	configure_file(${doxyfile_in} ${doxyfile} @ONLY)
+
+	add_custom_target(docs
+	COMMAND ${DOXYGEN_EXECUTABLE} ${doxyfile}
+	WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+	COMMENT "Generating API documentation with Doxygen"
+	VERBATIM)
+
+	install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION share/doc)
+endif()
diff --git a/docs/Doxyfile.in b/docs/Doxyfile.in
new file mode 100644
index 0000000..cdfe6e7
--- /dev/null
+++ b/docs/Doxyfile.in
@@ -0,0 +1,11 @@
+PROJECT_NAME           = "@CMAKE_PROJECT_NAME@"
+PROJECT_NUMBER         = @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@
+STRIP_FROM_PATH        = @PROJECT_SOURCE_DIR@ \
+			 @PROJECT_BINARY_DIR@
+INPUT                  = @doxy_main_page@ \
+			 @PROJECT_SOURCE_DIR@ \
+			 @PROJECT_BINARY_DIR@
+EXCLUDE                = @PROJECT_SOURCE_DIR@/qtappfw_autogen
+FILE_PATTERNS          = *.h *.cpp
+RECURSIVE              = YES
+USE_MDFILE_AS_MAINPAGE = @doxy_main_page@
-- 
cgit