Build: Partial support for clang-cl

(cherry picked from commit 0b846b2107)
This commit is contained in:
Shauren
2022-02-16 20:22:15 +01:00
parent 0ce6a573a6
commit c703497655
3 changed files with 14 additions and 5 deletions

View File

@@ -4,10 +4,13 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(MSVC_EXPECTED_VERSION 19.30)
set(MSVC_EXPECTED_VERSION_STRING "Microsoft Visual Studio 2022 17")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS MSVC_EXPECTED_VERSION)
message(FATAL_ERROR "MSVC: TrinityCore requires version ${MSVC_EXPECTED_VERSION} (${MSVC_EXPECTED_VERSION_STRING}) to build but found ${CMAKE_CXX_COMPILER_VERSION}")
else()
message(STATUS "MSVC: Minimum version required is ${MSVC_EXPECTED_VERSION}, found ${CMAKE_CXX_COMPILER_VERSION} - ok!")
# This file is also used by compilers that pretend to be MSVC but report their own version number - don't version check them
if(NOT CMAKE_CXX_COMPILER_FRONTEND_VARIANT)
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS MSVC_EXPECTED_VERSION)
message(FATAL_ERROR "MSVC: TrinityCore requires version ${MSVC_EXPECTED_VERSION} (${MSVC_EXPECTED_VERSION_STRING}) to build but found ${CMAKE_CXX_COMPILER_VERSION}")
else()
message(STATUS "MSVC: Minimum version required is ${MSVC_EXPECTED_VERSION}, found ${CMAKE_CXX_COMPILER_VERSION} - ok!")
endif()
endif()
# CMake sets warning flags by default, however we manage it manually

View File

@@ -4,7 +4,7 @@ add_definitions(-DWIN32_LEAN_AND_MEAN)
add_definitions(-DNOMINMAX)
add_definitions(-DTRINITY_REQUIRED_WINDOWS_BUILD=18362)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" OR CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")
include(${CMAKE_SOURCE_DIR}/cmake/compiler/msvc/settings.cmake)
elseif(CMAKE_CXX_PLATFORM_ID MATCHES "MinGW")
include(${CMAKE_SOURCE_DIR}/cmake/compiler/mingw/settings.cmake)

View File

@@ -8,6 +8,12 @@
#include "Errors.h"
#include "GitRevision.h"
#include <algorithm>
#ifdef __clang__
// clang-cl doesn't have these hardcoded types available, correct ehdata_forceinclude.h that relies on it
#define _ThrowInfo ThrowInfo
#endif
#include <ehdata.h>
#include <rttidata.h>
#include <tlhelp32.h>