1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
|
#
# $Id: FindXSLTPROC.cmake 32004 2010-02-25 12:30:44Z jmayer $
#
# - Find unix commands from cygwin
# This module looks for some usual Unix commands.
#
INCLUDE(FindCygwin)
FIND_PROGRAM(XSLTPROC_EXECUTABLE
NAMES
xsltproc
PATHS
${CYGWIN_INSTALL_PATH}/bin
/bin
/usr/bin
/usr/local/bin
/sbin
)
# Handle the QUIETLY and REQUIRED arguments and set XSLTPROC_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(XSLTPROC DEFAULT_MSG XSLTPROC_EXECUTABLE)
MARK_AS_ADVANCED(XSLTPROC_EXECUTABLE)
# Translate xml to html
#XML2HTML(
# wsug.validated
# wsug_html/user-guide.html or wsub_html/index.html
# single-page or chunked
# WSUG_FILES
# WSUG_GRAPHICS
#)
MACRO(XML2HTML _validated _output _mode _xmlsources _gfxsources)
FOREACH(_tmpgfx ${${_gfxsources}})
set(_gfx ${_tmpgfx})
BREAK()
ENDFOREACH()
GET_FILENAME_COMPONENT(_GFXDIR ${_gfx} PATH)
GET_FILENAME_COMPONENT(_OUTDIR ${_output} PATH)
SET(_OUTDIR ${CMAKE_CURRENT_BINARY_DIR}/${_OUTDIR})
IF(${_mode} STREQUAL "chunked")
SET(_STYLESHEET "http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl")
ELSE() # single-page
SET(_STYLESHEET "http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl")
ENDIF()
# FIXME: How do I extract the first element of a variable containing a
# list of values? Isn't there a "cleaner" solution?
# Oh, and I have no idea why I can't directly use _source instead of
# having to introduce _tmpsource.
FOREACH(_tmpsource ${${_xmlsources}})
set(_source ${_tmpsource})
BREAK()
ENDFOREACH()
ADD_CUSTOM_COMMAND(
OUTPUT
${_output}
# Fixme: find out about subdirs (i.e. toolbar) automatically
# so this works for wsdg as well.
COMMAND cmake
-E make_directory ${_OUTDIR}/${_GFXDIR}/toolbar
COMMAND cp
${CMAKE_CURRENT_SOURCE_DIR}/${_GFXDIR}/*.* ${_OUTDIR}/${_GFXDIR}/
COMMAND cp
${CMAKE_CURRENT_SOURCE_DIR}/${_GFXDIR}/toolbar/*.* ${_OUTDIR}/${_GFXDIR}/toolbar/
COMMAND cmake
-E copy ${CMAKE_CURRENT_SOURCE_DIR}/ws.css ${_OUTDIR}
COMMAND ${XSLTPROC_EXECUTABLE}
--path "${CMAKE_CURRENT_SOURCE_DIR}:${CMAKE_CURRENT_BINARY_DIR}:${CMAKE_CURRENT_BINARY_DIR}/wsluarm_src"
--stringparam base.dir ${_OUTDIR}/
--stringparam use.id.as.filename 1
--stringparam admon.graphics 1
--stringparam admon.graphics.path ${_GFXDIR}/
--stringparam section.autolabel 1
--stringparam section.label.includes.component.label 1
--stringparam html.stylesheet ws.css
--nonet
--output ${_output}
${_STYLESHEET}
${_source}
COMMAND chmod
-R og+rX ${_OUTDIR}
DEPENDS
${_validated}
${${_xmlsources}}
${${_gfxsources}}
)
ENDMACRO(XML2HTML)
#XML2PDF(
# user-guide-a4.fo or user-guide-us.fo
# WSUG_SOURCE
# custom_layer_pdf.xsl
# A4 or letter
#)
MACRO(XML2PDF _output _sources _stylesheet _paper)
# FIXME: How do I extract the first element of a variable containing a
# list of values? Isn't there a "cleaner" solution?
# Oh, and I have no idea why I can't directly use _source instead of
# having to introduce _tmpsource.
FOREACH(_tmpsource ${${_sources}})
set(_source ${_tmpsource})
BREAK()
ENDFOREACH()
ADD_CUSTOM_COMMAND(
OUTPUT
${_output}
COMMAND ${XSLTPROC_EXECUTABLE}
--path "${CMAKE_CURRENT_SOURCE_DIR}:${CMAKE_CURRENT_BINARY_DIR}:${CMAKE_CURRENT_BINARY_DIR}/wsluarm_src"
--stringparam paper.type ${_paper}
--nonet
--output ${_output}.fo
${_stylesheet}
${_source}
# FIXME: The images for tip, warning and note (and maybe more of those)
# are not found by fop. I have no idea why "system" images don't work
# the way other images work.
COMMAND ${FOP_EXECUTABLE}
${_output}.fo
${_output}
DEPENDS
${${_sources}}
${_stylesheet}
)
ENDMACRO(XML2PDF)
|