|
16 | 16 |
|
17 | 17 | INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/mysys)
|
18 | 18 |
|
19 |
| -SET(MYSYS_SOURCES array.c charset-def.c charset.c crc32ieee.cc my_default.c |
| 19 | +SET(MYSYS_SOURCES array.c charset-def.c charset.c my_default.c |
20 | 20 | get_password.c
|
21 | 21 | errors.c hash.c list.c
|
22 | 22 | mf_cache.c mf_dirname.c mf_fn_ext.c
|
@@ -60,19 +60,29 @@ ENDIF()
|
60 | 60 |
|
61 | 61 | IF(MSVC)
|
62 | 62 | SET(MYSYS_SOURCES ${MYSYS_SOURCES} crc32/crc32_x86.c)
|
| 63 | + IF(CMAKE_SIZEOF_VOID_P EQUAL 8) |
| 64 | + SET (MYSYS_SOURCES ${MYSYS_SOURCES} crc32/crc32c_amd64.cc) |
| 65 | + ENDIF() |
63 | 66 | ADD_DEFINITIONS(-DHAVE_SSE42 -DHAVE_PCLMUL)
|
64 | 67 | IF(CLANG_CL)
|
65 |
| - SET_SOURCE_FILES_PROPERTIES(crc32/crc32_x86.cc crc32/crc32c.c PROPERTIES COMPILE_FLAGS "-msse4.2 -mpclmul") |
| 68 | + SET_SOURCE_FILES_PROPERTIES(crc32/crc32_x86.c PROPERTIES COMPILE_FLAGS "-msse4.2 -mpclmul") |
66 | 69 | ENDIF()
|
67 | 70 | ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|i386|i686")
|
68 |
| - MY_CHECK_C_COMPILER_FLAG(-msse4.2) |
69 |
| - MY_CHECK_C_COMPILER_FLAG(-mpclmul) |
| 71 | + MY_CHECK_CXX_COMPILER_FLAG(-msse4.2) |
| 72 | + MY_CHECK_CXX_COMPILER_FLAG(-mpclmul) |
70 | 73 | CHECK_INCLUDE_FILE(cpuid.h HAVE_CPUID_H)
|
71 | 74 | CHECK_INCLUDE_FILE(x86intrin.h HAVE_X86INTRIN_H)
|
72 |
| - IF(have_C__msse4.2 AND have_C__mpclmul AND HAVE_CPUID_H AND HAVE_X86INTRIN_H) |
73 |
| - SET(MYSYS_SOURCES ${MYSYS_SOURCES} crc32/crc32_x86.c) |
74 |
| - SET_SOURCE_FILES_PROPERTIES(crc32/crc32_x86.c crc32/crc32c.cc PROPERTIES COMPILE_FLAGS "-msse4.2 -mpclmul") |
75 |
| - ADD_DEFINITIONS(-DHAVE_SSE42 -DHAVE_PCLMUL) |
| 75 | + IF(have_CXX__msse4.2 AND HAVE_CPUID_H) |
| 76 | + ADD_DEFINITIONS(-DHAVE_SSE42) |
| 77 | + IF (have_CXX__mpclmul AND HAVE_X86INTRIN_H) |
| 78 | + ADD_DEFINITIONS(-DHAVE_PCLMUL) |
| 79 | + SET(MYSYS_SOURCES ${MYSYS_SOURCES} crc32/crc32_x86.c) |
| 80 | + SET_SOURCE_FILES_PROPERTIES(crc32/crc32_x86.c PROPERTIES COMPILE_FLAGS "-msse4.2 -mpclmul") |
| 81 | + IF(CMAKE_SIZEOF_VOID_P EQUAL 8) |
| 82 | + SET(MYSYS_SOURCES ${MYSYS_SOURCES} crc32/crc32c_amd64.cc) |
| 83 | + SET_SOURCE_FILES_PROPERTIES(crc32/crc32c_amd64.cc PROPERTIES COMPILE_FLAGS "-msse4.2 -mpclmul") |
| 84 | + ENDIF() |
| 85 | + ENDIF() |
76 | 86 | ENDIF()
|
77 | 87 | ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|AARCH64")
|
78 | 88 | IF(CMAKE_COMPILER_IS_GNUCC)
|
@@ -129,11 +139,15 @@ ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|AARCH64")
|
129 | 139 | COMPILE_FLAGS "-march=armv8-a+crc+crypto")
|
130 | 140 | ENDIF()
|
131 | 141 | ENDIF()
|
132 |
| -ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64|powerpc64" OR CMAKE_SYSTEM_NAME MATCHES AIX) |
| 142 | +ENDIF() |
| 143 | + |
| 144 | +IF(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64|powerpc64" OR CMAKE_SYSTEM_NAME MATCHES AIX) |
133 | 145 | SET(MYSYS_SOURCES ${MYSYS_SOURCES} crc32/crc32_ppc64.c crc32/crc32c_ppc.c)
|
134 | 146 | SET_SOURCE_FILES_PROPERTIES(crc32/crc32_ppc64.c crc32/crc32c_ppc.c PROPERTIES
|
135 | 147 | COMPILE_FLAGS "${COMPILE_FLAGS} -maltivec -mvsx -mpower8-vector -mcrypto -mpower8-vector")
|
136 | 148 | ADD_DEFINITIONS(-DHAVE_POWER8 -DHAS_ALTIVEC)
|
| 149 | +ELSE() |
| 150 | + SET (MYSYS_SOURCES ${MYSYS_SOURCES} crc32ieee.cc) |
137 | 151 | ENDIF()
|
138 | 152 |
|
139 | 153 | IF(UNIX)
|
|
0 commit comments