From 341f06c2a3f4af6c270ae66b78a8cdf90e2eaef6 Mon Sep 17 00:00:00 2001 From: Hudd Date: Fri, 1 Dec 2023 21:57:46 +0400 Subject: [PATCH] config: add support for clang-cl --- CMakeLists.txt | 2 +- awlib/include/aw/config.h | 9 +++++---- awlib/include/aw/config/clang.h | 4 ++++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f7790b9d..7f86b32f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,7 @@ set(AW_CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/awlib/cmake") list(APPEND CMAKE_MODULE_PATH ${AW_CMAKE_MODULE_PATH}) -if (MSVC) +if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") add_compile_options( # multicore build by default "/MP" diff --git a/awlib/include/aw/config.h b/awlib/include/aw/config.h index 1bdba436..98cc65f4 100644 --- a/awlib/include/aw/config.h +++ b/awlib/include/aw/config.h @@ -22,10 +22,11 @@ (((major) << 0x10000) + ((minor) << 0x100) + (patch)) /**** DEFINITIONS ****/ -#define AW_COMPILER_GCC 1 -#define AW_COMPILER_CLANG 2 -#define AW_COMPILER_MSVC 3 -#define AW_COMPILER_UNKNOWN 0 +#define AW_COMPILER_GCC 1 +#define AW_COMPILER_CLANG 2 +#define AW_COMPILER_CLANG_CL 3 +#define AW_COMPILER_MSVC 4 +#define AW_COMPILER_UNKNOWN 0 #define AW_ARCH_i686 686 #define AW_ARCH_x86_64 8664 diff --git a/awlib/include/aw/config/clang.h b/awlib/include/aw/config/clang.h index d23a722a..a6a9ecd3 100644 --- a/awlib/include/aw/config/clang.h +++ b/awlib/include/aw/config/clang.h @@ -8,7 +8,11 @@ */ #ifndef aw_compiler_setup_2 #define aw_compiler_setup_2 +#ifdef _MSC_VER +#define AW_COMPILER AW_COMPILER_CLANG_CL +#else #define AW_COMPILER AW_COMPILER_CLANG +#endif // TODO: apple clang version bullshit #define AW_CVER_X __clang_major__ #define AW_CVER_Y __clang_minor__