diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-07-08 15:51:16 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-07-08 15:51:16 +0100 |
commit | e95ca5c778fb9dd0969c842ec57389025a9db913 (patch) | |
tree | 151b005ca918017106ddb263658a2edee1cfffe4 /src/libcryptobox | |
parent | 5f593737d534de847747a641c75f70b608ae5d74 (diff) | |
download | rspamd-e95ca5c778fb9dd0969c842ec57389025a9db913.tar.gz rspamd-e95ca5c778fb9dd0969c842ec57389025a9db913.zip |
Rework cmake caching.
Diffstat (limited to 'src/libcryptobox')
-rw-r--r-- | src/libcryptobox/AsmOp.cmake | 36 | ||||
-rw-r--r-- | src/libcryptobox/CMakeLists.txt | 28 |
2 files changed, 35 insertions, 29 deletions
diff --git a/src/libcryptobox/AsmOp.cmake b/src/libcryptobox/AsmOp.cmake index a0d8b1377..bcf9d996a 100644 --- a/src/libcryptobox/AsmOp.cmake +++ b/src/libcryptobox/AsmOp.cmake @@ -1,21 +1,19 @@ # Check for assembler option specified -function(asm_op output_var op description) - SET(asm_code " - ${op} - ") - file(WRITE "${CMAKE_BINARY_DIR}/asm.S" "${asm_code}") - try_compile(HAVE_OP - "${CMAKE_BINARY_DIR}" - "${CMAKE_BINARY_DIR}/asm.S" - CMAKE_FLAGS "-DCMAKE_ASM_LINK_EXECUTABLE='echo not linking now...'") - #file(REMOVE "${CMAKE_BINARY_DIR}/asm.s") - - if(HAVE_OP) - MESSAGE(STATUS "Compilation of ${description} asm set is supported") - else() - MESSAGE(STATUS "Compilation of ${description} asm set is -NOT- supported") - endif() - - set(${output_var} "${HAVE_OP}" PARENT_SCOPE) -endfunction() +MACRO(asm_op output_var description) + IF(NOT ${output_var}) + file(WRITE "${CMAKE_BINARY_DIR}/asm.S" "${ASM_CODE}") + try_compile(HAVE_OP + "${CMAKE_BINARY_DIR}" + "${CMAKE_BINARY_DIR}/asm.S" + CMAKE_FLAGS "-DCMAKE_ASM_LINK_EXECUTABLE='echo not linking now...'") + + if(HAVE_OP) + MESSAGE(STATUS "Compilation of ${description} asm set is supported") + else() + MESSAGE(STATUS "Compilation of ${description} asm set is -NOT- supported") + endif() + + set(${output_var} "${HAVE_OP}" CACHE INTERNAL "${description}") + ENDIF() +ENDMACRO() diff --git a/src/libcryptobox/CMakeLists.txt b/src/libcryptobox/CMakeLists.txt index ecd729d6a..0b591bfc1 100644 --- a/src/libcryptobox/CMakeLists.txt +++ b/src/libcryptobox/CMakeLists.txt @@ -11,26 +11,34 @@ SET(SIPHASHSRC ${CMAKE_CURRENT_SOURCE_DIR}/siphash/siphash.c # For now we support only x86_64 architecture with optimizations IF(${ARCH} STREQUAL "x86_64") - ASM_OP(HAVE_AVX2 "vpaddq %ymm0, %ymm0, %ymm0" "avx2") - ASM_OP(HAVE_AVX "vpaddq %xmm0, %xmm0, %xmm0" "avx") - ASM_OP(HAVE_SSE2 "pmuludq %xmm0, %xmm0" "sse2") - ASM_OP(HAVE_SSE3 "lddqu 0(%esi), %xmm0" "sse3") - ASM_OP(HAVE_SSSE3 "pshufb %xmm0, %xmm0" "ssse3") - ASM_OP(HAVE_SSE41 "pblendw \$0, %xmm0, %xmm0" "sse41") + SET(ASM_CODE "vpaddq %ymm0, %ymm0, %ymm0") + ASM_OP(HAVE_AVX2 "avx2") + SET(ASM_CODE "vpaddq %xmm0, %xmm0, %xmm0") + ASM_OP(HAVE_AVX "avx") + SET(ASM_CODE "pmuludq %xmm0, %xmm0") + ASM_OP(HAVE_SSE2 "sse2") + SET(ASM_CODE "lddqu 0(%esi), %xmm0") + ASM_OP(HAVE_SSE3 "sse3") + SET(ASM_CODE "pshufb %xmm0, %xmm0") + ASM_OP(HAVE_SSSE3 "ssse3") + SET(ASM_CODE "pblendw \$0, %xmm0, %xmm0") + ASM_OP(HAVE_SSE41 "sse41") - ASM_OP(HAVE_SLASHMACRO " + SET(ASM_CODE " .macro TEST1 op \\op %eax, %eax .endm TEST1 xorl - " "slash macro convention") + ") + ASM_OP(HAVE_SLASHMACRO "slash macro convention") - ASM_OP(HAVE_DOLLARMACRO " + SET(ASM_CODE " .macro TEST1 op $0 %eax, %eax .endm TEST1 xorl - " "dollar macro convention") + ") + ASM_OP(HAVE_DOLLARMACRO "dollar macro convention") SET(CURVESRC ${CMAKE_CURRENT_SOURCE_DIR}/curve25519/curve25519-donna-c64.c) SET(POLYSRC ${POLYSRC} ${CMAKE_CURRENT_SOURCE_DIR}/poly1305/ref-64.c) |