From dd637520bf8bf815eb49252b623672f88e5c84a3 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Fri, 10 May 2019 17:11:31 -0400 Subject: [PATCH] Also treat CUDA tutorial steps correctly --- doc/doxygen/scripts/make_step.pl | 19 ++++++++++++++++--- doc/doxygen/scripts/program2doxygen | 2 +- doc/doxygen/tutorial/CMakeLists.txt | 18 ++++++++++++------ 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/doc/doxygen/scripts/make_step.pl b/doc/doxygen/scripts/make_step.pl index d00ca715c8..fcad14aeb0 100644 --- a/doc/doxygen/scripts/make_step.pl +++ b/doc/doxygen/scripts/make_step.pl @@ -58,7 +58,19 @@ system $^X, "$cmake_source_dir/doc/doxygen/scripts/intro2toc", "$cmake_source_di print "
  • The commented program\n"; -system $^X, "$cmake_source_dir/doc/doxygen/scripts/program2toc", "$cmake_source_dir/examples/$step/$step.cc"; +my $file_extension; + +if (-f "$cmake_source_dir/examples/$step/$step.cc") +{ + $file_extension = cc; +} + +if (-f "$cmake_source_dir/examples/$step/$step.cu") +{ + $file_extension = cu; +} + +system $^X, "$cmake_source_dir/doc/doxygen/scripts/program2toc", "$cmake_source_dir/examples/$step/$step.$file_extension"; print "
      @@ -77,13 +89,14 @@ system $^X, "$cmake_source_dir/doc/doxygen/scripts/create_anchors", "$cmake_sour print " * \n"; print " *

      The commented program

      \n"; -system $^X, "$cmake_source_dir/doc/doxygen/scripts/program2doxygen", "$cmake_source_dir/examples/$step/$step.cc"; + +system $^X, "$cmake_source_dir/doc/doxygen/scripts/program2doxygen", "$cmake_source_dir/examples/$step/$step.$file_extension"; system $^X, "$cmake_source_dir/doc/doxygen/scripts/create_anchors", "$cmake_source_dir/examples/$step/doc/results.dox"; print "

      The plain program

      -\@include \"$step.cc\" +\@include \"$step.$file_extension\" */ "; diff --git a/doc/doxygen/scripts/program2doxygen b/doc/doxygen/scripts/program2doxygen index ffb36df9b8..97deaaa04f 100644 --- a/doc/doxygen/scripts/program2doxygen +++ b/doc/doxygen/scripts/program2doxygen @@ -17,7 +17,7 @@ # skip header lines at the top of the file, such as copyright notices # and license information, if the file is a step-xx.cc tutorial. don't # skip for other files such as code-gallery files -if ($ARGV[0] =~ /step-\d+.cc/) +if ($ARGV[0] =~ /step-\d+.[cc|cu]/) { $_ = <>; while ( m!^/\*! || m!\s*\*! || m/^$/ ) { diff --git a/doc/doxygen/tutorial/CMakeLists.txt b/doc/doxygen/tutorial/CMakeLists.txt index 5ac000e9f3..af7d040901 100644 --- a/doc/doxygen/tutorial/CMakeLists.txt +++ b/doc/doxygen/tutorial/CMakeLists.txt @@ -113,16 +113,22 @@ ADD_DEPENDENCIES(tutorial build_tutorial_h) FOREACH(_step ${_deal_ii_steps}) GET_FILENAME_COMPONENT(_step "${_step}" NAME) + IF(EXISTS "${CMAKE_SOURCE_DIR}/examples/${_step}/${_step}.cu") + SET(_FILE_EXTENSION "cu") + ELSE() + SET(_FILE_EXTENSION "cc") + ENDIF() + ADD_CUSTOM_COMMAND( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_step}.cc + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_step}.${_FILE_EXTENSION} COMMAND ${PERL_EXECUTABLE} ARGS ${CMAKE_SOURCE_DIR}/doc/doxygen/scripts/program2plain - < ${CMAKE_SOURCE_DIR}/examples/${_step}/${_step}.cc - > ${CMAKE_CURRENT_BINARY_DIR}/${_step}.cc + < ${CMAKE_SOURCE_DIR}/examples/${_step}/${_step}.${_FILE_EXTENSION} + > ${CMAKE_CURRENT_BINARY_DIR}/${_step}.${_FILE_EXTENSION} DEPENDS ${CMAKE_SOURCE_DIR}/doc/doxygen/scripts/program2plain - ${CMAKE_SOURCE_DIR}/examples/${_step}/${_step}.cc + ${CMAKE_SOURCE_DIR}/examples/${_step}/${_step}.${_FILE_EXTENSION} VERBATIM ) @@ -140,7 +146,7 @@ FOREACH(_step ${_deal_ii_steps}) ${CMAKE_SOURCE_DIR}/doc/doxygen/scripts/intro2toc ${CMAKE_SOURCE_DIR}/doc/doxygen/scripts/create_anchors ${CMAKE_SOURCE_DIR}/doc/doxygen/scripts/program2doxygen - ${CMAKE_SOURCE_DIR}/examples/${_step}/${_step}.cc + ${CMAKE_SOURCE_DIR}/examples/${_step}/${_step}.${_FILE_EXTENSION} ${CMAKE_SOURCE_DIR}/examples/${_step}/doc/intro.dox ${CMAKE_SOURCE_DIR}/examples/${_step}/doc/results.dox ) @@ -148,7 +154,7 @@ FOREACH(_step ${_deal_ii_steps}) ADD_CUSTOM_TARGET(tutorial_${_step} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_step}.h - ${CMAKE_CURRENT_BINARY_DIR}/${_step}.cc + ${CMAKE_CURRENT_BINARY_DIR}/${_step}.${_FILE_EXTENSION} COMMENT "Building doxygen input file for tutorial program <${_step}>" ) -- 2.39.5