Skip to content

Commit cb908a5

Browse files
sy-ckostorr
authored andcommitted
updated make doc for compatibility with alice-flp.docs
1 parent 216bd82 commit cb908a5

File tree

3 files changed

+67
-20
lines changed

3 files changed

+67
-20
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ project(ReadoutCard
2121
# Documentation dir
2222
add_subdirectory(doc)
2323

24+
# simplified build mode for doc only
25+
if(ONLYDOC)
26+
return()
27+
endif()
28+
2429
# Add compiler flags for warnings and debug symbols
2530
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra -Werror")
2631

doc/CMakeLists.txt

Lines changed: 61 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,69 @@
11
# @author Barthélémy von Haller
2+
# @author Sylvain Chapeland
23

3-
include(FindDoxygen)
4+
# define doc build path
5+
set(DOC_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/doc-build")
6+
7+
# define doc installation path
8+
# ensures it ends with project name
9+
if (NOT CMAKE_INSTALL_DOCDIR)
10+
set(CMAKE_INSTALL_DOCDIR "doc")
11+
endif()
12+
if (NOT "${CMAKE_INSTALL_DOCDIR}" MATCHES "${PROJECT_NAME}$")
13+
set(CMAKE_INSTALL_DOCDIR "${CMAKE_INSTALL_DOCDIR}/${PROJECT_NAME}")
14+
endif()
415

5-
if(NOT DOXYGEN_DOT_FOUND)
6-
message(WARNING "Graphviz doesn't seem to be installed. Doxygen will not be able to generate graphs. Consider installing this package.")
7-
endif(NOT DOXYGEN_DOT_FOUND)
16+
# log doc build/install paths
17+
message(STATUS "Documentation will be built in ${DOC_BUILD_DIR}")
18+
message(STATUS "Documentation will be installed in ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DOCDIR}")
819

20+
# general files directly from source
21+
install(
22+
FILES
23+
${CMAKE_SOURCE_DIR}/README.md
24+
TYPE DOC
25+
)
26+
install(
27+
DIRECTORY ${CMAKE_SOURCE_DIR}/doc
28+
TYPE DOC
29+
FILES_MATCHING PATTERN "*.md" PATTERN "*.png"
30+
)
31+
32+
# doxygen-generated files
33+
include(FindDoxygen)
934
if (DOXYGEN_FOUND)
10-
# Configure the doxygen config file with current settings
11-
set("DOC_OUTPUT_DIR" "${CMAKE_CURRENT_BINARY_DIR}")
35+
if(NOT DOXYGEN_DOT_FOUND)
36+
message(WARNING "dot not found. Please install Graphviz.")
37+
endif(NOT DOXYGEN_DOT_FOUND)
38+
39+
# configure the doxygen config file with current cmake settings
1240
configure_file(doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/documentation-config.doxygen @ONLY)
1341

14-
# target doc
15-
add_custom_target(doc
16-
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/documentation-config.doxygen
17-
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
18-
COMMENT "Generating API documentation using doxygen for ${PROJECT_NAME}
19-
\n Output will be available in ${DOC_OUTPUT_DIR}/html" VERBATIM)
20-
21-
# installation
22-
option(DOC_INSTALL "Install the documentation when calling \"make install\"" OFF)
23-
if(DOC_INSTALL)
24-
message(STATUS "Documentation will be installed but you *must* run `make doc`")
25-
install(DIRECTORY ${DOC_OUTPUT_DIR}/html DESTINATION share/doc/${PROJECT_NAME} COMPONENT doc)
26-
endif(DOC_INSTALL)
42+
# build documentation with target "doc"
43+
add_custom_target(
44+
doc
45+
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/documentation-config.doxygen
46+
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
47+
COMMENT "Generating API documentation using doxygen for ${PROJECT_NAME}"
48+
VERBATIM
49+
DEPENDS doc-dir
50+
)
51+
52+
# doxygen fails creating multi-level output directory, make sure it exists
53+
add_custom_target(
54+
doc-dir
55+
COMMAND ${CMAKE_COMMAND} -E make_directory "${DOC_BUILD_DIR}"
56+
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
57+
COMMENT "Create the doxygen output directory"
58+
VERBATIM
59+
)
60+
61+
# install generated files
62+
install(
63+
DIRECTORY ${DOC_BUILD_DIR}/html
64+
TYPE DOC
65+
OPTIONAL # because available only after "make doc"
66+
)
67+
else ()
68+
message(WARNING "Doxygen not found")
2769
endif (DOXYGEN_FOUND)

doc/doxyfile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ PROJECT_NUMBER = @VERSION@
3838
# If a relative path is entered, it will be relative to the location
3939
# where doxygen was started. If left blank the current directory will be used.
4040

41-
OUTPUT_DIRECTORY = "@CMAKE_BINARY_DIR@/doc/@PROJECT_NAME@"
41+
OUTPUT_DIRECTORY = "@DOC_BUILD_DIR@"
4242

4343
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
4444
# 4096 sub-directories (in 2 levels) under the output directory of each output

0 commit comments

Comments
 (0)