@@ -53,12 +53,14 @@ if (${ARCHITECTURE} MATCHES "x86_64|x86" AND (FORCE_SSE OR FORCE_SSSE3 OR FORCE_
53
53
if (FORCE_SSE)
54
54
set (HAS_SSE ON CACHE BOOL "SSE SIMD enabled" )
55
55
if (C_GCC OR C_CLANG)
56
+ set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse" )
56
57
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse" )
57
58
message (STATUS "Use SSE SIMD instructions" )
58
59
add_definitions (-DUSE_SSE)
59
60
elseif (C_MSVC)
60
- #set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE" )
61
- #set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSE" )
61
+ set ( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /arch:SSE" )
62
+ set ( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE" )
63
+ set ( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
62
64
set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
63
65
set ( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
64
66
message (STATUS "Use MSVC SSSE3 SIMD instructions" )
@@ -68,101 +70,109 @@ if (${ARCHITECTURE} MATCHES "x86_64|x86" AND (FORCE_SSE OR FORCE_SSSE3 OR FORCE_
68
70
elseif (FORCE_SSSE3)
69
71
set (HAS_SSSE3 ON CACHE BOOL "SSSE3 SIMD enabled" )
70
72
if (C_GCC OR C_CLANG)
71
- set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mssse3" )
72
- message (STATUS "Use SSSE3 SIMD instructions" )
73
- add_definitions (-DUSE_SSSE3)
74
- elseif (C_MSVC)
75
- #set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSSE3" )
76
- #set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSSE3" )
77
- set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
78
- set ( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
79
- message (STATUS "Use MSVC SSSE3 SIMD instructions" )
80
- add_definitions (/D "_CRT_SECURE_NO_WARNINGS" )
81
- add_definitions (-DUSE_SSSE3)
82
- endif ()
83
- elseif (FORCE_SSE41)
84
- set (HAS_SSSE3 ON CACHE BOOL "SSSE3 SIMD enabled" )
85
- set (HAS_SSE4_1 ON CACHE BOOL "Architecture has SSE 4.1 SIMD enabled" )
86
- if (C_GCC OR C_CLANG)
87
- set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -msse4.1" )
88
- set ( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -msse4.1" )
89
- message (STATUS "Use SSE 4.1 SIMD instructions" )
90
- add_definitions (-DUSE_SSSE3)
91
- add_definitions (-DUSE_SSE4_1)
92
- elseif (C_MSVC)
93
- # seems that from MSVC 2015 comiler doesn't support those flags
94
- #set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE4_1" )
95
- #set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSE4_1" )
96
- set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
97
- set ( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
98
- message (STATUS "Use SSE 4.1 SIMD instructions" )
99
- add_definitions (/D "_CRT_SECURE_NO_WARNINGS" )
100
- add_definitions (-DUSE_SSSE3)
101
- add_definitions (-DUSE_SSE4_1)
102
- endif ()
73
+ set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mssse3" )
74
+ set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mssse3" )
75
+ message (STATUS "Use SSSE3 SIMD instructions" )
76
+ add_definitions (-DUSE_SSSE3)
77
+ elseif (C_MSVC)
78
+ set ( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /arch:SSSE3" )
79
+ set ( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSSE3" )
80
+ set ( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
81
+ set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
82
+ set ( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
83
+ message (STATUS "Use MSVC SSSE3 SIMD instructions" )
84
+ add_definitions (/D "_CRT_SECURE_NO_WARNINGS" )
85
+ add_definitions (-DUSE_SSSE3)
86
+ endif ()
87
+ elseif (FORCE_SSE41)
88
+ set (HAS_SSSE3 ON CACHE BOOL "SSSE3 SIMD enabled" )
89
+ set (HAS_SSE4_1 ON CACHE BOOL "Architecture has SSE 4.1 SIMD enabled" )
90
+ if (C_GCC OR C_CLANG)
91
+ set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.1" )
92
+ set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1" )
93
+ message (STATUS "Use SSE 4.1 SIMD instructions" )
94
+ add_definitions (-DUSE_SSSE3)
95
+ add_definitions (-DUSE_SSE4_1)
96
+ elseif (C_MSVC)
97
+ # seems that from MSVC 2015 comiler doesn't support those flags
98
+ set ( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /arch:SSE4_1" )
99
+ set ( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE4_1" )
100
+ set ( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
101
+ set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
102
+ set ( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
103
+ message (STATUS "Use SSE 4.1 SIMD instructions" )
104
+ add_definitions (/D "_CRT_SECURE_NO_WARNINGS" )
105
+ add_definitions (-DUSE_SSSE3)
106
+ add_definitions (-DUSE_SSE4_1)
103
107
endif ()
108
+ endif ()
104
109
else ()
105
- if (${ARCHITECTURE} MATCHES "x86_64|x86" )
110
+ if (${ARCHITECTURE} MATCHES "x86_64|x86" )
106
111
if (C_MSVC)
107
- try_run (RUN_SSE2 COMPILE_SSE2 "${CMAKE_BINARY_DIR} /tmp" "${TEST_DIR} /test_x86_sse2.cxx" COMPILE_DEFINITIONS /O0)
112
+ try_run (RUN_SSE2 COMPILE_SSE2 "${CMAKE_BINARY_DIR} /tmp" "${TEST_DIR} /test_x86_sse2.cxx" COMPILE_DEFINITIONS /O0)
108
113
else ()
109
- try_run (RUN_SSE2 COMPILE_SSE2 "${CMAKE_BINARY_DIR} /tmp" "${TEST_DIR} /test_x86_sse2.cxx" COMPILE_DEFINITIONS -msse2 -O0)
114
+ try_run (RUN_SSE2 COMPILE_SSE2 "${CMAKE_BINARY_DIR} /tmp" "${TEST_DIR} /test_x86_sse2.cxx" COMPILE_DEFINITIONS -msse2 -O0)
110
115
endif ()
111
116
if (COMPILE_SSE2 AND RUN_SSE2 EQUAL 0)
112
- set (HAS_SSE2 ON CACHE BOOL "Architecture has SSSE2 SIMD enabled" )
113
- message (STATUS "Use SSE2 SIMD instructions" )
114
- if (C_GCC OR C_CLANG)
115
- set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2" )
116
- add_definitions (-DUSE_SSE2)
117
- elseif (C_MSVC)
118
- set ( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE2" )
119
- set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSE2" )
120
- set ( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
121
- add_definitions (/D "_CRT_SECURE_NO_WARNINGS" )
122
- add_definitions (-DUSE_SSE2)
123
- endif ()
117
+ set (HAS_SSE2 ON CACHE BOOL "Architecture has SSSE2 SIMD enabled" )
118
+ message (STATUS "Use SSE2 SIMD instructions" )
119
+ if (C_GCC OR C_CLANG)
120
+ set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2" )
121
+ set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2" )
122
+ add_definitions (-DUSE_SSE2)
123
+ elseif (C_MSVC)
124
+ set ( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /arch:SSE2" )
125
+ set ( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE2" )
126
+ set ( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSE2" )
127
+ set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSE2" )
128
+ set ( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
129
+ add_definitions (/D "_CRT_SECURE_NO_WARNINGS" )
130
+ add_definitions (-DUSE_SSE2)
131
+ endif ()
124
132
else ()
125
- set (HAS_SSE2 OFF CACHE BOOL "Architecture does not have SSSE2 SIMD enabled" )
133
+ set (HAS_SSE2 OFF CACHE BOOL "Architecture does not have SSSE2 SIMD enabled" )
126
134
endif ()
127
135
if (C_MSVC)
128
- try_run (RUN_SSSE3 COMPILE_SSSE3 "${CMAKE_BINARY_DIR} /tmp" "${TEST_DIR} /test_x86_ssse3.cxx" COMPILE_DEFINITIONS /O0)
136
+ try_run (RUN_SSSE3 COMPILE_SSSE3 "${CMAKE_BINARY_DIR} /tmp" "${TEST_DIR} /test_x86_ssse3.cxx" COMPILE_DEFINITIONS /O0)
129
137
else ()
130
- try_run (RUN_SSSE3 COMPILE_SSSE3 "${CMAKE_BINARY_DIR} /tmp" "${TEST_DIR} /test_x86_ssse3.cxx" COMPILE_DEFINITIONS -mssse3 -O0)
138
+ try_run (RUN_SSSE3 COMPILE_SSSE3 "${CMAKE_BINARY_DIR} /tmp" "${TEST_DIR} /test_x86_ssse3.cxx" COMPILE_DEFINITIONS -mssse3 -O0)
131
139
endif ()
132
140
if (COMPILE_SSSE3 AND RUN_SSSE3 EQUAL 0)
133
- set (HAS_SSSE3 ON CACHE BOOL "Architecture has SSSE3 SIMD enabled" )
134
- message (STATUS "Use SSSE3 SIMD instructions" )
135
- if (C_GCC OR C_CLANG)
136
- set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mssse3" )
137
- add_definitions (-DUSE_SSSE3)
141
+ set (HAS_SSSE3 ON CACHE BOOL "Architecture has SSSE3 SIMD enabled" )
142
+ message (STATUS "Use SSSE3 SIMD instructions" )
143
+ if (C_GCC OR C_CLANG)
144
+ set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mssse3" )
145
+ set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mssse3" )
146
+ add_definitions (-DUSE_SSSE3)
138
147
elseif (C_MSVC)
139
- # seems not present on MSVC 2017
140
- #set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSSE3" )
141
- #set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSSE3" )
142
- set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
143
- set ( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
144
- add_definitions (/D "_CRT_SECURE_NO_WARNINGS" )
145
- add_definitions (-DUSE_SSSE3)
148
+ # seems not present on MSVC 2017
149
+ #set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSSE3" )
150
+ set ( CMAKE_C_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
151
+ set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
152
+ set ( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
153
+ add_definitions (/D "_CRT_SECURE_NO_WARNINGS" )
154
+ add_definitions (-DUSE_SSSE3)
155
+ endif ()
156
+ else ()
157
+ set (HAS_SSSE3 OFF CACHE BOOL "Architecture does not have SSSE3 SIMD enabled" )
146
158
endif ()
147
- else ()
148
- set (HAS_SSSE3 OFF CACHE BOOL "Architecture does not have SSSE3 SIMD enabled" )
149
- endif ()
150
- if (C_MSVC)
151
- try_run (RUN_SSE4_1 COMPILE_SSE4_1 "${CMAKE_BINARY_DIR} /tmp" "${TEST_DIR} /test_x86_sse41.cxx" COMPILE_DEFINITIONS /O0)
152
- else ()
159
+ if (C_MSVC)
160
+ try_run (RUN_SSE4_1 COMPILE_SSE4_1 "${CMAKE_BINARY_DIR} /tmp" "${TEST_DIR} /test_x86_sse41.cxx" COMPILE_DEFINITIONS /O0)
161
+ else ()
153
162
try_run (RUN_SSE4_1 COMPILE_SSE4_1 "${CMAKE_BINARY_DIR} /tmp" "${TEST_DIR} /test_x86_sse41.cxx" COMPILE_DEFINITIONS -msse4.1 -O0)
154
163
endif ()
155
164
if (COMPILE_SSE4_1 AND RUN_SSE4_1 EQUAL 0)
156
- set (HAS_SSE4_1 ON CACHE BOOL "Architecture has SSE 4.1 SIMD enabled" )
157
- message (STATUS "Use SSE 4.1 SIMD instructions" )
158
- if (C_GCC OR C_CLANG)
159
- set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE } -msse4.1" )
160
- set ( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG } -msse4.1" )
161
- add_definitions (-DUSE_SSE4_1)
165
+ set (HAS_SSE4_1 ON CACHE BOOL "Architecture has SSE 4.1 SIMD enabled" )
166
+ message (STATUS "Use SSE 4.1 SIMD instructions" )
167
+ if (C_GCC OR C_CLANG)
168
+ set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS } -msse4.1" )
169
+ set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS } -msse4.1" )
170
+ add_definitions (-DUSE_SSE4_1)
162
171
elseif (C_MSVC)
163
172
# seems not present on MSVC 2017
164
173
#set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE4_1" )
165
174
#set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSE4_1" )
175
+ set ( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
166
176
set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
167
177
set ( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
168
178
add_definitions (/D "_CRT_SECURE_NO_WARNINGS" )
@@ -180,14 +190,15 @@ if (${ARCHITECTURE} MATCHES "x86_64|x86")
180
190
set (HAS_SSE4_2 ON CACHE BOOL "Architecture has SSE 4.2 SIMD enabled" )
181
191
message (STATUS "Use SSE 4.2 SIMD instructions" )
182
192
if (C_GCC OR C_CLANG)
183
- set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE } -msse4.2" )
184
- set ( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG } -msse4.2" )
193
+ set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS } -msse4.2" )
194
+ set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS } -msse4.2" )
185
195
add_definitions (-DUSE_SSE4_2)
186
196
elseif (C_MSVC)
187
197
# seems not present on MSVC 2017
188
198
#set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE4_2" )
189
199
#set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSE4_2" )
190
- set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
200
+ set ( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
201
+ set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
191
202
set ( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
192
203
add_definitions (/D "_CRT_SECURE_NO_WARNINGS" )
193
204
add_definitions (-DUSE_SSE4_2)
@@ -204,15 +215,17 @@ if (${ARCHITECTURE} MATCHES "x86_64|x86")
204
215
set (HAS_AVX ON CACHE BOOL "Architecture has AVX SIMD enabled" )
205
216
message (STATUS "Use AVX SIMD instructions" )
206
217
if (C_GCC OR C_CLANG)
207
- set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE } -mavx" )
208
- set ( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG } -mavx" )
218
+ set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS } -mavx" )
219
+ set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS } -mavx" )
209
220
add_definitions (-DUSE_AVX)
210
221
elseif (C_MSVC)
211
- set ( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:AVX" )
212
- set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:AVX" )
213
- set ( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
214
- add_definitions (/D "_CRT_SECURE_NO_WARNINGS" )
215
- add_definitions (-DUSE_AVX)
222
+ set ( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /arch:AVX" )
223
+ set ( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:AVX" )
224
+ set ( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:AVX" )
225
+ set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:AVX" )
226
+ set ( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
227
+ add_definitions (/D "_CRT_SECURE_NO_WARNINGS" )
228
+ add_definitions (-DUSE_AVX)
216
229
endif ()
217
230
else ()
218
231
set (HAS_AVX OFF CACHE BOOL "Architecture does not have AVX SIMD enabled" )
@@ -226,15 +239,17 @@ if (${ARCHITECTURE} MATCHES "x86_64|x86")
226
239
set (HAS_AVX2 ON CACHE BOOL "Architecture has AVX2 SIMD enabled" )
227
240
message (STATUS "Use AVX2 SIMD instructions" )
228
241
if (C_GCC OR C_CLANG)
229
- set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mavx2" )
230
- set ( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -mavx2" )
231
- add_definitions (-DUSE_AVX2)
232
- elseif (C_MSVC)
233
- set ( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:AVX2" )
234
- set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:AVX2" )
235
- set ( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
236
- add_definitions (/D "_CRT_SECURE_NO_WARNINGS" )
242
+ set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx2" )
243
+ set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx2" )
237
244
add_definitions (-DUSE_AVX2)
245
+ elseif (C_MSVC)
246
+ set ( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /arch:AVX2" )
247
+ set ( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:AVX2" )
248
+ set ( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:AVX2" )
249
+ set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:AVX2" )
250
+ set ( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
251
+ add_definitions (/D "_CRT_SECURE_NO_WARNINGS" )
252
+ add_definitions (-DUSE_AVX2)
238
253
endif ()
239
254
else ()
240
255
set (HAS_AVX2 OFF CACHE BOOL "Architecture does not have AVX2 SIMD enabled" )
@@ -248,15 +263,17 @@ if (${ARCHITECTURE} MATCHES "x86_64|x86")
248
263
set (HAS_AVX512 ON CACHE BOOL "Architecture has AVX512 SIMD enabled" )
249
264
message (STATUS "Use AVX512 SIMD instructions" )
250
265
if (C_GCC OR C_CLANG)
251
- set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE } -mavx512f" )
252
- set ( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG } -mavx512f" )
266
+ set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS } -mavx512f" )
267
+ set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS } -mavx512f" )
253
268
add_definitions (-DUSE_AVX512)
254
269
elseif (C_MSVC)
255
- set ( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:AVX512" )
256
- set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:AVX512" )
257
- set ( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
258
- add_definitions (/D "_CRT_SECURE_NO_WARNINGS" )
259
- add_definitions (-DUSE_AVX512)
270
+ set ( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /arch:AVX512" )
271
+ set ( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:AVX512" )
272
+ set ( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:AVX512" )
273
+ set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:AVX512" )
274
+ set ( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
275
+ add_definitions (/D "_CRT_SECURE_NO_WARNINGS" )
276
+ add_definitions (-DUSE_AVX512)
260
277
endif ()
261
278
else ()
262
279
set (HAS_AVX512 OFF CACHE BOOL "Architecture does not have AVX512 SIMD enabled" )
@@ -271,8 +288,8 @@ elseif(ARCHITECTURE_ARM)
271
288
set (HAS_NEON ON CACHE BOOL "Architecture has NEON SIMD enabled" )
272
289
message (STATUS "Use NEON SIMD instructions" )
273
290
if (C_GCC OR C_CLANG)
274
- set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE } -mfpu=neon" )
275
- set ( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG } -mfpu=neon" )
291
+ set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS } -mfpu=neon" )
292
+ set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS } -mfpu=neon" )
276
293
add_definitions (-DUSE_NEON)
277
294
endif ()
278
295
else ()
0 commit comments