Skip to content

Commit

Permalink
Drop dependency on YARP, add MkDocs custom target
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterBowman committed Aug 13, 2024
1 parent af277c0 commit 020e758
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
14 changes: 6 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@ cmake_minimum_required(VERSION 3.12)
# Define a project.
project(ROBOTICSLAB_DEVELOPER_MANUAL LANGUAGES NONE)

# Find dependencies
find_package(YCM 0.10 REQUIRED)
find_package(YARP 3.0 REQUIRED)
# Pick up our cmake modules.
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)

# Set some useful variables - paths relative to the installation prefix.
yarp_configure_external_installation(roboticslab-developer-manual)
# Find dependencies.
find_package(YCM 0.10 REQUIRED)

# Install docs, and also create a copy in the local build tree.
yarp_install(DIRECTORY docs
DESTINATION ${ROBOTICSLAB-DEVELOPER-MANUAL_CONTEXTS_INSTALL_DIR})
# Add custom rule to generate and install the MkDocs site.
include(AddMkDocsTarget)

# Store the package in the user registry.
set(CMAKE_EXPORT_PACKAGE_REGISTRY ON)
Expand Down
19 changes: 19 additions & 0 deletions cmake/AddMkDocsTarget.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
include_guard(GLOBAL)

# Find MkDocs
find_program(MKDOCS_ABSPATH NAMES mkdocs)

if(MKDOCS_ABSPATH)
include(GNUInstallDirs)

set(_site_dir ${CMAKE_BINARY_DIR}/site)

# Add a custom target to generate the documentation.
add_custom_target(mkdocs ALL ${MKDOCS_ABSPATH} build --site-dir ${_site_dir}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "Generating MkDocs documentation in ${_site_dir}")

# Install the generated documentation.
install(DIRECTORY ${_site_dir}
DESTINATION ${CMAKE_INSTALL_DOCDIR})
endif()

0 comments on commit 020e758

Please sign in to comment.