From 21fbed01aaa1548cf21b604a3b35a52ac6dad5bc Mon Sep 17 00:00:00 2001
From: Joseph Mirabel <jmirabel@laas.fr>
Date: Tue, 8 Oct 2019 15:40:54 +0200
Subject: [PATCH] Generate python doc from doxygen.

---
 doc/Doxyfile.extra.in |  1 +
 python/CMakeLists.txt |  4 ++++
 python/math.cc        | 16 ++++++++++++++--
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/doc/Doxyfile.extra.in b/doc/Doxyfile.extra.in
index 16c2c547..61570774 100644
--- a/doc/Doxyfile.extra.in
+++ b/doc/Doxyfile.extra.in
@@ -1 +1,2 @@
 FILE_PATTERNS          = *.h  *.hh  *.hxx
+GENERATE_XML           = YES
diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt
index 1730b561..8d5d461b 100644
--- a/python/CMakeLists.txt
+++ b/python/CMakeLists.txt
@@ -39,6 +39,10 @@ SET_TARGET_PROPERTIES(python PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD True)
 SET(LIBRARY_NAME hppfcl)
 
 INCLUDE_DIRECTORIES("${Boost_INCLUDE_DIRS}" ${PYTHON_INCLUDE_DIRS})
+# To be run manually:
+# make doc
+# ./cmake/doxygen/doxygen_xml_parser.py build-rel/doc/doxygen-xml/index.xml > build-rel/python/doxygen_autodoc.hh
+INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}")
 
 SET(${LIBRARY_NAME}_HEADERS
   fcl.hh
diff --git a/python/math.cc b/python/math.cc
index b392b0aa..1fc05eb9 100644
--- a/python/math.cc
+++ b/python/math.cc
@@ -41,6 +41,18 @@
 #include <hpp/fcl/math/transform.h>
 
 #include "fcl.hh"
+#include <hpp/fcl/collision.h>
+#include <hpp/fcl/traversal/traversal_node_bvh_shape.h>
+#include <hpp/fcl/traversal/traversal_node_bvhs.h>
+#include <hpp/fcl/traversal/traversal_node_octree.h>
+#include <hpp/fcl/traversal/traversal_node_shapes.h>
+#include <hpp/fcl/mesh_loader/loader.h>
+#include <hpp/fcl/narrowphase/gjk.h>
+#include <hpp/fcl/BVH/BVH_model.h>
+#include <hpp/fcl/octree.h>
+#include <hpp/fcl/profile.h>
+
+#include "doxygen_autodoc.hh"
 
 using namespace boost::python;
 
@@ -77,8 +89,8 @@ void exposeMaths ()
     .def (init<Vec3f>())
     .def (init<Transform3f>(args("self","other"),"Copy constructor."))
 
-    .def ("getQuatRotation", &Transform3f::getQuatRotation)
-    .def ("getTranslation", &Transform3f::getTranslation, return_value_policy<copy_const_reference>())
+    .def ("getQuatRotation", &Transform3f::getQuatRotation, doxygen::member_func_doc(&Transform3f::getQuatRotation))
+    .def ("getTranslation", &Transform3f::getTranslation, doxygen::member_func_doc(&Transform3f::getTranslation), return_value_policy<copy_const_reference>())
     .def ("getRotation", &Transform3f::getRotation, return_value_policy<copy_const_reference>())
     .def ("isIdentity", &Transform3f::setIdentity)
 
-- 
GitLab