Untangle messy nested dependency tree

lokinet-cryptography depends on lokinet-base which depends on
lokinet-cryptography.

Fixed this but splitting lokinet-cryptography into the libntrup code
(which is what is really needed) and the llarp/crypto code (which isn't
needed for lokinet-base).
pull/2215/head
Jason Rhinelander 8 months ago
parent 690ec5fbca
commit 1d84e7cbd5
No known key found for this signature in database
GPG Key ID: C4992CE7A88D4262

@ -1,5 +1,5 @@
add_library(lokinet-cryptography
add_library(lokinet-libntrup
STATIC
libntrup/src/ntru.cpp
libntrup/src/ref/randomsmall.c
@ -20,7 +20,7 @@ add_library(lokinet-cryptography
libntrup/src/ref/rq.c
)
target_include_directories(lokinet-cryptography PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/libntrup/include)
target_include_directories(lokinet-libntrup PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/libntrup/include)
# The avx implementation uses runtime CPU feature detection to enable itself, so we *always* want to
# compile it with avx2/fma support when supported by the compiler even if we aren't compiling with
@ -48,19 +48,19 @@ include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-mavx2 COMPILER_SUPPORTS_AVX2)
check_cxx_compiler_flag(-mfma COMPILER_SUPPORTS_FMA)
if(COMPILER_SUPPORTS_AVX2 AND COMPILER_SUPPORTS_FMA AND (NOT ANDROID))
target_sources(lokinet-cryptography PRIVATE ${NTRU_AVX_SRC})
target_sources(lokinet-libntrup PRIVATE ${NTRU_AVX_SRC})
set_property(SOURCE ${NTRU_AVX_SRC} APPEND PROPERTY COMPILE_FLAGS "-mavx2 -mfma")
message(STATUS "Building libntrup with runtime AVX2/FMA support")
else()
target_sources(lokinet-cryptography PRIVATE libntrup/src/noavx-stubs.c)
target_sources(lokinet-libntrup PRIVATE libntrup/src/noavx-stubs.c)
message(STATUS "Not building with libntrup runtime AVX2/FMA support (either this architecture doesn't support them, or your compile doesn't support the -mavx2 -mfma flags")
endif()
enable_lto(lokinet-cryptography)
enable_lto(lokinet-libntrup)
if (WARNINGS_AS_ERRORS)
target_compile_options(lokinet-cryptography PUBLIC -Wall -Wextra -Werror)
target_compile_options(lokinet-libntrup PUBLIC -Wall -Wextra -Werror)
endif()
target_link_libraries(lokinet-cryptography PUBLIC sodium)
target_link_libraries(lokinet-libntrup PUBLIC sodium)

@ -1,6 +1,7 @@
include(Version)
target_sources(lokinet-cryptography PRIVATE
add_library(lokinet-cryptography
STATIC
crypto/crypto.cpp
crypto/encrypted_frame.cpp
crypto/types.cpp
@ -250,7 +251,7 @@ add_library(lokinet-base INTERFACE)
target_include_directories(lokinet-base
INTERFACE ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/include
)
target_link_libraries(lokinet-base INTERFACE quic lokinet-cryptography)
target_link_libraries(lokinet-base INTERFACE quic)
if(WITH_PEERSTATS)
target_compile_definitions(lokinet-base INTERFACE -DLOKINET_PEERSTATS_BACKEND)
@ -270,7 +271,7 @@ function(lokinet_link_lib libname)
endfunction()
# internal public linkages of components
lokinet_link_lib(lokinet-util)
lokinet_link_lib(lokinet-util lokinet-libntrup)
lokinet_link_lib(lokinet-cryptography lokinet-libcrypt lokinet-util)
lokinet_link_lib(lokinet-peerstats lokinet-context)
lokinet_link_lib(lokinet-consensus lokinet-context)

Loading…
Cancel
Save