-
Notifications
You must be signed in to change notification settings - Fork 792
/
Copy pathCMakeLists.txt
79 lines (69 loc) · 2.49 KB
/
CMakeLists.txt
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Doxygen documentation configuration
option(GTSAM_BUILD_DOCS "Enable/Disable building of doxygen docs" ON)
# configure doxygen
option(GTSAM_BUILD_DOC_HTML "Enable/Disable doxygen HTML output" ON)
option(GTSAM_BUILD_DOC_LATEX "Enable/Disable doxygen LaTeX output" OFF)
# add a target to generate API documentation with Doxygen
if (GTSAM_BUILD_DOCS)
# Convert configuration to YES/NO variables
if (GTSAM_BUILD_DOC_HTML)
set(GTSAM_BUILD_DOC_HTML_YN "YES")
else()
set(GTSAM_BUILD_DOC_HTML_YN "NO")
endif()
if (GTSAM_BUILD_DOC_LATEX)
set(GTSAM_BUILD_DOC_LATEX_YN "YES")
else()
set(GTSAM_BUILD_DOC_LATEX_YN "NO")
endif()
# GTSAM core subfolders
set(gtsam_doc_subdirs
gtsam/base
gtsam/geometry
gtsam/inference
gtsam/discrete
gtsam/linear
gtsam/nonlinear
gtsam/slam
gtsam
)
# Optional GTSAM_UNSTABLE subfolders
set(gtsam_unstable_doc_subdirs
gtsam_unstable/base
gtsam_unstable/discrete
gtsam_unstable/linear
gtsam_unstable/nonlinear
gtsam_unstable/slam
gtsam_unstable/dynamics
gtsam_unstable
)
# Build a list of folders to include depending on build options
set(doc_subdirs ${gtsam_doc_subdirs})
if (GTSAM_BUILD_UNSTABLE)
list(APPEND doc_subdirs ${gtsam_unstable_doc_subdirs})
endif()
if (GTSAM_BUILD_EXAMPLES)
list(APPEND doc_subdirs examples)
endif()
# From subfolders, build a list with whitespace separation of paths
set(GTSAM_DOXYGEN_INPUT_PATHS "")
foreach(dir ${doc_subdirs})
set(GTSAM_DOXYGEN_INPUT_PATHS "${GTSAM_DOXYGEN_INPUT_PATHS} ${PROJECT_SOURCE_DIR}/${dir}")
endforeach()
# Generate Doxyfile
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
# Add target to actually build documentation as configured
add_custom_target(doc
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
# Clean target
add_custom_target(doc_clean
COMMAND
cmake -E remove_directory ${CMAKE_CURRENT_SOURCE_DIR}/latex
COMMAND
cmake -E remove_directory ${CMAKE_CURRENT_SOURCE_DIR}/html
COMMENT "Removing Doxygen documentation"
)
endif()