Skip to content

Commit

Permalink
[DAPHNE-#840] Switch to C++20 in CMake config
Browse files Browse the repository at this point in the history
To accommodate various new language features, we switch the used C++ version to C++20.

Closes #840
  • Loading branch information
corepointer authored and philipportner committed Oct 1, 2024
1 parent bd8ae59 commit 0ce3659
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.25.2)

# Build release version by default (override with -DCMAKE_BUILD_TYPE=Debug in your initial cmake invocation)
# This needs to be set *before* the project() command
Expand All @@ -29,7 +29,7 @@ project(daphne-prototype LANGUAGES CXX C)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON)
set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
set(CMAKE_CXX_STANDARD 20 CACHE STRING "C++ standard to conform to")
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

Expand Down Expand Up @@ -118,6 +118,8 @@ check_language(CUDA)
if(USE_CUDA AND CMAKE_CUDA_COMPILER)
enable_language(CUDA)
find_package(CUDAToolkit REQUIRED)
set(CMAKE_CUDA_STANDARD 20)
set(CMAKE_CUDA_STANDARD_REQUIRED ON)

if(${CMAKE_COMPILER_IS_GNUCXX})
set(GCC_EXPECTED_VERSION 11.3.0)
Expand All @@ -137,7 +139,7 @@ if(USE_CUDA AND CMAKE_CUDA_COMPILER)
add_definitions(-DUSE_CUDA)
message(STATUS "Note: disabled CUSPARSE_DEPRECATED in main CMakeLists.txt")
add_definitions(-DDISABLE_CUSPARSE_DEPRECATED)
set(CMAKE_CUDA_STANDARD 17)
set(CMAKE_CUDA_STANDARD 20)
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
message(STATUS "CUDA enabled (version ${CMAKE_CUDA_COMPILER_VERSION})")
if(DEFINED ENV{CUDAHOSTCXX})
Expand Down
5 changes: 4 additions & 1 deletion src/runtime/local/kernels/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@
# Specifies how to generate the file "kernels.cpp" (which resides in the build
# directory) as the basis for the pre-compiled kernels library.

set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
set(CMAKE_CXX_STANDARD 20 CACHE STRING "C++ standard to conform to")
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

# The library of pre-compiled CUDA kernels
if(USE_CUDA AND CMAKE_CUDA_COMPILER)
set(CMAKE_CUDA_STANDARD 20)
set(CMAKE_CUDA_STANDARD_REQUIRED ON)

add_custom_command(
OUTPUT ${PROJECT_BINARY_DIR}/src/runtime/local/kernels/CUDAkernels.cpp ${PROJECT_SOURCE_DIR}/lib/CUDAcatalog.json
COMMAND python3 ARGS genKernelInst.py kernels.json
Expand Down

0 comments on commit 0ce3659

Please sign in to comment.