File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,17 @@ endif()
4949
5050# We only differentiate between MSVC and GCC-compatible compilers
5151if (MSVC )
52+ if (CMAKE_C_COMPILER_ID STREQUAL "Clang" )
53+ # We are clang-cl
54+ # Some flags for linux similarity and warnings
55+ set (LTM_C_FLAGS -W3 -fstrict-aliasing /D_CRT_SECURE_NO_WARNINGS)
56+ # Optimization flags
57+ set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Zc:inline /Gw /Gy /clang:-funroll-loops" )
58+ # We need to link the runtime for 128 bit int support, which clang-cl has
59+ link_libraries (clang_rt.builtins-x86_64.lib)
60+ else ()
5261 set (LTM_C_FLAGS -W3)
62+ endif ()
5363elseif (WATCOM)
5464 set (LTM_C_FLAGS -fo=.obj -oaxt -3r -w3)
5565else ()
6373endif ()
6474
6575# What compiler do we have and what are their...uhm... peculiarities
66- if (CMAKE_C_COMPILER_ID MATCHES "(C|c?)lang" )
76+ if (CMAKE_C_COMPILER_ID MATCHES "(C|c?)lang" AND NOT MSVC )
6777 list (APPEND LTM_C_FLAGS -Wno-typedef-redefinition -Wno-tautological-compare -Wno-builtin-requires-header)
6878 # Clang requires at least '-O1' for dead code elimination
6979 set (CMAKE_C_FLAGS_DEBUG "-O1 ${CMAKE_C_FLAGS_DEBUG} " )
@@ -97,7 +107,7 @@ add_library(${PROJECT_NAME}
97107
98108target_include_directories (${PROJECT_NAME} PUBLIC
99109 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} >
100- $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR} / ${PROJECT_NAME} >
110+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR} >
101111)
102112
103113target_compile_options (${PROJECT_NAME} BEFORE PRIVATE
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ extern "C" {
1717#endif
1818
1919/* MS Visual C++ doesn't have a 128bit type for words, so fall back to 32bit MPI's (where words are 64bit) */
20- #if (defined(_MSC_VER ) || defined(__LLP64__ ) || defined(__e2k__ ) || defined(__LCC__ )) && !defined(MP_64BIT )
20+ #if (( defined(_MSC_VER ) && !defined( __clang__ ) ) || defined(__LLP64__ ) || defined(__e2k__ ) || defined(__LCC__ )) && !defined(MP_64BIT )
2121# define MP_32BIT
2222#endif
2323
@@ -29,7 +29,7 @@ extern "C" {
2929 defined(__ia64 ) || defined(__ia64__ ) || defined(__itanium__ ) || defined(_M_IA64 ) || \
3030 defined(__LP64__ ) || defined(_LP64 ) || defined(__64BIT__ )
3131# if !(defined(MP_64BIT ) || defined(MP_32BIT ) || defined(MP_16BIT ))
32- # if defined(__GNUC__ ) && defined(__SIZEOF_INT128__ ) && !defined(__hppa )
32+ # if defined(__GNUC__ ) && defined(__SIZEOF_INT128__ ) && !defined(__hppa ) || (defined( _MSC_VER ) && defined( __SIZEOF_INT128__ ))
3333/* we support 128bit integers only via: __attribute__((mode(TI))) */
3434# define MP_64BIT
3535# else
You can’t perform that action at this time.
0 commit comments