Skip to content

Commit 479e15b

Browse files
authored
Merge pull request #677 from JasonQiu1/add-compiler-version-check
fix-build: add compiler min version checks
2 parents 726cd02 + 2cf91c6 commit 479e15b

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,9 @@ set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/build-system/cmake")
158158
#
159159
################################################################################
160160

161+
# Ensure compiler version meets minimum requirements
162+
INCLUDE(CheckCompilerVersion)
163+
161164
# Nota: please keep all 'find_package' gathered here (for maintenance reasons)
162165
message(STATUS "LuxCore - Add dependency targets")
163166
find_package(OpenMP REQUIRED)
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
################################################################################
2+
# Copyright 1998-2020 by authors (see AUTHORS.txt)
3+
#
4+
# This file is part of LuxCoreRender.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
################################################################################
18+
19+
message(STATUS "Checking compiler version...")
20+
21+
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
22+
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14.0)
23+
message(FATAL_ERROR "GCC >= 14.0 is required, found ${CMAKE_CXX_COMPILER_VERSION}")
24+
endif()
25+
26+
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
27+
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 20.0)
28+
message(FATAL_ERROR "Clang/LLVM >= 20.0 is required, found ${CMAKE_CXX_COMPILER_VERSION}")
29+
endif()
30+
31+
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
32+
# MSVC_VERSION is in a weird format: e.g. 1929 -> Visual Studio 2019 version 16.9
33+
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.40)
34+
message(FATAL_ERROR "MSVC >= 19.40 (at least Visual Studio 2022 version 17.10) is required, found ${CMAKE_CXX_COMPILER_VERSION}")
35+
endif()
36+
37+
else()
38+
message(WARNING "Unknown compiler '${CMAKE_CXX_COMPILER_ID}', skipping version check.")
39+
endif()

0 commit comments

Comments
 (0)