From: Wolfgang Bangerth Date: Wed, 24 May 2023 17:50:32 +0000 (-0600) Subject: Suppress 'requires' clauses for doxygen if doxygen is too old. X-Git-Tag: v9.5.0-rc1~185^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba7ce78e98f6f857f642e10672b294fed1451ed7;p=dealii.git Suppress 'requires' clauses for doxygen if doxygen is too old. --- diff --git a/doc/doxygen/CMakeLists.txt b/doc/doxygen/CMakeLists.txt index fe8c67820c..ddec30ab9b 100644 --- a/doc/doxygen/CMakeLists.txt +++ b/doc/doxygen/CMakeLists.txt @@ -32,6 +32,8 @@ if(NOT DOXYGEN_FOUND) message(FATAL_ERROR "Could not find doxygen which is required for building the documentation" ) +else() + message(STATUS "Using doxygen version ${DOXYGEN_VERSION}") endif() @@ -285,6 +287,22 @@ if(NOT (${DOXYGEN_VERSION} VERSION_LESS 1.9)) endif() +# doxygen version 1.9.1 can not correctly parse C++20-style 'requires' +# clauses and just drops certain classes and shows documentation for +# DEAL_II_CXX20_REQUIRES instead. 1.9.7 gets this right, but has other +# bugs. It's unclear for versions inbetween. Err on the safe side, and +# only make them visible to doxygen if we have at least 1.9.8. +if(${DOXYGEN_VERSION} VERSION_LESS 1.9.8) + message(STATUS "Suppressing 'requires' clause parsing because doxygen is too old") + file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/options.dox" + " + PREDEFINED += DEAL_II_DOXYGEN_DO_NOT_PARSE_REQUIRES_CLAUSES=1 + PREDEFINED += DEAL_II_CXX20_REQUIRES(x)= + " + ) +endif() + + ######################################################################## # diff --git a/doc/doxygen/options.dox.in b/doc/doxygen/options.dox.in index 9af33e6510..963ace9cbe 100644 --- a/doc/doxygen/options.dox.in +++ b/doc/doxygen/options.dox.in @@ -186,7 +186,6 @@ PREDEFINED = DOXYGEN=1 \ DEAL_II_HOST_DEVICE= \ DEAL_II_ALWAYS_INLINE= \ __device__= \ - DEAL_II_CXX20_REQUIRES(x)= \ DEAL_II_WITH_ADOLC=1 \ DEAL_II_ADOLC_WITH_ADVANCED_BRANCHING=1 \ DEAL_II_ADOLC_WITH_ATRIG_ERF=1 \ diff --git a/include/deal.II/base/config.h.in b/include/deal.II/base/config.h.in index 6cf17cf239..350e38efcd 100644 --- a/include/deal.II/base/config.h.in +++ b/include/deal.II/base/config.h.in @@ -156,7 +156,7 @@ * define a convenience macro that allows us to write a 'requires' * clause that is simply removed when not using C++20. */ -#ifdef DEAL_II_HAVE_CXX20 +#if defined(DEAL_II_HAVE_CXX20) && !defined(DEAL_II_DOXYGEN_DO_NOT_PARSE_REQUIRES_CLAUSES) # define DEAL_II_CXX20_REQUIRES(condition) requires(condition) #else # define DEAL_II_CXX20_REQUIRES(condition)