Skip to content

Commit

Permalink
Update flags for NVIDIA compilers in CMake builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
lrknox committed Oct 16, 2023
1 parent 269c3de commit d9e42ff
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
11 changes: 8 additions & 3 deletions config/cmake/HDFCXXCompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,15 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL SunPro AND CMAKE_CXX_COMPILER_LOADED)
endif ()
endif ()

if (CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Minform=warn")
if (CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC" AND CMAKE_CXX_COMPILER_LOADED)
if (NOT DEFINED CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION)
if (NOT CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD EQUAL 11)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C11_STANDARD_COMPILE_OPTION}")
endif ()
endif ()
if (NOT ${HDF_CFG_NAME} MATCHES "Debug" AND NOT ${HDF_CFG_NAME} MATCHES "Developer")
if (${HDF_CFG_NAME} MATCHES "RelWithDebInfo")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Minform=warn")
if (NOT ${HDF_CFG_NAME} MATCHES "RelWithDebInfo")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s")
endif ()
else ()
Expand Down
2 changes: 1 addition & 1 deletion config/cmake/HDFCompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ endif()
if(CMAKE_C_COMPILER_ID STREQUAL "NVHPC" )
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Minform=warn")
if (NOT ${HDF_CFG_NAME} MATCHES "Debug" AND NOT ${HDF_CFG_NAME} MATCHES "Developer")
if (${HDF_CFG_NAME} MATCHES "RelWithDebInfo")
if (NOT ${HDF_CFG_NAME} MATCHES "RelWithDebInfo")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s")
endif ()
else ()
Expand Down
5 changes: 2 additions & 3 deletions config/cmake/HDFFortranCompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,10 @@ if (CMAKE_Fortran_COMPILER_ID STREQUAL "NAG")
endif ()

if (CMAKE_Fortran_COMPILER_ID STREQUAL "NVHPC")
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fPIC")
if (NOT ${HDF_CFG_NAME} MATCHES "Debug" AND NOT ${HDF_CFG_NAME} MATCHES "Developer")
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mnoframe")
if (${HDF_CFG_NAME} MATCHES "RelWithDebInfo")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s")
if (NOT ${HDF_CFG_NAME} MATCHES "RelWithDebInfo")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -s")
endif ()
else ()
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mbounds -Mchkptr -Mdclchk -g")
Expand Down

0 comments on commit d9e42ff

Please sign in to comment.