From: Wolfgang Bangerth Date: Thu, 31 Dec 2015 04:21:08 +0000 (-0600) Subject: Provide the basic building blocks to hook in the code gallery. X-Git-Tag: v8.4.0-rc2~110^2~11 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=89f5936e413beb3015a1cd147efc9ec20dee6504;p=dealii.git Provide the basic building blocks to hook in the code gallery. In particular, track dependencies and set up a stub for generating doxygen input. --- diff --git a/doc/doxygen/CMakeLists.txt b/doc/doxygen/CMakeLists.txt index c37070dbef..490454dcaf 100644 --- a/doc/doxygen/CMakeLists.txt +++ b/doc/doxygen/CMakeLists.txt @@ -124,6 +124,7 @@ LIST(APPEND _doxygen_depend ${CMAKE_CURRENT_BINARY_DIR}/tutorial/tutorial.h ) +# find all tutorial programs so we can add dependencies as appropriate FILE(GLOB _deal_ii_steps ${CMAKE_SOURCE_DIR}/examples/step-* ) @@ -137,6 +138,26 @@ FOREACH(_step ${_deal_ii_steps}) ) ENDFOREACH() +# Also find all code gallery programs (if available) for the same reason. +# The logic here follows the same as in code-gallery/CMakeLists.txt +SET_IF_EMPTY(DEAL_II_CODE_GALLERY_DIRECTORY ${CMAKE_SOURCE_DIR}/code-gallery) +IF (EXISTS ${DEAL_II_CODE_GALLERY_DIRECTORY}/README.md) + FILE(GLOB _code_gallery_names + "${DEAL_II_CODE_GALLERY_DIRECTORY}/*/doc/author") + STRING(REGEX REPLACE "/+doc/+author" "" _code_gallery_names "${_code_gallery_names}") + + FOREACH(_step ${_code_gallery_names}) + GET_FILENAME_COMPONENT(_step "${_step}" NAME) + + LIST(APPEND _doxygen_depend + ${CMAKE_CURRENT_BINARY_DIR}/code-gallery/${_step}.h + ) + LIST(APPEND _doxygen_input + ${CMAKE_CURRENT_BINARY_DIR}/code-gallery/${_step}.h + ) + ENDFOREACH() +ENDIF() + TO_STRING(_doxygen_image_path_string ${_doxygen_image_path}) TO_STRING(_doxygen_input_string ${_doxygen_input}) @@ -162,6 +183,7 @@ ADD_CUSTOM_COMMAND( WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} DEPENDS tutorial + code-gallery ${CMAKE_CURRENT_BINARY_DIR}/options.dox ${CMAKE_CURRENT_BINARY_DIR}/header.html ${CMAKE_CURRENT_BINARY_DIR}/footer.html diff --git a/doc/doxygen/code-gallery/CMakeLists.txt b/doc/doxygen/code-gallery/CMakeLists.txt index 490d76a0aa..55e02a94f4 100644 --- a/doc/doxygen/code-gallery/CMakeLists.txt +++ b/doc/doxygen/code-gallery/CMakeLists.txt @@ -46,7 +46,35 @@ IF (EXISTS ${DEAL_II_CODE_GALLERY_DIRECTORY}/README.md) # Now set up targets for each of the code gallery programs - # ...TODO... + FOREACH(_step ${_code_gallery_names}) + GET_FILENAME_COMPONENT(_step "${_step}" NAME) + MESSAGE(STATUS " Setting up ${_step}") + + # get all source files so we can properly describe the dependencies + FILE(GLOB_RECURSE _src_files *) + + ADD_CUSTOM_COMMAND( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_step}.h + COMMAND ${PERL_EXECUTABLE} + ARGS + ${CMAKE_SOURCE_DIR}/doc/doxygen/scripts/make_gallery.pl + ${_step} ${CMAKE_SOURCE_DIR} + > ${CMAKE_CURRENT_BINARY_DIR}/${_step}.h + WORKING_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS + ${CMAKE_SOURCE_DIR}/doc/doxygen/scripts/make_gallery.pl + ${_src_files} + ) + + ADD_CUSTOM_TARGET(code-gallery_${_step} + DEPENDS + ${CMAKE_CURRENT_BINARY_DIR}/${_step}.h + ) + ADD_DEPENDENCIES(code-gallery code-gallery_${_step}) + + + ENDFOREACH() ELSE() MESSAGE(STATUS "Generating the code-gallery documentation is only possible if the code gallery exists in ${DEAL_II_CODE_GALLERY_DIRECTORY}.") diff --git a/doc/doxygen/scripts/make_gallery.pl b/doc/doxygen/scripts/make_gallery.pl new file mode 100644 index 0000000000..a72a97cf52 --- /dev/null +++ b/doc/doxygen/scripts/make_gallery.pl @@ -0,0 +1,39 @@ +## --------------------------------------------------------------------- +## +## Copyright (C) 2013, 2015 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. +## +## --------------------------------------------------------------------- + +if ($#ARGV != 1) { + print "\nUsage: make_gallery.pl gallery cmake_source_dir\n"; + exit; +} + +$gallery=$ARGV[0]; +$gallery_underscore=$gallery; +$gallery_underscore=~ s/-/_/; + +$cmake_source_dir=$ARGV[1]; + +print +"/** + * \@page code_gallery_$gallery_underscore The $gallery code gallery program +\@htmlonly + + +
Table of contents
+\@endhtmlonly +"; + +print +"*/ +";