From 1dac2d560c371f0d1f736343a5480a563b5fbb55 Mon Sep 17 00:00:00 2001
From: Stefan Haller <stefan.haller@iwr.uni-heidelberg.de>
Date: Thu, 22 Mar 2018 14:37:51 +0100
Subject: [PATCH] Enable Doxygen generation

---
 CMakeLists.txt | 14 ++++++++++++++
 Doxyfile.in    | 26 ++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)
 create mode 100644 Doxyfile.in

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 180e3fe..d82a79c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,3 +31,17 @@ message(STATUS ${HDF5_INCLUDE_DIR})
 add_subdirectory(test)
 enable_testing()
 add_subdirectory(src)
+
+option(BUILD_DOC "Build documentation" OFF)
+if(BUILD_DOC)
+  find_package(Doxygen REQUIRED)
+  configure_file(Doxyfile.in Doxyfile @ONLY)
+  add_custom_target(docs-mrf
+    COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile
+    COMMENT "Generating API documentation with Doxygen"
+    VERBATIM)
+  if(NOT TARGET docs)
+    add_custom_target(docs ALL)
+  endif()
+  add_dependencies(docs docs-mrf)
+endif()
diff --git a/Doxyfile.in b/Doxyfile.in
new file mode 100644
index 0000000..172da73
--- /dev/null
+++ b/Doxyfile.in
@@ -0,0 +1,26 @@
+PROJECT_NAME = "LP_MP-MRF"
+PROJECT_BRIEF = "Message-Passing for Markov Random Fields"
+QUIET = YES
+
+OUTPUT_DIRECTORY = @CMAKE_CURRENT_BINARY_DIR@/docs/
+INPUT = @CMAKE_CURRENT_SOURCE_DIR@/include
+RECURSIVE = YES
+
+GENERATE_TAGFILE = @CMAKE_CURRENT_BINARY_DIR@/docs/lpmp_mrf.tag
+TAGFILES = \
+  @CMAKE_CURRENT_BINARY_DIR@/external/LP_MP/docs/lpmp.tag=../external/LP_MP/docs \
+  @CMAKE_CURRENT_BINARY_DIR@/external/LP_MP/external/DD_ILP/docs/ddilp.tag=../external/LP_MP/external/DD_ILP/docs
+
+MARKDOWN_SUPPORT = YES
+BUILTIN_STL_SUPPORT = YES
+
+EXTRACT_ALL = YES
+EXTRACT_PRIVATE = YES
+EXTRACT_STATIC = YES
+INTERNAL_DOCS = YES
+
+SOURCE_BROWSER = YES
+
+GENERATE_LATEX = NO
+GENERATE_HTML = YES
+HTML_OUTPUT = "."