cmake: adapt Doxygen

Adapts Doxygen generators to changes in previous commit.
parent c107bf77
......@@ -98,16 +98,17 @@ test:builder:clang-sanitizers:
# doc
build:doc:
image: gitlab.fit.cvut.cz:5000/algorithms-library-toolkit/ci-docker-images/alt-builder:latest
stage: build
before_script:
- apk add --no-cache doxygen graphviz cmake ninja python3
- apt-get update && apt-get install -y doxygen graphviz
script:
- mkdir -p build && cd build
- cmake -DBUILD_TYPE=Snapshot -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DDOXYGEN_ONLY=1 -GNinja ..
- cmake -DBUILD_TYPE=Snapshot -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DBUILD_DOCS=1 -GNinja ..
- ninja doxygen
artifacts:
paths:
- apidoc/
- build/apidoc/
expire_in: 1 day
#######################################################################################################################
......
find_package(Doxygen COMPONENTS dot)
if (${DOXYGEN_FOUND})
# construct input for doxygen
set(ALIB_DOXYGEN_INPUTS)
foreach (module ${ALIB_MODULES})
if (EXISTS ${CMAKE_SOURCE_DIR}/${module}/src)
list(APPEND ALIB_DOXYGEN_INPUTS "${module}/src")
endif()
endforeach ()
string (REPLACE ";" " " ALIB_DOXYGEN_INPUTS "${ALIB_DOXYGEN_INPUTS}")
set(ALIB_DOXYGEN_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/apidoc")
configure_file (
${CMAKE_SOURCE_DIR}/docs/Doxyfile.in
${CMAKE_BINARY_DIR}/Doxyfile
)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/doxygen)
add_custom_target ( "doxygen"
python3 ${CMAKE_SOURCE_DIR}/extra/scripts/doxygen.py "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}/doxygen" "${ALIB_DOXYGEN_INPUTS}"
COMMAND doxygen ../Doxyfile
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/doxygen
COMMENT "Generating API documentation with Doxygen"
VERBATIM )
message ( "[Doxygen] Doxyfile generated. Run target 'doxygen' to generate Doxygen XML output" )
else()
message ( WARNING "[Doxygen] Doxygen not found. Target 'doxygen' not created" )
endif()
set(ALT_MODULES "")
function(alt_module name)
if (NOT IS_DIRECTORY ${CMAKE_SOURCE_DIR}/${NAME})
message(FATAL "${name} is not a directory")
endif()
add_subdirectory(${name})
list(APPEND ALT_MODULES "${name}")
set(ALT_MODULES ${ALT_MODULES} PARENT_SCOPE)
endfunction()
function(alt_executable name)
......@@ -82,3 +87,39 @@ function(alt__unittests name depends includes)
TEST_PREFIX "[${test_executable}]"
)
endfunction()
function(alt_doxygen)
find_package(Doxygen COMPONENTS dot)
if (NOT(${DOXYGEN_FOUND}))
message ( WARNING "[Doxygen] Doxygen not found. Target 'doxygen' not created" )
return()
endif()
# construct input for doxygen
set(ALT_DOXYGEN_INPUTS)
foreach (module ${ALT_MODULES})
if (EXISTS ${CMAKE_SOURCE_DIR}/${module}/src)
list(APPEND ALT_DOXYGEN_INPUTS "${module}/src")
endif()
endforeach ()
string (REPLACE ";" " " ALT_DOXYGEN_INPUTS "${ALT_DOXYGEN_INPUTS}")
set(ALT_DOXYGEN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/apidoc")
configure_file (
${CMAKE_SOURCE_DIR}/docs/Doxyfile.in
${CMAKE_BINARY_DIR}/Doxyfile
)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/doxygen)
add_custom_target ( "doxygen"
python3 ${CMAKE_SOURCE_DIR}/extra/scripts/doxygen.py "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}/doxygen" "${ALT_DOXYGEN_INPUTS}"
COMMAND doxygen ../Doxyfile
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/doxygen
COMMENT "Generating API documentation with Doxygen"
VERBATIM )
message ( "[Doxygen] Doxyfile generated. Run target 'doxygen' to generate Doxygen XML output" )
endfunction()
......@@ -50,11 +50,6 @@ if(BUILD_TESTING)
alt_module(alib2integrationtest)
endif()
# docs
if(BUILD_DOCS)
include(Doxygen)
endif()
message("[ALT] Building ${PROJECT_NAME} ${PROJECT_VERSION}")
alt_module(alib2std)
......@@ -84,3 +79,9 @@ alt_module(aql2)
alt_module(alib2gui)
alt_module(agui2)
# docs
if(BUILD_DOCS)
alt_doxygen()
endif()
......@@ -38,7 +38,7 @@ PROJECT_NAME = "Algorithms Library Toolkit"
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = "${ALIB_VERSION_INFO}"
PROJECT_NUMBER = "${ALT_VERSION_INFO}"
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
......@@ -58,7 +58,7 @@ PROJECT_LOGO =
# entered, it will be relative to the location where doxygen was started. If
# left blank the current directory will be used.
OUTPUT_DIRECTORY = "${ALIB_DOXYGEN_OUTPUT_DIRECTORY}"
OUTPUT_DIRECTORY = "${ALT_DOXYGEN_OUTPUT_DIRECTORY}"
# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
# directories (in 2 levels) under the output directory of each output format and
......@@ -819,7 +819,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.
INPUT = ${ALIB_DOXYGEN_INPUTS}
INPUT = ${ALT_DOXYGEN_INPUTS}
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment