CMakeLists.txt 3.72 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
cmake_minimum_required(VERSION 2.8)

include(cmake/base.cmake)

# These variables have to be defined before running setup_project
set(PROJECT_NAME hpp-doc)
set(PROJECT_DESCRIPTION "Documentation for HPP")
set(PROJECT_URL https://humanoid-path-planner.github.io/hpp-doc/index.html)

setup_project()

# Arguments are:
# - (required) package name
# - (optional) git url
# - (optional) robotpkg name
MACRO(ADD_PKG pkg)
  SET (OPT_ARGS ${ARGN})
  LIST(APPEND SETUP_DOC_PKG ${pkg})
  LIST(LENGTH OPT_ARGS N_OPT_ARGS)
  IF(${N_OPT_ARGS} GREATER 0)
    LIST(GET OPT_ARGS 0 ${pkg}_giturl)
  ENDIF(${N_OPT_ARGS} GREATER 0)
  IF(${N_OPT_ARGS} GREATER 1)
    LIST(GET OPT_ARGS 1 ${pkg}_robotpkg_package)
  ENDIF(${N_OPT_ARGS} GREATER 1)
ENDMACRO(ADD_PKG)

MACRO(ADD_HPP_PKG pkg)
  ADD_PKG(${pkg} git://github.com:humanoid-path-planner/${pkg})
ENDMACRO(ADD_HPP_PKG)

SET(SETUP_DOC_PKG)

ADD_HPP_PKG(hpp-fcl)
ADD_HPP_PKG(hpp-util)
ADD_HPP_PKG(pinocchio)
ADD_HPP_PKG(hpp-pinocchio)
ADD_HPP_PKG(hpp-core)
ADD_HPP_PKG(hpp-corbaserver)
ADD_HPP_PKG(hpp-constraints)
ADD_HPP_PKG(hpp-wholebody-step)
ADD_HPP_PKG(hpp-manipulation)
ADD_HPP_PKG(hpp-manipulation-urdf)
ADD_HPP_PKG(hpp-manipulation-corba)
ADD_HPP_PKG(gepetto-viewer)
ADD_HPP_PKG(gepetto-viewer-corba)
ADD_HPP_PKG(hpp-gepetto-viewer)
ADD_HPP_PKG(hpp_tutorial)

FOREACH(PKG ${SETUP_DOC_PKG})
  ADD_OPTIONAL_DEPENDENCY(${PKG})

  STRING(REGEX REPLACE "[^a-zA-Z0-9]" "_" PREFIX "${PKG}")
  STRING(TOUPPER ${PREFIX} PREFIX)
  STRING(REGEX REPLACE "[^a-zA-Z0-9]" "" DOC_VAR "${PKG}")
  STRING(TOUPPER ${DOC_VAR} DOC_VAR)
  IF(${PREFIX}_FOUND)
    IF(DEFINED ${PREFIX}_DOXYGENDOCDIR)
      SET(DOC_PREFIX ${${PREFIX}_DOXYGENDOCDIR})
    ELSEIF(DEFINED ${PREFIX}_DOCDIR)
      SET(DOC_PREFIX ${${PREFIX}_DOCDIR})
    ELSE(DEFINED ${PREFIX}_DOCDIR)
      SET(DOC_PREFIX ${${PREFIX}_PREFIX}/share/doc/${PKG}/doxygen-html)
    ENDIF(DEFINED ${PREFIX}_DOXYGENDOCDIR)
65
    STRING(REPLACE ${CMAKE_INSTALL_PREFIX}/share/doc ../.. DOC_PREFIX "${DOC_PREFIX}")
66
    IF (EXISTS ${DOC_PREFIX}/main.html)
67
      SET(${DOC_VAR}_URL ${DOC_PREFIX}/main.html)
68
    ELSE (EXISTS ${DOC_PREFIX}/main.html)
69
      SET(${DOC_VAR}_URL ${DOC_PREFIX}/index.html)
70
    ENDIF (EXISTS ${DOC_PREFIX}/main.html)
71
    SET(${DOC_VAR}_LINK "<a href='${${DOC_VAR}_URL}'>${PKG}</a>")
72
73
  ELSE(${PREFIX}_FOUND)
    SET(PACKAGE_NAME ${PKG})
74
75
    SET(DOC_PKG_NAME "hpp_doc_missing_${DOC_VAR}")
    SET(${DOC_VAR}_LINK "\\ref ${DOC_PKG_NAME}")
76
    SET(${DOC_VAR}_URL ${${DOC_VAR}_LINK})
77
78
    SET(STEPS)
    IF(DEFINED ${PKG}_giturl)
79
80
81
      SET(STEPS "${STEPS}\\li get the source code through \\c git:
\\code git clone --recursive ${${PKG}_giturl} \\endcode
Then configure, compile and install the package.\n")
82
83
    ENDIF(DEFINED ${PKG}_giturl)
    IF(DEFINED ${PKG}_robotpkg_package)
84
85
86
87
88
      SET(STEPS "${STEPS}\\li install it through \\c robotpkg :
\\code
cd robotpkg/${${PKG}_robotpkg_package}
make update
\\endcode")
89
    ENDIF(DEFINED ${PKG}_robotpkg_package)
90
    CONFIGURE_FILE(doc/missing.dox.in ${CMAKE_BINARY_DIR}/doc/${PKG}-missing.dox @ONLY)
91
92
93
  ENDIF(${PREFIX}_FOUND)
ENDFOREACH(PKG ${SETUP_DOC_PKG})

94
CONFIG_FILES(doc/main.dox doc/doxygenLayout.xml)
95
96

ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/graphDep.dot
97
  COMMAND ${CMAKE_SOURCE_DIR}/scripts/packageDep --quiet --output ${CMAKE_BINARY_DIR}/graphDep.dot ${SETUP_DOC_PKG})
Joseph Mirabel's avatar
Joseph Mirabel committed
98
ADD_CUSTOM_TARGET(generate-html ALL
99
  DEPENDS graphDep.dot)
100
101

INSTALL(FILES
102
  doc/index.html
103
  doc/jquery-3.3.1.min.js
104
  ${CMAKE_BINARY_DIR}/doc/main.dox
105
106
107
108
  DESTINATION ${CMAKE_INSTALL_DOCDIR})
INSTALL(DIRECTORY
  doc/figures
  DESTINATION ${CMAKE_INSTALL_DOCDIR})
109
110
111
112
113
IF(NOT DEFINED INSTALL_DOCUMENTATION OR ${INSTALL_DOCUMENTATION})
  INSTALL(
    FILES ${CMAKE_CURRENT_BINARY_DIR}/doc/doxygen-xml/index.xml
    DESTINATION ${CMAKE_INSTALL_DOCDIR}/doxygen-html)
ENDIF()
114
115

setup_project_finalize()