mirror of https://github.com/PCSX2/pcsx2.git
CMake: Clang-cl support
This commit is contained in:
parent
f3ff1cec54
commit
11930ed7a2
|
@ -46,7 +46,10 @@ endif()
|
|||
#-------------------------------------------------------------------------------
|
||||
option(USE_ASAN "Enable address sanitizer")
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||
if(MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
set(USE_CLANG_CL TRUE)
|
||||
message(STATUS "Building with Clang-CL.")
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||
set(USE_CLANG TRUE)
|
||||
message(STATUS "Building with Clang/LLVM.")
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
|
@ -122,6 +125,8 @@ if(${PCSX2_TARGET_ARCHITECTURES} MATCHES "x86_64")
|
|||
#set(ARCH_FLAG "-march=native -fabi-version=6")
|
||||
set(ARCH_FLAG "-march=native")
|
||||
endif()
|
||||
elseif(NOT DEFINED ARCH_FLAG AND USE_CLANG_CL)
|
||||
set(ARCH_FLAG "-msse4.1")
|
||||
endif()
|
||||
list(APPEND PCSX2_DEFS _ARCH_64=1 _M_X86=1)
|
||||
set(_ARCH_64 1)
|
||||
|
@ -143,9 +148,9 @@ option(USE_PGO_OPTIMIZE "Enable PGO optimization (use profile)")
|
|||
|
||||
# Note1: Builtin strcmp/memcmp was proved to be slower on Mesa than stdlib version.
|
||||
# Note2: float operation SSE is impacted by the PCSX2 SSE configuration. In particular, flush to zero denormal.
|
||||
if(MSVC)
|
||||
if(MSVC AND NOT USE_CLANG_CL)
|
||||
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:/Zc:externConstexpr>")
|
||||
else()
|
||||
elseif(NOT MSVC)
|
||||
add_compile_options(-pipe -fvisibility=hidden -pthread -fno-builtin-strcmp -fno-builtin-memcmp -mfpmath=sse)
|
||||
|
||||
# -fno-operator-names should only be for C++ files, not C files.
|
||||
|
|
|
@ -21,7 +21,7 @@ if(NOT TOP_CMAKE_WAS_SOURCED)
|
|||
endif()
|
||||
|
||||
if(MSVC)
|
||||
if (MSVC_VERSION GREATER_EQUAL 1930)
|
||||
if (NOT USE_CLANG_CL AND MSVC_VERSION GREATER_EQUAL 1930)
|
||||
target_compile_options(PCSX2_FLAGS INTERFACE /fp:contract)
|
||||
endif()
|
||||
target_compile_options(PCSX2_FLAGS INTERFACE /GS-)
|
||||
|
|
Loading…
Reference in New Issue