diff --git a/CMakeLists.txt b/CMakeLists.txt index 887a04ea31..85030623a4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ # Copyright (c) 2020, MegaMol Dev Team # All rights reserved. # -cmake_minimum_required(VERSION 3.19...3.29 FATAL_ERROR) +cmake_minimum_required(VERSION 3.24...3.29 FATAL_ERROR) # Vcpkg setup set(MEGAMOL_VCPKG_VERSION "2024.06.15") # Update default-registry baseline in vcpkg-configuration.json when changing! diff --git a/cmake/megamol_config.cmake b/cmake/megamol_config.cmake index 2f08d8e4be..b31b15bcaa 100644 --- a/cmake/megamol_config.cmake +++ b/cmake/megamol_config.cmake @@ -101,8 +101,10 @@ endif () # CUDA if (MEGAMOL_USE_CUDA) + if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES) + set(CMAKE_CUDA_ARCHITECTURES native) + endif() enable_language(CUDA) - set(CMAKE_CUDA_ARCHITECTURES FALSE) endif () # MPI diff --git a/plugins/molecularmaps/CMakeLists.txt b/plugins/molecularmaps/CMakeLists.txt index ae4777a3b4..7948bc3041 100644 --- a/plugins/molecularmaps/CMakeLists.txt +++ b/plugins/molecularmaps/CMakeLists.txt @@ -21,8 +21,8 @@ if (molecularmaps_PLUGIN_ENABLED) message(FATAL_ERROR "Molecularmaps currently only supports CUDA Version 11 or above. The version found was CUDA ${CUDA_VERSION_MAJOR} (${CMAKE_CUDA_COMPILER_VERSION}). Please turn off the Molecularmaps plugin or install a correct version of CUDA." ) endif() - set(CMAKE_CUDA_ARCHITECTURES 52) - set(CMAKE_CUDA_FLAGS_RELEASE "${CMAKE_CUDA_FLAGS} -O3") + set_target_properties(molecularmaps PROPERTIES CUDA_ARCHITECTURES 52) + target_compile_options(molecularmaps PRIVATE $<$,$>:-O3>) file(GLOB_RECURSE cuda_source_files RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "src/*.cu") file(GLOB_RECURSE cuda_header_files RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "src/*.cuh") diff --git a/plugins/protein_cuda/CMakeLists.txt b/plugins/protein_cuda/CMakeLists.txt index fa047f6ef2..89e03ef358 100644 --- a/plugins/protein_cuda/CMakeLists.txt +++ b/plugins/protein_cuda/CMakeLists.txt @@ -21,15 +21,15 @@ if (protein_cuda_PLUGIN_ENABLED) message(FATAL_ERROR "Protein CUDA currently only supports CUDA Version 11 or above. The version found was CUDA ${CMAKE_CUDA_COMPILER_VERSION}. Please turn off the Protein CUDA plugin or install a correct version of CUDA.") endif () - set(CMAKE_CUDA_ARCHITECTURES 52) - set(CMAKE_CUDA_FLAGS_RELEASE "${CMAKE_CUDA_FLAGS} -O3") + set_target_properties(protein_cuda PROPERTIES CUDA_ARCHITECTURES 52) + target_compile_options(protein_cuda PRIVATE $<$,$>:-O3>) get_filename_component(CUDA_COMPILER_DIRECTORY "${CMAKE_CUDA_COMPILER}" DIRECTORY) get_filename_component(CUDA_BIN_DIR ${CMAKE_CUDA_COMPILER} DIRECTORY) # Suppress CUDA warnings if (SUPPRESS_CUDA_WARNINGS) - set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler \"-w\"") + target_compile_options(protein_cuda PRIVATE $<$,$>:-Xcompiler -w>) endif () # Collect source files