1############################################################################# 2## Kwave - cmake/KwaveHandbook.cmake 3## ------------------- 4## begin : Wed Feb 18 2015 5## copyright : (C) 2015 by Thomas Eschenbacher 6## email : Thomas.Eschenbacher@gmx.de 7############################################################################# 8# 9############################################################################# 10# # 11# Redistribution and use in source and binary forms, with or without # 12# modification, are permitted provided that the following conditions # 13# are met: # 14# # 15# 1. Redistributions of source code must retain the above copyright # 16# notice, this list of conditions and the following disclaimer. # 17# 2. Redistributions in binary form must reproduce the above copyright # 18# notice, this list of conditions and the following disclaimer in the # 19# documentation and/or other materials provided with the distribution. # 20# # 21# For details see the accompanying cmake/COPYING-CMAKE-SCRIPTS file. # 22# # 23############################################################################# 24 25# auto detect this language (to make this file re-usable) 26GET_FILENAME_COMPONENT(_lang ${CMAKE_CURRENT_SOURCE_DIR} NAME_WE) 27 28# /usr/share/help/de/kdoctools5-common 29SET(_common_dir ${CMAKE_INSTALL_PREFIX}/share/help/${_lang}/kdoctools5-common) 30SET(_common_en_dir ${CMAKE_INSTALL_PREFIX}/share/help/en/kdoctools5-common) 31SET(_html_dir ${CMAKE_BINARY_DIR}/doc/html/${_lang}) 32 33############################################################################# 34### png files with the toolbar icons ### 35 36FILE(GLOB _toolbar_icons "${CMAKE_SOURCE_DIR}/kwave/toolbar/*.svgz") 37FOREACH(_toolbar_icon ${_toolbar_icons}) 38 GET_FILENAME_COMPONENT(_svgz_file ${_toolbar_icon} NAME) 39 STRING(REPLACE "sc-actions-" "" _svgz_file_base ${_svgz_file}) 40 STRING(REPLACE ".svgz" ".png" _png_file ${_svgz_file_base}) 41 SET(_toolbar_png ${CMAKE_CURRENT_BINARY_DIR}/toolbar_${_png_file}) 42 SVG2PNG(${_toolbar_icon} ${_toolbar_png} ${_png_file}) 43 SET(_toolbar_pngs "${_toolbar_pngs}" "${_toolbar_png}") 44ENDFOREACH(_toolbar_icon ${_toolbar_icons}) 45 46############################################################################# 47### "make html_doc" ### 48 49FILE(GLOB _docbook_files "${CMAKE_CURRENT_SOURCE_DIR}/*.docbook") 50FILE(GLOB _png_files "${CMAKE_SOURCE_DIR}/doc/${_lang}/*.png") 51GET_TARGET_PROPERTY(MEINPROC_EXECUTABLE ${KDOCTOOLS_MEINPROC_EXECUTABLE} LOCATION) 52 53ADD_CUSTOM_TARGET(html_doc_${_lang} 54 COMMENT "Generating HTML documentation for ${_lang}" 55 DEPENDS ${_toolbar_pngs} 56 DEPENDS ${_docbook_files} 57 # start with an empty output (_html_dir) 58 COMMAND ${CMAKE_COMMAND} -E remove_directory ${_html_dir} 59 COMMAND ${CMAKE_COMMAND} -E make_directory ${_html_dir} 60 # create the HTML pages from docbook 61 COMMAND cd ${_html_dir} && ${MEINPROC_EXECUTABLE} 62 --check ${CMAKE_CURRENT_SOURCE_DIR}/index.docbook 63 # copy the screenshots and converted toolbar icons 64 COMMAND test -z \"${_png_files}\" || ${CP_EXECUTABLE} ${_png_files} ${_html_dir} 65 COMMAND ${CP_EXECUTABLE} ${_toolbar_pngs} ${_html_dir} 66 # take missing images from the English source directory 67 COMMAND ${CP_EXECUTABLE} -n ${CMAKE_SOURCE_DIR}/doc/en/*.png ${_html_dir} 68 # copy files for the "common" directory 69 COMMAND ${CMAKE_COMMAND} -E make_directory ${_html_dir}/common 70 COMMAND ${CP_EXECUTABLE} ${_common_dir}/* ${_html_dir}/common/ 71 COMMAND ${CP_EXECUTABLE} -n ${_common_en_dir}/* ${_html_dir}/common/ 72 # fix wrong paths in the HTML pages 73 COMMAND cd ${_html_dir} && ${CMAKE_SOURCE_DIR}/doc/fix-common 74 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} 75) 76 77ADD_DEPENDENCIES(html_doc html_doc_${_lang}) 78 79############################################################################# 80### generate and install the icons ### 81 82ADD_CUSTOM_TARGET(generate_icons_${_lang} 83 ALL 84 DEPENDS ${_toolbar_pngs} 85 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} 86) 87INSTALL(FILES 88 ${_toolbar_pngs} 89 DESTINATION ${HTML_INSTALL_DIR}/${_lang}/kwave/ 90) 91 92############################################################################# 93### generate the handbook, KDE environment ### 94 95KDOCTOOLS_CREATE_HANDBOOK( 96 index.docbook 97 INSTALL_DESTINATION ${HTML_INSTALL_DIR}/${_lang} 98 SUBDIR kwave 99) 100 101############################################################################# 102############################################################################# 103