Skip to content

Commit

Permalink
Simplifying CMake for building documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
crisluengo committed Feb 2, 2025
1 parent e27b1b1 commit dc13248
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 37 deletions.
3 changes: 3 additions & 0 deletions changelogs/diplib_next.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.




Expand Down
62 changes: 30 additions & 32 deletions doc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand All @@ -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()
6 changes: 3 additions & 3 deletions doc/src/Build/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,16 @@ 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*

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`).

Expand Down
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit dc13248

Please sign in to comment.