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()
49
49
50
50
# We only differentiate between MSVC and GCC-compatible compilers
51
51
if (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 ()
52
61
set (LTM_C_FLAGS -W3)
62
+ endif ()
53
63
elseif (WATCOM)
54
64
set (LTM_C_FLAGS -fo=.obj -oaxt -3r -w3)
55
65
else ()
63
73
endif ()
64
74
65
75
# 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 )
67
77
list (APPEND LTM_C_FLAGS -Wno-typedef-redefinition -Wno-tautological-compare -Wno-builtin-requires-header)
68
78
# Clang requires at least '-O1' for dead code elimination
69
79
set (CMAKE_C_FLAGS_DEBUG "-O1 ${CMAKE_C_FLAGS_DEBUG} " )
@@ -97,7 +107,7 @@ add_library(${PROJECT_NAME}
97
107
98
108
target_include_directories (${PROJECT_NAME} PUBLIC
99
109
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} >
100
- $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR} / ${PROJECT_NAME} >
110
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR} >
101
111
)
102
112
103
113
target_compile_options (${PROJECT_NAME} BEFORE PRIVATE
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ extern "C" {
17
17
#endif
18
18
19
19
/* 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 )
21
21
# define MP_32BIT
22
22
#endif
23
23
@@ -29,7 +29,7 @@ extern "C" {
29
29
defined(__ia64 ) || defined(__ia64__ ) || defined(__itanium__ ) || defined(_M_IA64 ) || \
30
30
defined(__LP64__ ) || defined(_LP64 ) || defined(__64BIT__ )
31
31
# 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__ ))
33
33
/* we support 128bit integers only via: __attribute__((mode(TI))) */
34
34
# define MP_64BIT
35
35
# else
You can’t perform that action at this time.
0 commit comments