aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorBen Hutchings <benh@debian.org>2022-07-31 04:11:08 +0200
committerSimon Tatham <anakin@pobox.com>2022-08-01 18:41:10 +0100
commit9c13279938cfdd3f85a83c3f9ab1714a5a9164ae (patch)
treeecf8054898c70a0d8570c92628bde63fee5dcaae /cmake
parent8399cff6a3b9bf15c6d1d9e0c905d1411f25f9b8 (diff)
downloadpuzzles-9c13279938cfdd3f85a83c3f9ab1714a5a9164ae.zip
puzzles-9c13279938cfdd3f85a83c3f9ab1714a5a9164ae.tar.gz
puzzles-9c13279938cfdd3f85a83c3f9ab1714a5a9164ae.tar.bz2
puzzles-9c13279938cfdd3f85a83c3f9ab1714a5a9164ae.tar.xz
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
Diffstat (limited to 'cmake')
-rw-r--r--cmake/platforms/unix.cmake23
1 files changed, 23 insertions, 0 deletions
diff --git a/cmake/platforms/unix.cmake b/cmake/platforms/unix.cmake
index 09eed6a..344ca99 100644
--- a/cmake/platforms/unix.cmake
+++ b/cmake/platforms/unix.cmake
@@ -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()