@@ -65,7 +65,18 @@ if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
6565 endif ()
6666elseif ((CMAKE_Fortran_COMPILER_ID STREQUAL "NVHPC" ) OR (CMAKE_Fortran_COMPILER_ID STREQUAL "PGI" ))
6767 if (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 21.7)
68- message (FATAL_ERROR "${__err_msg} ERROR: NVHPC v21.7 or newer is required to build MFC." )
68+ message (FATAL_ERROR "${__err_msg} ERROR: When using NVHPC, v21.7 or newer is required to build MFC." )
69+ endif ()
70+ if (MAKE_BUILD_TYPE STREQUAL "Debug" )
71+ if (MFC_OpenACC)
72+ if (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 23.0)
73+ message (FATAL_ERROR "${__err_msg} ERROR: When using NVHPC, v23.0 or newer is required to build MFC with Debug and GPU options." )
74+ endif ()
75+ else ()
76+ if (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 23.8)
77+ message (FATAL_ERROR "${__err_msg} ERROR: Debug is not working with NVHPC 23.X and older and CPU options at present." )
78+ endif ()
79+ endif ()
6980 endif ()
7081elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_C_COMPILER_ID STREQUAL "AppleClang" )
7182 message (FATAL_ERROR "${__err_msg} ERROR: MFC does not support the Apple Clang compilers. Please consult the documentation." )
@@ -145,7 +156,7 @@ elseif ((CMAKE_Fortran_COMPILER_ID STREQUAL "NVHPC") OR (CMAKE_Fortran_COMPILER_
145156 endif ()
146157
147158 if (CMAKE_BUILD_TYPE STREQUAL "Debug" )
148- add_compile_options (-C -g -traceback -Mchkptr -Mchkstk -Minform=inform -Mbounds)
159+ add_compile_options (-C -g -O0 - traceback -Mchkptr -Mchkstk -Minform=inform -Mbounds)
149160 endif ()
150161endif ()
151162
@@ -229,6 +240,8 @@ macro(HANDLE_SOURCES target useCommon)
229240 set (${target} _DIR "${CMAKE_SOURCE_DIR} /src/${target} " )
230241 set (common_DIR "${CMAKE_SOURCE_DIR} /src/common" )
231242
243+ string (TOUPPER ${target} ${target} _UPPER)
244+
232245 # Gather src/[<target>,common]/*.f90
233246 file (GLOB ${target} _F90s CONFIGURE_DEPENDS "${${target} _DIR}/*.f90" )
234247 set (${target} _SRCs ${${target} _F90s})
@@ -245,9 +258,9 @@ macro(HANDLE_SOURCES target useCommon)
245258 endif ()
246259
247260 # Locate src/[<target>,common]/include/*.fpp
248- if ( EXISTS "${${target} _DIR}/include" )
249- file (GLOB ${target} _incs CONFIGURE_DEPENDS "${${target} _DIR }/include/*.fpp" )
250- endif ()
261+ file (GLOB ${target} _incs CONFIGURE_DEPENDS "${${target} _DIR}/include/*.fpp"
262+ "${CMAKE_CURRENT_BINARY_DIR } /include/*.fpp" )
263+
251264 if (${useCommon} )
252265 file (GLOB common_incs CONFIGURE_DEPENDS "${common_DIR} /include/*.fpp" )
253266 list (APPEND ${target} _incs ${common_incs} )
@@ -261,11 +274,14 @@ macro(HANDLE_SOURCES target useCommon)
261274 add_custom_command (
262275 OUTPUT ${f90}
263276 COMMAND ${FYPP_EXE} -m re
264- -I "${common_DIR} "
265- -I "${common_DIR} /include"
277+ -I "${CMAKE_CURRENT_BINARY_DIR} /include"
266278 -I "${${target} _DIR}/include"
279+ -I "${common_DIR} /include"
280+ -I "${common_DIR} "
267281 -D MFC_${CMAKE_Fortran_COMPILER_ID}
282+ -D MFC_${${target} _UPPER}
268283 -D MFC_COMPILER="${CMAKE_Fortran_COMPILER_ID} "
284+ -D MFC_CASE_OPTIMIZATION=False
269285 --line-numbering
270286 --no -folding
271287 "${fpp} " "${f90} "
@@ -317,10 +333,10 @@ function(MFC_SETUP_TARGET)
317333 "${CMAKE_SOURCE_DIR} /src/${ARGS_TARGET} /include" )
318334 endif ()
319335
320- string (TOUPPER "${ARGS_TARGET} " ARGS_TARGET_UPPER )
336+ string (TOUPPER "${ARGS_TARGET} " ${ARGS_TARGET} _UPPER )
321337 target_compile_definitions (
322338 ${ARGS_TARGET} PRIVATE MFC_${CMAKE_Fortran_COMPILER_ID}
323- MFC_${ARGS_TARGET_UPPER }
339+ MFC_${${ARGS_TARGET} _UPPER }
324340 )
325341
326342 if (MFC_MPI AND ARGS_MPI)
@@ -430,6 +446,19 @@ if (MFC_SYSCHECK)
430446endif ()
431447
432448if (MFC_DOCUMENTATION)
449+ # Files in docs/examples are used to generate docs/documentation/examples.md
450+ file (GLOB_RECURSE examples_DOCs CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR} /docs/examples/*" )
451+
452+ add_custom_command (
453+ OUTPUT "${CMAKE_CURRENT_SOURCE_DIR} /docs/documentation/examples.md"
454+ DEPENDS "${examples_DOCs} "
455+ COMMAND "bash" "${CMAKE_CURRENT_SOURCE_DIR} /docs/examples.sh"
456+ "${CMAKE_CURRENT_SOURCE_DIR} "
457+ COMMENT "Generating examples.md"
458+ )
459+
460+ file (GLOB common_DOCs CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR} /docs/*" )
461+
433462 # GEN_DOCS: Given a target name (herein <target>), this macro sets up a
434463 # target, <target>_docs, that generates documentation for <target> using
435464 # Doxygen. It is then added as a dependency of the documentation target.
@@ -456,13 +485,20 @@ if (MFC_DOCUMENTATION)
456485 "${CMAKE_CURRENT_SOURCE_DIR} /docs/Doxyfile.in"
457486 "${CMAKE_CURRENT_BINARY_DIR} /${target} -Doxyfile" @ONLY)
458487
488+ set (opt_example_dependency "" )
489+ if (target STREQUAL "documentation" )
490+ set (opt_example_dependency "${CMAKE_CURRENT_SOURCE_DIR} /docs/documentation/examples.md" )
491+ endif ()
492+
493+ file (GLOB_RECURSE ${target} _DOCs CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR} /docs/${target} /*" )
494+ list (APPEND ${target} _DOCs "${common_DOCs} " )
495+
459496 add_custom_command (
460497 OUTPUT "${CMAKE_CURRENT_BINARY_DIR} /${target} /html/index.html"
461498 DEPENDS "${CMAKE_CURRENT_BINARY_DIR} /${target} -Doxyfile"
462- "${${target} _SRCs}"
463- COMMAND "bash" "${CMAKE_CURRENT_SOURCE_DIR} /docs/examples.sh"
464- "${CMAKE_CURRENT_SOURCE_DIR} " &&
465- "${DOXYGEN_EXECUTABLE} " "${target} -Doxyfile"
499+ "${opt_example_dependency} "
500+ "${${target} _SRCs}" "${${target} _DOCs}"
501+ COMMAND "${DOXYGEN_EXECUTABLE} " "${target} -Doxyfile"
466502 WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR} "
467503 COMMENT "${target} : Generating documentation"
468504 )
@@ -487,7 +523,7 @@ if (MFC_DOCUMENTATION)
487523 ExternalProject_Add(doxygen-awesome-css
488524 PREFIX doxygen-awesome-css
489525 GIT_REPOSITORY "https://github.com/jothepro/doxygen-awesome-css"
490- GIT_TAG "df83fbf22cfff76b875c13d324baf584c74e96d0 "
526+ GIT_TAG "df88fe4fdd97714fadfd3ef17de0b4401f804052 "
491527 CONFIGURE_COMMAND ""
492528 BUILD_COMMAND ""
493529 INSTALL_COMMAND ""
0 commit comments