Build: enable C++20 and updated all compiler requirements

* ported some header and cmake updates from master branch
This commit is contained in:
Ovahlord committed 2023-07-04 23:49:57 +02:00
1 parent 185c80dd96
commit f34534465a
67 files changed
+792 -134

No files matched your search

+18
View File
@@ -3,6 +3,14 @@ target_compile_definitions(trinity-compile-option-interface
INTERFACE
-D_BUILD_DIRECTIVE="$<CONFIG>")
set(CLANG_EXPECTED_VERSION 11.0.0)
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS CLANG_EXPECTED_VERSION)
message(FATAL_ERROR "Clang: TrinityCore requires version ${CLANG_EXPECTED_VERSION} to build but found ${CMAKE_CXX_COMPILER_VERSION}")
else()
message(STATUS "Clang: Minimum version required is ${CLANG_EXPECTED_VERSION}, found ${CMAKE_CXX_COMPILER_VERSION} - ok!")
endif()
if(WITH_WARNINGS)
target_compile_options(trinity-warning-interface
INTERFACE
@@ -52,3 +60,13 @@ if(BUILD_SHARED_LIBS)
message(STATUS "Clang: Disallow undefined symbols")
endif()
# speedup PCH builds by forcing template instantiations during PCH generation
set(CMAKE_REQUIRED_FLAGS "-fpch-instantiate-templates")
check_cxx_source_compiles("int main() { return 0; }" CLANG_HAS_PCH_INSTANTIATE_TEMPLATES)
unset(CMAKE_REQUIRED_FLAGS)
if(CLANG_HAS_PCH_INSTANTIATE_TEMPLATES)
target_compile_options(trinity-compile-option-interface
INTERFACE
-fpch-instantiate-templates)
endif()