Skip to content

Commit f0ef4d4

Browse files
authored
Merge pull request #65 from sy-c/master
v1.3.23
2 parents 0e54df7 + 25d9d3c commit f0ef4d4

File tree

4 files changed

+1601
-827
lines changed

4 files changed

+1601
-827
lines changed

CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,18 @@ cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
1010
project(
1111
InfoLogger
1212
DESCRIPTION "O2 Logging library and services"
13-
LANGUAGES CXX C
13+
LANGUAGES NONE
1414
)
1515

16+
# simplified build mode for doc only
17+
if(ONLYDOC)
18+
add_subdirectory(doc)
19+
return()
20+
endif()
21+
1622
# global compilation options
23+
enable_language(C)
24+
enable_language(CXX)
1725
set(CMAKE_CXX_STANDARD 14)
1826
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1927
set(CMAKE_CXX_EXTENSIONS OFF)

doc/CMakeLists.txt

Lines changed: 57 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,64 @@
1-
# @author Barthélémy von Haller
1+
# Generate documentation
22

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

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)
15+
# log doc build(install paths)
16+
message(STATUS "Documentation will be built in ${DOC_BUILD_DIR}")
17+
message(STATUS "Documentation will be installed in ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DOCDIR}")
818

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

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)
36+
# build documentation with target "doc"
37+
add_custom_target(
38+
doc
39+
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/documentation-config.doxygen
40+
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
41+
COMMENT "Generating API documentation using doxygen for ${PROJECT_NAME}"
42+
VERBATIM
43+
DEPENDS doc-dir
44+
)
45+
46+
# doxygen fails creating multi-level output directory, make sure it exists
47+
add_custom_target(
48+
doc-dir
49+
COMMAND ${CMAKE_COMMAND} -E make_directory "${DOC_BUILD_DIR}"
50+
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
51+
COMMENT "Create the doxygen output directory"
52+
VERBATIM
53+
)
54+
55+
# install generated files
56+
install(
57+
DIRECTORY ${DOC_BUILD_DIR}/html
58+
TYPE DOC
59+
OPTIONAL # because available only after "make doc"
60+
)
61+
else ()
62+
message(WARNING "Doxygen not found")
2763
endif (DOXYGEN_FOUND)
64+

0 commit comments

Comments
 (0)