Skip to content

Commit

Permalink
C++17 build
Browse files Browse the repository at this point in the history
```
  In file included from /home/runner/work/pyamrex/pyamrex/build/temp.linux-x86_64-3.6/3/_deps/fetchedamrex-src/Src/Base/AMReX_FabArray.H:13:
  /home/runner/work/pyamrex/pyamrex/build/temp.linux-x86_64-3.6/3/_deps/fetchedamrex-src/Src/Base/AMReX_FabFactory.H:52:5: error: use of the 'nodiscard' attribute is a C++17 extension [-Werror,-Wc++17-extensions]
      AMREX_NODISCARD
      ^
  /home/runner/work/pyamrex/pyamrex/build/temp.linux-x86_64-3.6/3/_deps/fetchedamrex-src/Src/Base/AMReX_Extension.H:185:30: note: expanded from macro 'AMREX_NODISCARD'
  #   define AMREX_NODISCARD [[nodiscard]]
                               ^
```
  • Loading branch information
ax3l committed Feb 28, 2022
1 parent 27124ce commit a43b052
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ if(POLICY CMP0105)
endif()


# C++ Standard in Superbuilds #################################################
#
# This is the easiest way to push up a C++17 requirement for AMReX, PICSAR and
# openPMD-api until they increase their requirement.
set_cxx17_superbuild()


# CCache Support ##############################################################
#
# this is an optional tool that stores compiled object files; allows fast
Expand Down
28 changes: 28 additions & 0 deletions cmake/pyAMReXFunctions.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
# Set C++17 for the whole build if not otherwise requested
#
# This is the easiest way to push up a C++17 requirement for AMReX, PICSAR and
# openPMD-api until they increase their requirement.
#
macro(set_cxx17_superbuild)
if(NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()
if(NOT DEFINED CMAKE_CXX_EXTENSIONS)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()
if(NOT DEFINED CMAKE_CXX_STANDARD_REQUIRED)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()

if(NOT DEFINED CMAKE_CUDA_STANDARD)
set(CMAKE_CUDA_STANDARD 17)
endif()
if(NOT DEFINED CMAKE_CUDA_EXTENSIONS)
set(CMAKE_CUDA_EXTENSIONS OFF)
endif()
if(NOT DEFINED CMAKE_CUDA_STANDARD_REQUIRED)
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
endif()
endmacro()


# find the CCache tool and use it if found
#
macro(set_ccache)
Expand Down

0 comments on commit a43b052

Please sign in to comment.