Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for NVIDIA nvc++ compiler #17000

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion cmake/modules/CheckCompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@
#---------------------------------------------------------------------------------------------------

if(NOT CMAKE_CXX_COMPILER_ID MATCHES "(Apple|)Clang|GNU|Intel|MSVC")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need a check here for NVHPC too?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I understand this condition filters out supported compilers. As NVHPC is only partially supported, it must enter this condition - note the NOT in front.

message(WARNING "Unsupported compiler: ${CMAKE_CXX_COMPILER_ID}.")
if (CMAKE_CXX_COMPILER_ID MATCHES "NVHPC")
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()
endif()

if(NOT GENERATOR_IS_MULTI_CONFIG AND NOT CMAKE_BUILD_TYPE)
Expand Down
38 changes: 24 additions & 14 deletions interpreter/cling/lib/Interpreter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
Loading