@@ -16,16 +16,26 @@ add_subdirectory(parser)
16
16
# add_definitions(-msse4.2 -mfma)
17
17
# add_definitions(-mavx2 -mf16c -mpopcnt)
18
18
19
- execute_process (COMMAND grep -q avx2 /proc/cpuinfo
19
+ execute_process (COMMAND grep -q fma /proc/cpuinfo
20
+ RESULT_VARIABLE SUPPORT_FMA
21
+ OUTPUT_QUIET
22
+ ERROR_QUIET)
23
+
24
+ execute_process (COMMAND grep -q sse4_2 /proc/cpuinfo
25
+ RESULT_VARIABLE SUPPORT_SSE42
26
+ OUTPUT_QUIET
27
+ ERROR_QUIET)
28
+
29
+ execute_process (COMMAND grep -q avx2 /proc/cpuinfo
20
30
RESULT_VARIABLE SUPPORT_AVX2
21
- OUTPUT_QUIET
22
- ERROR_QUIET)
31
+ OUTPUT_QUIET
32
+ ERROR_QUIET)
33
+
34
+ execute_process (COMMAND grep -q avx512 /proc/cpuinfo
35
+ RESULT_VARIABLE SUPPORT_AVX512
36
+ OUTPUT_QUIET
37
+ ERROR_QUIET)
23
38
24
- execute_process (COMMAND grep -q avx512 /proc/cpuinfo
25
- RESULT_VARIABLE SUPPORT_AVX512
26
- OUTPUT_QUIET
27
- ERROR_QUIET)
28
-
29
39
30
40
file (GLOB_RECURSE
31
41
main_cpp
@@ -210,6 +220,14 @@ target_include_directories(infinity_core PUBLIC "${CMAKE_SOURCE_DIR}/third_party
210
220
target_include_directories (infinity_core PUBLIC "${CMAKE_SOURCE_DIR} /third_party/base64/include" )
211
221
target_include_directories (infinity_core PUBLIC "${CMAKE_SOURCE_DIR} /third_party/oatpp/src" )
212
222
223
+ if (NOT SUPPORT_FMA EQUAL 0)
224
+ message (FATAL_ERROR "This project requires the processor support fused multiply-add (FMA) instructions." )
225
+ endif ()
226
+
227
+ if (NOT SUPPORT_SSE42 EQUAL 0)
228
+ message (FATAL_ERROR "This project requires the processor support sse4_2 instructions." )
229
+ endif ()
230
+
213
231
if (SUPPORT_AVX2 EQUAL 0 OR SUPPORT_AVX512 EQUAL 0)
214
232
message ("Compiled by AVX2 or AVX512" )
215
233
add_definitions (-march=native)
0 commit comments