Home | History | Annotate | Download | only in doc
      1 find_package(Doxygen)
      2 
      3 if(DOXYGEN_EXECUTABLE)
      4   OPTION(DBUS_ENABLE_DOXYGEN_DOCS "build DOXYGEN documentation (requires Doxygen)" ON)
      5 endif(DOXYGEN_EXECUTABLE)
      6 
      7 if (DBUS_ENABLE_DOXYGEN_DOCS)
      8     set (top_srcdir ${CMAKE_SOURCE_DIR}/..)
      9     configure_file(${CMAKE_SOURCE_DIR}/Doxyfile.cmake ${CMAKE_BINARY_DIR}/Doxyfile )
     10     add_custom_target(doc 
     11         COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/Doxyfile
     12     )
     13 endif (DBUS_ENABLE_DOXYGEN_DOCS)
     14 
     15 #
     16 # find docbook generator
     17 # 
     18 find_program(MEINPROC4_EXECUTABLE meinproc4)
     19 
     20 find_program(XMLTO_EXECUTABLE xmlto)
     21 
     22 if (MEINPROC4_EXECUTABLE OR XMLTO_EXECUTABLE)
     23   OPTION(DBUS_ENABLE_XML_DOCS "build XML  documentation (requires xmlto or meinproc4)" ON)
     24 endif (MEINPROC4_EXECUTABLE OR XMLTO_EXECUTABLE)
     25 
     26 if (MEINPROC4_EXECUTABLE)
     27 	set(DOCBOOK_GENERATOR_NAME "meinproc4" PARENT_SCOPE)
     28 	set(DBUS_XML_DOCS_ENABLED 1)
     29 	if(WIN32)
     30 		get_filename_component(_a ${MEINPROC4_EXECUTABLE} PATH)
     31 		get_filename_component(_meinproc_install_path ${_a} PATH)
     32 	else(WIN32)
     33 		set(_meinproc_install_path ${CMAKE_INSTALL_PREFIX})
     34 	endif(WIN32)
     35 	set(STYLESHEET "${_meinproc_install_path}/share/apps/ksgmltools2/docbook/xsl/html/docbook.xsl")
     36 endif (MEINPROC4_EXECUTABLE)
     37   
     38  
     39 if (XMLTO_EXECUTABLE)
     40 	set (DOCBOOK_GENERATOR_NAME "xmlto" PARENT_SCOPE)
     41 	set(DBUS_XML_DOCS_ENABLED 1)
     42 	MESSAGE(STATUS "xmlto docbook generator found")
     43 endif (XMLTO_EXECUTABLE)
     44 
     45 if (DBUS_ENABLE_XML_DOCS)
     46 
     47 macro (DOCBOOK _sources _options)
     48   get_filename_component(_infile ${_sources} ABSOLUTE)
     49   get_filename_component(_basename ${_infile} NAME_WE)
     50   set(_outfile ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.html)
     51 
     52   if (EXISTS ${_sources})
     53 	  if (MEINPROC4_EXECUTABLE)
     54 		  ADD_CUSTOM_TARGET(${_basename}.html ALL
     55 			${MEINPROC4_EXECUTABLE} --stylesheet ${STYLESHEET} -o ${_outfile} ${_infile} 
     56 			DEPENDS ${_infile} 
     57 			WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
     58 		)
     59 	  endif ()
     60 	  if (XMLTO_EXECUTABLE)
     61 		  ADD_CUSTOM_TARGET(${_basename}.html ALL
     62 			${XMLTO_EXECUTABLE} -vv ${_options} ${_infile} 
     63 			DEPENDS ${_infile} 
     64 			WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
     65 		)
     66 	  endif ()
     67 	  install(FILES ${_outfile} DESTINATION share/doc/dbus)
     68   else ()
     69 	  MESSAGE(STATUS "skipping xml doc generating for ${_infile}, file not found")
     70   endif ()
     71 	  
     72 endmacro (DOCBOOK)
     73 
     74 ### copy tests to builddir so that generated tests and static tests 
     75 ### are all in one place.
     76 ### todo how to add more filetypes 
     77 MACRO (COPYDIR _src _type)
     78     FOREACH(FILE_TYPE ${_type})
     79     	FOREACH(DIR ${_src})
     80     		FILE(GLOB FILES "${CMAKE_SOURCE_DIR}/../${DIR}/${FILE_TYPE}" )
     81     		FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${DIR})
     82     		FOREACH(FILE ${FILES})
     83     			GET_FILENAME_COMPONENT(FILENAME ${FILE} NAME)
     84     			SET (TARGET ${CMAKE_BINARY_DIR}/${DIR}/${FILENAME})
     85     			configure_file(${FILE} ${TARGET} COPYONLY)
     86     			IF (CONFIG_VERBOSE)
     87     				MESSAGE("FROM: ${FILE}\nTO: ${TARGET}\n")
     88     			ENDIF (CONFIG_VERBOSE)
     89     		ENDFOREACH(FILE)
     90     	ENDFOREACH(DIR)
     91     ENDFOREACH(FILE_TYPE)
     92 ENDMACRO (COPYDIR)
     93 
     94 COPYDIR(doc *.png)
     95 COPYDIR(doc *.svg)
     96 
     97 DOCBOOK(${CMAKE_SOURCE_DIR}/../doc/dbus-test-plan.xml html-nochunks)
     98 DOCBOOK(${CMAKE_SOURCE_DIR}/../doc/dbus-tutorial.xml html-nochunks)
     99 DOCBOOK(${CMAKE_SOURCE_DIR}/../doc/dbus-specification.xml html-nochunks)
    100 DOCBOOK(${CMAKE_SOURCE_DIR}/../doc/dbus-faq.xml html-nochunks)
    101 DOCBOOK(${CMAKE_SOURCE_DIR}/bus/dbus-daemon.xml html-nochunks)
    102 DOCBOOK(${CMAKE_SOURCE_DIR}/tools/dbus-monitor.xml html-nochunks)
    103 DOCBOOK(${CMAKE_SOURCE_DIR}/tools/dbus-send.xml html-nochunks)
    104 DOCBOOK(${CMAKE_SOURCE_DIR}/tools/dbus-launch.xml html-nochunks)
    105 
    106 #
    107 # handle html index file
    108 #
    109 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/index.html.cmake ${CMAKE_CURRENT_BINARY_DIR}/index.html )
    110 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/index.html DESTINATION share/doc/dbus)
    111 
    112 set (EXTRA_DIST 	
    113 	${CMAKE_SOURCE_DIR}/../doc/busconfig.dtd			
    114 	${CMAKE_SOURCE_DIR}/../doc/introspect.dtd			
    115 	${CMAKE_SOURCE_DIR}/../doc/introspect.xsl
    116 )
    117 
    118 install(FILES ${EXTRA_DIST} DESTINATION share/doc/dbus)
    119 
    120 endif(DBUS_ENABLE_XML_DOCS)
    121