You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
2.3 KiB

  1. set( TARGET manual )
  2. set( TARGET_ROOT ${CMAKE_SOURCE_DIR}/manual )
  3. message( STATUS "========== Configuring ${TARGET} ==========" )
  4. def_vars()
  5. if( NOT DEFINED PYTHON )
  6. message( WARNING "Python not found...unable to produce manual." )
  7. return()
  8. endif()
  9. set( host "alphamanual.audacityteam.org" )
  10. set( src "https://${host}/man" )
  11. set( dst "${_DEST}/help/manual" )
  12. set( script_dir "${CMAKE_SOURCE_DIR}/scripts/mw2html_audacity" )
  13. set( script "mw2html.py" )
  14. set( out_dir "${_INTDIR}" )
  15. set( out "${out_dir}/${host}/index.html" )
  16. add_custom_command(
  17. COMMENT
  18. "Downloading manual from: ${src}"
  19. COMMAND
  20. "${PYTHON}" "${script_dir}/${script}" -s "${src}" "${out_dir}"
  21. COMMAND
  22. ${CMAKE_COMMAND} -E copy_directory "${out_dir}/${host}" "${dst}"
  23. WORKING_DIRECTORY
  24. "${script_dir}"
  25. OUTPUT
  26. "${out}"
  27. )
  28. add_custom_target( ${TARGET} DEPENDS "${out}" )
  29. if( ${_OPT}package_manual )
  30. install(CODE " \
  31. execute_process( \
  32. COMMAND \
  33. ${CMAKE_COMMAND} \
  34. --build ${CMAKE_BINARY_DIR} \
  35. --config \${CMAKE_INSTALL_CONFIG_NAME} \
  36. --target manual \
  37. ) \
  38. ")
  39. install( DIRECTORY "${out_dir}/${host}/" DESTINATION "help/manual" )
  40. endif()
  41. if( NOT CMAKE_SYSTEM_NAME MATCHES "Darwin" )
  42. if( NOT WIN32)
  43. install( DIRECTORY "${dst}" OPTIONAL
  44. DESTINATION "${_DATADIR}/tenacity/help" )
  45. install( FILES "${_SRCDIR}/org.tenacityaudio.Tenacity.metainfo.xml"
  46. DESTINATION "${_DATADIR}/metainfo" )
  47. endif()
  48. endif()
  49. # Test if scdoc is installed
  50. find_program(SCDOC_CMD scdoc)
  51. cmake_dependent_option(BUILD_MANPAGE "Build manpage" ON "NOT SCDOC_CMD STREQUAL SCDOC_CMD-NOTFOUND" OFF)
  52. if( BUILD_MANPAGE )
  53. add_custom_command( COMMENT "Generating manpage"
  54. COMMAND ${SCDOC_CMD} < "${_SRCDIR}/tenacity.1.scd" > "${CMAKE_BINARY_DIR}/help/tenacity.1"
  55. DEPENDS "${_SRCDIR}/tenacity.1.scd"
  56. OUTPUT "${CMAKE_BINARY_DIR}/help/tenacity.1" )
  57. add_custom_target( gen_manpage ALL DEPENDS "${CMAKE_BINARY_DIR}/help/tenacity.1")
  58. install( FILES "${CMAKE_BINARY_DIR}/help/tenacity.1"
  59. DESTINATION "${_MANDIR}/man1" )
  60. endif()