Make doxygen optional.

pull/1/head
Joshua Potter 2024-01-06 11:06:19 -07:00
parent a65bb5255e
commit bf7a1668b2
4 changed files with 45 additions and 37 deletions

View File

@ -1,24 +1,28 @@
find_package(Doxygen REQUIRED) find_package(Doxygen)
set(DOXYGEN_INPUT_DIR ${PROJECT_SOURCE_DIR}/include) if(DOXYGEN_FOUND)
set(DOXYGEN_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/doxygen)
set(DOXYGEN_INDEX_FILE ${DOXYGEN_OUTPUT_DIR}/xml/index.xml)
set(DOXYFILE_IN ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in)
set(DOXYFILE_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
configure_file(${DOXYFILE_IN} ${DOXYFILE_OUT} @ONLY) set(DOXYGEN_INPUT_DIR ${PROJECT_SOURCE_DIR}/include)
set(DOXYGEN_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/doxygen)
set(DOXYGEN_INDEX_FILE ${DOXYGEN_OUTPUT_DIR}/xml/index.xml)
set(DOXYFILE_IN ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in)
set(DOXYFILE_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
file(MAKE_DIRECTORY ${DOXYGEN_OUTPUT_DIR}) configure_file(${DOXYFILE_IN} ${DOXYFILE_OUT} @ONLY)
add_custom_command(OUTPUT file(MAKE_DIRECTORY ${DOXYGEN_OUTPUT_DIR})
${DOXYGEN_INDEX_FILE}
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYFILE_OUT}
MAIN_DEPENDENCY ${DOXYFILE_OUT} ${DOXYFILE_IN}
COMMENT "Generating Doxygen documentation"
VERBATIM
)
add_custom_target(docs DEPENDS ${DOXYGEN_INDEX_FILE}) add_custom_command(OUTPUT
${DOXYGEN_INDEX_FILE}
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYFILE_OUT}
MAIN_DEPENDENCY ${DOXYFILE_OUT} ${DOXYFILE_IN}
COMMENT "Generating Doxygen documentation"
VERBATIM
)
# Ensure worker is built before documentation. add_custom_target(docs DEPENDS ${DOXYGEN_INDEX_FILE})
add_dependencies(docs bootstrap)
# Ensure worker is built before documentation.
add_dependencies(docs bootstrap)
endif()

View File

@ -24,7 +24,7 @@
pname = "bootstrap"; pname = "bootstrap";
src = ./.; src = ./.;
version = "0.1.3"; version = "0.1.3";
nativeBuildInputs = with pkgs; [ cmake ]; nativeBuildInputs = with pkgs; [ cmake doxygen ];
installPhase = '' installPhase = ''
mkdir -p $out/bin mkdir -p $out/bin
cp ./bootstrap $out/bin cp ./bootstrap $out/bin

View File

@ -56,7 +56,7 @@ mkdir -p "$BUILD"/build/{Debug,Release}
# REWRITES # REWRITES
# ============================================================ # ============================================================
for file in flake.nix {,src/,test/}CMakeLists.txt for file in flake.nix {,src/,docs/,test/}CMakeLists.txt
do do
sed -i "s/<NAME>/$NAME/g" "$BUILD/$file" sed -i "s/<NAME>/$NAME/g" "$BUILD/$file"
done done

View File

@ -1,24 +1,28 @@
find_package(Doxygen REQUIRED) find_package(Doxygen REQUIRED)
set(DOXYGEN_INPUT_DIR ${PROJECT_SOURCE_DIR}/include) if(DOXYGEN_FOUND)
set(DOXYGEN_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/doxygen)
set(DOXYGEN_INDEX_FILE ${DOXYGEN_OUTPUT_DIR}/xml/index.xml)
set(DOXYFILE_IN ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in)
set(DOXYFILE_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
configure_file(${DOXYFILE_IN} ${DOXYFILE_OUT} @ONLY) set(DOXYGEN_INPUT_DIR ${PROJECT_SOURCE_DIR}/include)
set(DOXYGEN_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/doxygen)
set(DOXYGEN_INDEX_FILE ${DOXYGEN_OUTPUT_DIR}/xml/index.xml)
set(DOXYFILE_IN ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in)
set(DOXYFILE_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
file(MAKE_DIRECTORY ${DOXYGEN_OUTPUT_DIR}) configure_file(${DOXYFILE_IN} ${DOXYFILE_OUT} @ONLY)
add_custom_command(OUTPUT file(MAKE_DIRECTORY ${DOXYGEN_OUTPUT_DIR})
${DOXYGEN_INDEX_FILE}
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYFILE_OUT}
MAIN_DEPENDENCY ${DOXYFILE_OUT} ${DOXYFILE_IN}
COMMENT "Generating Doxygen documentation"
VERBATIM
)
add_custom_target(docs DEPENDS ${DOXYGEN_INDEX_FILE}) add_custom_command(OUTPUT
${DOXYGEN_INDEX_FILE}
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYFILE_OUT}
MAIN_DEPENDENCY ${DOXYFILE_OUT} ${DOXYFILE_IN}
COMMENT "Generating Doxygen documentation"
VERBATIM
)
# Ensure worker is built before documentation. add_custom_target(docs DEPENDS ${DOXYGEN_INDEX_FILE})
add_dependencies(docs bootstrap)
# Ensure executable is built before documentation.
add_dependencies(docs "<NAME>")
endif()