From 47068f9dff5db3f1a238d4713c708214040ad4ec Mon Sep 17 00:00:00 2001 From: leggett Date: Wed, 20 Nov 2024 12:54:57 -0800 Subject: [PATCH 1/3] State partial support for NVHPC compiler (nvc++) --- cmake/modules/CheckCompiler.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmake/modules/CheckCompiler.cmake b/cmake/modules/CheckCompiler.cmake index 883bf0e2daed1..74b8507c8edad 100644 --- a/cmake/modules/CheckCompiler.cmake +++ b/cmake/modules/CheckCompiler.cmake @@ -9,7 +9,11 @@ #--------------------------------------------------------------------------------------------------- if(NOT CMAKE_CXX_COMPILER_ID MATCHES "(Apple|)Clang|GNU|Intel|MSVC") - message(WARNING "Unsupported compiler: ${CMAKE_CXX_COMPILER_ID}.") + if (CMAKE_CXX_COMPILER_ID MATCHES "NVHPC") + message(WARNING "NVHPC compiler: only supported at best effort level.") + else() + message(WARNING "Unsupported compiler: ${CMAKE_CXX_COMPILER_ID}.") + endif() endif() if(NOT GENERATOR_IS_MULTI_CONFIG AND NOT CMAKE_BUILD_TYPE) From 571dcff45daca8d666671d14f2508f09aba2df77 Mon Sep 17 00:00:00 2001 From: leggett Date: Wed, 20 Nov 2024 12:55:35 -0800 Subject: [PATCH 2/3] extract system includes from nvc++ --- .../cling/lib/Interpreter/CMakeLists.txt | 38 ++++++++++++------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/interpreter/cling/lib/Interpreter/CMakeLists.txt b/interpreter/cling/lib/Interpreter/CMakeLists.txt index e397da97f6bda..7639cbc58ecb5 100644 --- a/interpreter/cling/lib/Interpreter/CMakeLists.txt +++ b/interpreter/cling/lib/Interpreter/CMakeLists.txt @@ -242,24 +242,34 @@ if (UNIX) endif() if(NOT CLING_CXX_HEADERS) - if (CLING_CXX_PATH) - execute_process(COMMAND ${CLING_CXX_PATH} ${CLING_CXX_PATH_ARGS} -xc++ -E -v /dev/null + + if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "NVHPC") + execute_process(COMMAND ${CLING_CXX_RLTV} -drygccinc OUTPUT_QUIET ERROR_VARIABLE CLING_CXX_HEADERS) - set(CLING_CXX_PATH "${CLING_CXX_PATH} ${CLING_CXX_PATH_ARGS}") + execute_process( + COMMAND echo ${CLING_CXX_HEADERS} + COMMAND sed s/:/\\\n/g + OUTPUT_VARIABLE CLING_CXX_HEADERS) else() - # convert CMAKE_CXX_FLAGS to a list for execute_process - string(REPLACE "-fdiagnostics-color=always" "" cling_tmp_arg_list ${CMAKE_CXX_FLAGS}) - string(REPLACE "-fcolor-diagnosics" "" cling_tmp_arg_list ${cling_tmp_arg_list}) - string(REPLACE " " ";" cling_tmp_arg_list ${cling_tmp_arg_list}) - execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} ${cling_tmp_arg_list} -xc++ -E -v /dev/null - OUTPUT_QUIET ERROR_VARIABLE CLING_CXX_HEADERS) + if (CLING_CXX_PATH) + execute_process(COMMAND ${CLING_CXX_PATH} ${CLING_CXX_PATH_ARGS} -xc++ -E -v /dev/null + OUTPUT_QUIET ERROR_VARIABLE CLING_CXX_HEADERS) + set(CLING_CXX_PATH "${CLING_CXX_PATH} ${CLING_CXX_PATH_ARGS}") + else() + # convert CMAKE_CXX_FLAGS to a list for execute_process + string(REPLACE "-fdiagnostics-color=always" "" cling_tmp_arg_list ${CMAKE_CXX_FLAGS}) + string(REPLACE "-fcolor-diagnosics" "" cling_tmp_arg_list ${cling_tmp_arg_list}) + string(REPLACE " " ";" cling_tmp_arg_list ${cling_tmp_arg_list}) + execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} ${cling_tmp_arg_list} -xc++ -E -v /dev/null + OUTPUT_QUIET ERROR_VARIABLE CLING_CXX_HEADERS) + endif() + + execute_process( + COMMAND echo ${CLING_CXX_HEADERS} + COMMAND sed -n -e /^.include/,\$\{ -e /^\\\ \\\/.*++/p -e \} + OUTPUT_VARIABLE CLING_CXX_HEADERS) endif() - execute_process( - COMMAND echo ${CLING_CXX_HEADERS} - COMMAND sed -n -e /^.include/,\$\{ -e /^\\\ \\\/.*++/p -e \} - OUTPUT_VARIABLE CLING_CXX_HEADERS) - stripNewLine("${CLING_CXX_HEADERS}" CLING_CXX_HEADERS) endif() From f41386aa163a8689e45310fda45a92bacdd2cee4 Mon Sep 17 00:00:00 2001 From: leggett Date: Wed, 20 Nov 2024 13:29:18 -0800 Subject: [PATCH 3/3] require at least ver 24.11 of nvc++ --- cmake/modules/CheckCompiler.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmake/modules/CheckCompiler.cmake b/cmake/modules/CheckCompiler.cmake index 74b8507c8edad..1bc02b134bfa5 100644 --- a/cmake/modules/CheckCompiler.cmake +++ b/cmake/modules/CheckCompiler.cmake @@ -10,7 +10,10 @@ if(NOT CMAKE_CXX_COMPILER_ID MATCHES "(Apple|)Clang|GNU|Intel|MSVC") if (CMAKE_CXX_COMPILER_ID MATCHES "NVHPC") - message(WARNING "NVHPC compiler: only supported at best effort level.") + message(WARNING "NVHPC compiler is only supported at best effort level.") + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "24.11.0") + message(WARNING "Minimum version of NVHPC compiler is 24.11 . Version ${CMAKE_CXX_COMPILER_VERSION} detected.") + endif() else() message(WARNING "Unsupported compiler: ${CMAKE_CXX_COMPILER_ID}.") endif()