diff --git a/build_files/build_environment/CMakeLists.txt b/build_files/build_environment/CMakeLists.txt index 43494bd171b..e2098186d34 100644 --- a/build_files/build_environment/CMakeLists.txt +++ b/build_files/build_environment/CMakeLists.txt @@ -32,6 +32,9 @@ if(POLICY CMP0135) cmake_policy(SET CMP0135 NEW) # CMake 3.24+ Set the date/time for extracted files to time of extraction endif() include(ExternalProject) + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../cmake/Modules") + include(cmake/check_software.cmake) include(cmake/options.cmake) # `versions.cmake` needs to be included after `options.cmake` @@ -40,6 +43,7 @@ include(cmake/versions.cmake) include(cmake/boost_build_options.cmake) include(cmake/download.cmake) include(cmake/macros.cmake) +include(cmake/check_compilers.cmake) if(ENABLE_MSYS2) include(cmake/setup_msys2.cmake) diff --git a/build_files/build_environment/cmake/check_compilers.cmake b/build_files/build_environment/cmake/check_compilers.cmake new file mode 100644 index 00000000000..23e84108867 --- /dev/null +++ b/build_files/build_environment/cmake/check_compilers.cmake @@ -0,0 +1,45 @@ +# SPDX-FileCopyrightText: 2019-2023 Blender Authors +# +# SPDX-License-Identifier: GPL-2.0-or-later + +# Check against installed versions. + +message(STATUS "Found C Compiler: ${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}") +if(UNIX AND NOT APPLE) + if(NOT CMAKE_COMPILER_IS_GNUCC OR NOT (CMAKE_C_COMPILER_VERSION MATCHES ${RELEASE_GCC_VERSION})) + message(STATUS " NOTE: Official releases uses GCC ${RELEASE_GCC_VERSION}") + endif() +endif() + +message(STATUS "Found C++ Compiler: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}") +if(UNIX AND NOT APPLE) + if(NOT CMAKE_COMPILER_IS_GNUCC OR NOT (CMAKE_CXX_COMPILER_VERSION MATCHES ${RELEASE_GCC_VERSION})) + message(STATUS " NOTE: Official releases uses GCC ${RELEASE_GCC_VERSION}") + endif() +endif() + +if(NOT APPLE) + include(CheckLanguage) + check_language(CUDA) + if (NOT CMAKE_CUDA_COMPILER) + message(STATUS "Missing CUDA compiler") + else() + enable_language(CUDA) + message(STATUS "Found CUDA Compiler: ${CMAKE_CUDA_COMPILER_ID} ${CMAKE_CUDA_COMPILER_VERSION}") + if(NOT CMAKE_CUDA_COMPILER_VERSION MATCHES ${RELEASE_CUDA_VERSION}) + message(STATUS " NOTE: Official releases uses CUDA ${RELEASE_CUDA_VERSION}") + endif() + endif() + + + unset(HIP_VERSION) + find_package(HIP QUIET) + if (NOT HIP_FOUND) + message(STATUS "Missing HIP compiler") + else() + message(STATUS "Found HIP Compiler: ${HIP_HIPCC_EXECUTABLE} ${HIP_VERSION}") + if(NOT HIP_VERSION MATCHES ${RELEASE_HIP_VERSION}) + message(STATUS " NOTE: Official releases uses HIP ${RELEASE_HIP_VERSION}") + endif() + endif() +endif() diff --git a/build_files/build_environment/cmake/versions.cmake b/build_files/build_environment/cmake/versions.cmake index d8a1678dab8..d9efc173c55 100644 --- a/build_files/build_environment/cmake/versions.cmake +++ b/build_files/build_environment/cmake/versions.cmake @@ -2,6 +2,18 @@ # # SPDX-License-Identifier: GPL-2.0-or-later +# Compilers +# +# Version used for precompiled library builds used for official releases. +# For anyone making their own library build, matching these exactly is not +# needed but it can be a useful reference. + +set(RELEASE_GCC_VERSION 11.2.*) +set(RELEASE_CUDA_VERSION 12.3.*) +set(RELEASE_HIP_VERSION 5.7.*) + +# Libraries +# # CPE's are used to identify dependencies, for more information on what they # are please see https://nvd.nist.gov/products/cpe #