Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BUILD_DOCS option to enable/disable building documentation. #2730

Merged
merged 4 commits into from
Nov 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
73 changes: 38 additions & 35 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ option(DISABLE_DOWNLOADS "Disable downloads of dependencies during build." OFF)
option(DOWNLOAD_ENSMALLEN "If ensmallen is not found, download it." ON)
option(DOWNLOAD_STB_IMAGE "Download stb_image for image loading." ON)
option(BUILD_GO_SHLIB "Build Go shared library." OFF)
option(BUILD_DOCS "Build doxygen documentation (if doxygen is available)." ON)
Copy link
Member

@zoq zoq Nov 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if the default should be OFF, or if not if we should set WARN_AS_ERROR = NO as default? Until they take a look at: doxygen/doxygen#7818

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, good point, let's set WARN_AS_ERROR to NO by default, but then sed it to ON in the Doxygen build.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 5552b8c.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like a good solution to me.


# Set minimum library version required by mlpack.
set(ARMADILLO_VERSION "8.400.0")
Expand Down Expand Up @@ -617,43 +618,45 @@ add_dependencies(mlpack_headers mlpack_arma_config)

# Make a target to generate the documentation. If Doxygen isn't installed, then
# I guess this option will just be unavailable.
find_package(Doxygen)
if (DOXYGEN_FOUND)
if (MATHJAX)
find_package(MathJax)
if (NOT MATHJAX_FOUND)
message(STATUS "Using MathJax at the MathJax Content Delivery Network. "
"Be careful, formulas will not be shown without the internet.")
if (BUILD_DOCS)
find_package(Doxygen)
if (DOXYGEN_FOUND)
if (MATHJAX)
find_package(MathJax)
if (NOT MATHJAX_FOUND)
message(STATUS "Using MathJax at the MathJax Content Delivery Network. "
"Be careful, formulas will not be shown without the internet.")
endif ()
endif ()
# Preprocess the Doxyfile. This is done before 'make doc'.
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/Doxyfile
PRE_BUILD
COMMAND ${CMAKE_COMMAND}
-D DESTDIR=${CMAKE_BINARY_DIR}
-D MATHJAX="${MATHJAX}"
-D MATHJAX_FOUND="${MATHJAX_FOUND}"
-D MATHJAX_PATH="${MATHJAX_PATH}"
-P "${CMAKE_CURRENT_SOURCE_DIR}/CMake/GenerateDoxyfile.cmake"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile"
COMMENT "Creating Doxyfile to generate Doxygen documentation"
)

# Generate documentation.
add_custom_target(doc
COMMAND "${DOXYGEN_EXECUTABLE}" "${CMAKE_BINARY_DIR}/Doxyfile"
DEPENDS "${CMAKE_BINARY_DIR}/Doxyfile"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
COMMENT "Generating API documentation with Doxygen"
)

install(DIRECTORY "${CMAKE_BINARY_DIR}/doc/html"
DESTINATION "${CMAKE_INSTALL_DOCDIR}"
COMPONENT doc
OPTIONAL
)
endif ()
# Preprocess the Doxyfile. This is done before 'make doc'.
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/Doxyfile
PRE_BUILD
COMMAND ${CMAKE_COMMAND}
-D DESTDIR=${CMAKE_BINARY_DIR}
-D MATHJAX="${MATHJAX}"
-D MATHJAX_FOUND="${MATHJAX_FOUND}"
-D MATHJAX_PATH="${MATHJAX_PATH}"
-P "${CMAKE_CURRENT_SOURCE_DIR}/CMake/GenerateDoxyfile.cmake"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile"
COMMENT "Creating Doxyfile to generate Doxygen documentation"
)

# Generate documentation.
add_custom_target(doc
COMMAND "${DOXYGEN_EXECUTABLE}" "${CMAKE_BINARY_DIR}/Doxyfile"
DEPENDS "${CMAKE_BINARY_DIR}/Doxyfile"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
COMMENT "Generating API documentation with Doxygen"
)

install(DIRECTORY "${CMAKE_BINARY_DIR}/doc/html"
DESTINATION "${CMAKE_INSTALL_DOCDIR}"
COMPONENT doc
OPTIONAL
)
endif ()
endif()

# Create the pkg-config file, if we have pkg-config.
find_package(PkgConfig)
Expand Down
3 changes: 2 additions & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ FILE_VERSION_FILTER =
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_AS_ERROR = YES
# This will be set to YES for the Jenkins doxygen check build.
WARN_AS_ERROR = NO
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = YES
Expand Down
3 changes: 3 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
###### ????-??-??
* Added an implementation to Stratify Data (#2671).

* Add `BUILD_DOCS` CMake option to control whether Doxygen documentation is
built (default ON) (#2730).

### mlpack 3.4.2
###### 2020-10-26
* Added Mean Absolute Percentage Error.
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ Options are specified with the -D flag. The allowed options include:
STB_IMAGE_INCLUDE_DIR=(/path/to/stb/include): path to include directory for
STB image library
USE_OPENMP=(ON/OFF): whether or not to use OpenMP if available
BUILD_DOCS=(ON/OFF): build Doxygen documentation, if Doxygen is available
(default ON)

Other tools can also be used to configure CMake, but those are not documented
here. See [this section of the build guide](https://www.mlpack.org/doc/mlpack-git/doxygen/build.html#build_config)
Expand Down
2 changes: 2 additions & 0 deletions doc/guide/build.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ The full list of options mlpack allows:
- JULIA_EXECUTABLE=(/path/to/julia): Path to specific Julia executable
- BUILD_MARKDOWN_BINDINGS=(ON/OFF): Build Markdown bindings for website
documentation (default OFF)
- BUILD_DOCS=(ON/OFF): build Doxygen documentation, if Doxygen is available
(default ON)
- MATHJAX=(ON/OFF): use MathJax for generated Doxygen documentation (default
OFF)
- FORCE_CXX11=(ON/OFF): assume that the compiler supports C++11 instead of
Expand Down