unix, gtk: Install and use HTML help

- Generate HTML pages from the manual, and install them
- Add "Contents" and "Help on <name>" menu items that will open the
  appropriate page in a web browser
This commit is contained in:
Ben Hutchings
2022-07-31 04:11:08 +02:00
committed by Simon Tatham
parent 8399cff6a3
commit 9c13279938
2 changed files with 115 additions and 0 deletions

View File

@ -12,6 +12,11 @@ in a crowded bin directory, e.g. \"sgt-\"")
find_package(PkgConfig REQUIRED)
find_program(HALIBUT halibut)
if(NOT HALIBUT)
message(WARNING "HTML documentation cannot be built (did not find halibut)")
endif()
set(PUZZLES_GTK_FOUND FALSE)
macro(try_gtk_package VER PACKAGENAME)
if(NOT PUZZLES_GTK_FOUND AND
@ -52,6 +57,8 @@ if(STRICT AND (CMAKE_C_COMPILER_ID MATCHES "GNU" OR
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wwrite-strings -std=c99 -pedantic -Werror")
endif()
add_compile_definitions(HELP_DIR="${CMAKE_INSTALL_PREFIX}/share/sgt-puzzles/help")
function(get_platform_puzzle_extra_source_files OUTVAR NAME)
if(build_icons AND EXISTS ${CMAKE_SOURCE_DIR}/icons/${NAME}.sav)
# If we have the equipment to rebuild the puzzles' icon images
@ -107,4 +114,20 @@ function(set_platform_puzzle_target_properties NAME TARGET)
endfunction()
function(build_platform_extras)
if(HALIBUT)
set(help_dir ${CMAKE_CURRENT_BINARY_DIR}/help)
add_custom_command(OUTPUT ${help_dir}/en
COMMAND ${CMAKE_COMMAND} -E make_directory ${help_dir}/en)
add_custom_command(OUTPUT ${help_dir}/en/index.html
COMMAND ${HALIBUT} --html ${CMAKE_CURRENT_SOURCE_DIR}/puzzles.but
DEPENDS
${help_dir}/en
${CMAKE_CURRENT_SOURCE_DIR}/puzzles.but
WORKING_DIRECTORY ${help_dir}/en)
add_custom_target(unix_help ALL
DEPENDS ${help_dir}/en/index.html)
install(DIRECTORY ${help_dir}
DESTINATION share/sgt-puzzles)
endif()
endfunction()