From dc13248b285416144f26c9fe64327ee392dbdae9 Mon Sep 17 00:00:00 2001 From: Cris Luengo Date: Sun, 2 Feb 2025 11:43:30 -0700 Subject: [PATCH] Simplifying CMake for building documentation. --- changelogs/diplib_next.md | 3 ++ doc/CMakeLists.txt | 62 ++++++++++++++++------------------ doc/src/Build/documentation.md | 6 ++-- src/CMakeLists.txt | 4 +-- 4 files changed, 38 insertions(+), 37 deletions(-) diff --git a/changelogs/diplib_next.md b/changelogs/diplib_next.md index 8e07b10d..007f5691 100644 --- a/changelogs/diplib_next.md +++ b/changelogs/diplib_next.md @@ -62,6 +62,9 @@ date: 2020-00-00 ### Build changes +- For building the documentation, it no longer is necessary to set the `DOXPP_*_EXECUTABLE` CMake variables, + there is now a single `DIP_DOXPP_PATH` that will tell the CMake where to find all four programs. + diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 74300755..a6ef7450 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -13,42 +13,40 @@ # limitations under the License. -# DIPlib documentation +# The dox++ program +set(DIP_DOXPP_PATH "/Users/cris/src/dox++/" CACHE PATH "Directory to the dox++ program (https://crisluengo.github.io/doxpp/)") + find_program( - DOXPP_PARSE_EXECUTABLE - NAMES dox++parse - PATHS - /Users/cris/src/dox++/ - DOC "dox++ documentation generation tool, parser (https://crisluengo.github.io/doxpp/)" + DOXPP_PARSE_EXECUTABLE + NAMES dox++parse + PATHS ${DIP_DOXPP_PATH} + DOC "dox++ documentation generation tool, parser" ) -mark_as_advanced(DOXPP_PARSE_EXECUTABLE) +mark_as_advanced(FORCE DOXPP_PARSE_EXECUTABLE) find_program( - DOXPP_HTML_EXECUTABLE - NAMES dox++html - PATHS - /Users/cris/src/dox++/ - DOC "dox++ documentation generation tool, HTML generator (https://crisluengo.github.io/doxpp/)" + DOXPP_HTML_EXECUTABLE + NAMES dox++html + PATHS ${DIP_DOXPP_PATH} + DOC "dox++ documentation generation tool, HTML generator" ) -mark_as_advanced(DOXPP_HTML_EXECUTABLE) +mark_as_advanced(FORCE DOXPP_HTML_EXECUTABLE) find_program( - DOXPP_BRIEF_EXECUTABLE - NAMES dox++brief - PATHS - /Users/cris/src/dox++/ - DOC "dox++ documentation generation tool, brief generator (https://crisluengo.github.io/doxpp/)" + DOXPP_BRIEF_EXECUTABLE + NAMES dox++brief + PATHS ${DIP_DOXPP_PATH} + DOC "dox++ documentation generation tool, brief generator" ) -mark_as_advanced(DOXPP_BRIEF_EXECUTABLE) +mark_as_advanced(FORCE DOXPP_BRIEF_EXECUTABLE) find_program( - DOXPP_URLS_EXECUTABLE - NAMES dox++urls - PATHS - /Users/cris/src/dox++/ - DOC "dox++ documentation generation tool, URLs generator (https://crisluengo.github.io/doxpp/)" + DOXPP_URLS_EXECUTABLE + NAMES dox++urls + PATHS ${DIP_DOXPP_PATH} + DOC "dox++ documentation generation tool, URLs generator" ) -mark_as_advanced(DOXPP_URLS_EXECUTABLE) +mark_as_advanced(FORCE DOXPP_URLS_EXECUTABLE) if(DOXPP_PARSE_EXECUTABLE AND DOXPP_HTML_EXECUTABLE AND DOXPP_BRIEF_EXECUTABLE AND DOXPP_URLS_EXECUTABLE) message(STATUS "Found dox++parse: ${DOXPP_PARSE_EXECUTABLE}") @@ -72,12 +70,12 @@ if(DOXPP_FOUND) endif() configure_file("${CMAKE_CURRENT_LIST_DIR}/dox++config.in" "${CMAKE_CURRENT_BINARY_DIR}/dox++config" @ONLY) add_custom_target( - doc - COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_INSTALL_PREFIX}/${DOCUMENTATION_OUTPUT}" - COMMAND "${DOXPP_PARSE_EXECUTABLE}" - COMMAND "${DOXPP_HTML_EXECUTABLE}" - COMMAND "${DOXPP_BRIEF_EXECUTABLE}" - COMMAND "${DOXPP_URLS_EXECUTABLE}" - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + doc + COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_INSTALL_PREFIX}/${DOCUMENTATION_OUTPUT}" + COMMAND "${DOXPP_PARSE_EXECUTABLE}" + COMMAND "${DOXPP_BRIEF_EXECUTABLE}" + COMMAND "${DOXPP_URLS_EXECUTABLE}" + COMMAND "${DOXPP_HTML_EXECUTABLE}" + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" ) endif() diff --git a/doc/src/Build/documentation.md b/doc/src/Build/documentation.md index 179b340f..1c268132 100644 --- a/doc/src/Build/documentation.md +++ b/doc/src/Build/documentation.md @@ -69,8 +69,8 @@ but you can put it in your home directory as well. All that is needed is cloning cd /opt git clone https://github.com/crisluengo/doxpp.git ``` -This will create the directory `/opt/doxpp/`, containing the two executables `dox++parse` and `dox++html`. -We will need to tell *CMake* where to find these tools. +This will create the directory `/opt/doxpp/`, containing the two executables `dox++parse`, `dox++html`, +`dox++brief` and `dox++urls`. We will need to tell *CMake* where to find these tools. \section builddoc_cmake Configuring *CMake* @@ -78,7 +78,7 @@ We will need to tell *CMake* where to find these tools. To set up *CMake* to build the documentation, we need to tell it where the *dox++* programs are. From your *DIPlib* build directory, ```bash -cmake . -DDOXPP_PARSE_EXECUTABLE=/opt/doxpp/dox++parse -DDOXPP_HTML_EXECUTABLE=/opt/doxpp/dox++html +cmake . -DDIP_DOXPP_PATH=/opt/doxpp ``` (obviously substitute your *dox++* path where it says `/opt/doxpp`). diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a266c51c..6541d8e6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -121,8 +121,8 @@ if(DIP_ENABLE_ZLIB) add_subdirectory("${PROJECT_SOURCE_DIR}/dependencies/zlib" "${PROJECT_BINARY_DIR}/zlib" EXCLUDE_FROM_ALL) endif() -# libjpeg (for use in libtiff) -set(DIP_ENABLE_JPEG ON CACHE BOOL "Enable JPEG file support and compression in TIFF") +# libjpeg (also for use in libtiff) +set(DIP_ENABLE_JPEG ON CACHE BOOL "Enable JPEG file support, and compression in TIFF") if(DIP_ENABLE_JPEG) add_subdirectory("${PROJECT_SOURCE_DIR}/dependencies/libjpeg" "${PROJECT_BINARY_DIR}/libjpeg" EXCLUDE_FROM_ALL) target_link_libraries(DIP PRIVATE jpeg)