From a5798eef253702ce352839928ab961beb3c9ba4c Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 23 Oct 2015 14:17:17 -0500 Subject: [PATCH] Check out and process the code-gallery. --- doc/doxygen/CMakeLists.txt | 7 +- doc/doxygen/code-gallery/CMakeLists.txt | 89 +++++++++++++++++++++++++ 2 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 doc/doxygen/code-gallery/CMakeLists.txt diff --git a/doc/doxygen/CMakeLists.txt b/doc/doxygen/CMakeLists.txt index 16405aeb58..4bb688aadd 100644 --- a/doc/doxygen/CMakeLists.txt +++ b/doc/doxygen/CMakeLists.txt @@ -36,10 +36,15 @@ ENDIF() ######################################################################## # -# Process the tutorial files into inputs for doxygen +# Process the tutorial and code-gallery files into inputs for doxygen +# +# The tutorial/CMakeLists.txt file is also responsible for building +# the top-level tutorial pages that may link to the code gallery, +# so we need to have the code gallery stuff in place first. # ######################################################################## +ADD_SUBDIRECTORY(code-gallery) ADD_SUBDIRECTORY(tutorial) diff --git a/doc/doxygen/code-gallery/CMakeLists.txt b/doc/doxygen/code-gallery/CMakeLists.txt new file mode 100644 index 0000000000..ee9a1f17c3 --- /dev/null +++ b/doc/doxygen/code-gallery/CMakeLists.txt @@ -0,0 +1,89 @@ +## --------------------------------------------------------------------- +## +## Copyright (C) 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. +## +## --------------------------------------------------------------------- + + + +# +# A target for the preparation of all the stuff happening in here... +# + +ADD_CUSTOM_TARGET(code-gallery) + + +# +# Define ways to get the code-gallery repository downloaded at +# the time that we call cmake, so that we can subsequently +# use the files that we find during download as inputs for +# doxygen. This has to happen at the time we run cmake because +# doing so at build time is too late for us to set up the +# proper dependencies for the build targets. +# +# To do so, we need to execute git on a command line; this +# (and consequently everything else below) will not work +# on Windows. It will also not work if we can't find a version +# of git +# +FIND_PACKAGE(Git) +IF( (NOT CMAKE_SYSTEM_NAME MATCHES "CYGWIN") + AND + (NOT CMAKE_SYSTEM_NAME MATCHES "Windows") + AND GIT_FOUND ) + + # First update or download the code-gallery repository + IF (IS_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/code-gallery) + MESSAGE(STATUS "Updating code-gallery git repository") + EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} checkout master + COMMAND git pull origin master + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/code-gallery + TIMEOUT 30 + OUTPUT_QUIET + ERROR_QUIET + RESULT_VARIABLE _result) + ELSE() + MESSAGE(STATUS "Cloning code-gallery git repository") + EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} clone https://github.com/bangerth/code-gallery.git + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + TIMEOUT 30 + OUTPUT_QUIET + ERROR_QUIET + RESULT_VARIABLE _result) + ENDIF() + + # See if getting the git repository update succeeded + IF (NOT ${_result}) + MESSAGE(STATUS "Updating code-gallery git repository - Done") + + # Now collect the names of all code gallery projects. To + # do so, find all 'author' files, then strip the last two + # levels of these paths. + # + # For unclear reasons, the glob returns these files as + # "/a/b/c/name//doc//author", so make sure we eat the + # double slashes in the second step + FILE(GLOB _code_gallery_names + "${CMAKE_CURRENT_BINARY_DIR}/code-gallery/*/doc/author") + STRING(REGEX REPLACE "/+doc/+author" "" _code_gallery_names "${_code_gallery_names}") + + # Now set up targets for each of the code gallery programs + + # ...TODO... + + ELSE() + MESSAGE(WARNING "Could not clone or update the code-gallery repository ${_result}") + ENDIF() +ELSE() + MESSAGE(WARNING "Generating the code-gallery documentation is only possible on unix-like systems with 'git' installed.") +ENDIF() + -- 2.39.5