aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcryptobox
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-02-13 23:45:06 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-02-13 23:45:06 +0000
commit1b94a3560cea4824cff6321e02baabb6972ecfdb (patch)
tree3886c251022a04de9e1531abc4e8077cbc505d41 /src/libcryptobox
parent9d0fd4d7e5b5a3f3752d5c2f625fd6243da10704 (diff)
downloadrspamd-1b94a3560cea4824cff6321e02baabb6972ecfdb.tar.gz
rspamd-1b94a3560cea4824cff6321e02baabb6972ecfdb.zip
Eliminate mess with linking.
Diffstat (limited to 'src/libcryptobox')
-rw-r--r--src/libcryptobox/CMakeLists.txt50
1 files changed, 17 insertions, 33 deletions
diff --git a/src/libcryptobox/CMakeLists.txt b/src/libcryptobox/CMakeLists.txt
index fc0a3f477..729f93854 100644
--- a/src/libcryptobox/CMakeLists.txt
+++ b/src/libcryptobox/CMakeLists.txt
@@ -3,12 +3,12 @@ INCLUDE(AsmOp.cmake)
TARGET_ARCHITECTURE(ARCH)
-SET(CHACHASRC chacha20/chacha.c chacha20/ref.c)
-SET(POLYSRC poly1305/poly1305.c)
+SET(CHACHASRC ${CMAKE_CURRENT_SOURCE_DIR}/chacha20/chacha.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/chacha20/ref.c)
+SET(POLYSRC ${CMAKE_CURRENT_SOURCE_DIR}/poly1305/poly1305.c)
# For now we support only x86_64 architecture with optimizations
IF(${ARCH} STREQUAL "x86_64")
- ENABLE_LANGUAGE(ASM)
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")
@@ -29,45 +29,29 @@ IF(${ARCH} STREQUAL "x86_64")
CONFIGURE_FILE(platform_config.h.in platform_config.h)
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}")
- SET(CURVESRC curve25519/curve25519-donna-c64.c)
- SET(POLYSRC ${POLYSRC} poly1305/ref-64.c)
+ SET(CURVESRC ${CMAKE_CURRENT_SOURCE_DIR}/curve25519/curve25519-donna-c64.c)
+ SET(POLYSRC ${POLYSRC} ${CMAKE_CURRENT_SOURCE_DIR}/poly1305/ref-64.c)
ELSEIF(${ARCH} STREQUAL "i386")
- SET(POLYSRC ${POLYSRC} poly1305/ref-32.c)
- SET(CURVESRC curve25519/curve25519-donna.c)
+ SET(POLYSRC ${POLYSRC} ${CMAKE_CURRENT_SOURCE_DIR}/poly1305/ref-32.c)
+ SET(CURVESRC ${CMAKE_CURRENT_SOURCE_DIR}/curve25519/curve25519-donna.c)
ELSE()
- SET(CURVESRC curve25519/ref.c)
- SET(POLYSRC ${POLYSRC} poly1305/ref-32.c)
+ SET(CURVESRC ${CMAKE_CURRENT_SOURCE_DIR}/curve25519/ref.c)
+ SET(POLYSRC ${POLYSRC} ${CMAKE_CURRENT_SOURCE_DIR}/poly1305/ref-32.c)
ENDIF()
IF(HAVE_AVX2)
- SET(CHACHASRC ${CHACHASRC} chacha20/avx2.S)
- SET(POLYSRC ${POLYSRC} poly1305/avx2.S)
+ SET(CHACHASRC ${CHACHASRC} ${CMAKE_CURRENT_SOURCE_DIR}/chacha20/avx2.S)
+ SET(POLYSRC ${POLYSRC} ${CMAKE_CURRENT_SOURCE_DIR}/poly1305/avx2.S)
ENDIF(HAVE_AVX2)
IF(HAVE_AVX)
- SET(CHACHASRC ${CHACHASRC} chacha20/avx.S)
- SET(POLYSRC ${POLYSRC} poly1305/avx.S)
+ SET(CHACHASRC ${CHACHASRC} ${CMAKE_CURRENT_SOURCE_DIR}/chacha20/avx.S)
+ SET(POLYSRC ${POLYSRC} ${CMAKE_CURRENT_SOURCE_DIR}/poly1305/avx.S)
ENDIF(HAVE_AVX)
IF(HAVE_SSE2)
- SET(CHACHASRC ${CHACHASRC} chacha20/sse2.S)
- SET(POLYSRC ${POLYSRC} poly1305/sse2.S)
+ SET(CHACHASRC ${CHACHASRC} ${CMAKE_CURRENT_SOURCE_DIR}/chacha20/sse2.S)
+ SET(POLYSRC ${POLYSRC} ${CMAKE_CURRENT_SOURCE_DIR}/poly1305/sse2.S)
ENDIF(HAVE_SSE2)
-SET(LIBCRYPTOBOXSRC cryptobox.c)
+SET(LIBCRYPTOBOXSRC ${CMAKE_CURRENT_SOURCE_DIR}/cryptobox.c)
-ADD_LIBRARY(rspamd-cryptobox ${LINK_TYPE} ${LIBCRYPTOBOXSRC}
- ${CHACHASRC} ${POLYSRC} ${CURVESRC})
-IF(NOT DEBIAN_BUILD)
- SET_TARGET_PROPERTIES(rspamd-cryptobox PROPERTIES VERSION ${RSPAMD_VERSION})
-ENDIF(NOT DEBIAN_BUILD)
-SET_TARGET_PROPERTIES(rspamd-cryptobox PROPERTIES LINKER_LANGUAGE C COMPILE_FLAGS "-DRSPAMD_LIB")
-
-IF(CMAKE_COMPILER_IS_GNUCC)
-SET_TARGET_PROPERTIES(rspamd-cryptobox PROPERTIES COMPILE_FLAGS "-DRSPAMD_LIB -fno-strict-aliasing")
-ENDIF(CMAKE_COMPILER_IS_GNUCC)
-TARGET_LINK_LIBRARIES(rspamd-cryptobox ottery)
-
-IF(NO_SHARED MATCHES "OFF")
- INSTALL(TARGETS rspamd-cryptobox
- LIBRARY DESTINATION ${LIBDIR}
- PUBLIC_HEADER DESTINATION ${INCLUDEDIR})
-ENDIF(NO_SHARED MATCHES "OFF") \ No newline at end of file
+SET(RSPAMD_CRYPTOBOX ${LIBCRYPTOBOXSRC} ${CHACHASRC} ${POLYSRC} ${CURVESRC} PARENT_SCOPE) \ No newline at end of file