Skip to content

Commit

Permalink
rearrange cmake libraries
Browse files Browse the repository at this point in the history
define relations and document them.
make responsibilies clear and consice.
  • Loading branch information
majestrate committed Jan 20, 2023
1 parent 4508c59 commit 2498a08
Show file tree
Hide file tree
Showing 10 changed files with 366 additions and 138 deletions.
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ endif()
option(USE_AVX2 "enable avx2 code" OFF)
option(USE_NETNS "enable networking namespace support. Linux only" OFF)
option(NATIVE_BUILD "optimise for host system and FPU" ON)
option(EMBEDDED_CFG "optimise for older hardware or embedded systems" OFF)
option(BUILD_LIBLOKINET "build liblokinet.so" ON)
option(WITH_EMBEDDED_LOKINET "build liblokinet.so for embedded lokinet" OFF)
option(XSAN "use sanitiser, if your system has it (requires -DCMAKE_BUILD_TYPE=Debug)" OFF)
option(USE_JEMALLOC "Link to jemalloc for memory allocations, if found" ON)
option(TESTNET "testnet build" OFF)
Expand Down
1 change: 0 additions & 1 deletion contrib/android-configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ for abi in $build_abis; do
-DBUILD_PACKAGE=ON \
-DBUILD_SHARED_LIBS=OFF \
-DBUILD_TESTING=OFF \
-DBUILD_LIBLOKINET=OFF \
-DWITH_TESTS=OFF \
-DWITH_BOOTSTRAP=OFF \
-DNATIVE_BUILD=OFF \
Expand Down
1 change: 0 additions & 1 deletion contrib/mac-configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ cd build-mac
cmake \
-G Ninja \
-DBUILD_STATIC_DEPS=ON \
-DBUILD_LIBLOKINET=OFF \
-DWITH_TESTS=OFF \
-DWITH_BOOTSTRAP=OFF \
-DNATIVE_BUILD=OFF \
Expand Down
1 change: 0 additions & 1 deletion contrib/windows-configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ cmake \
-DBUILD_PACKAGE=ON \
-DBUILD_SHARED_LIBS=OFF \
-DBUILD_TESTING=OFF \
-DBUILD_LIBLOKINET=OFF \
-DWITH_TESTS=OFF \
-DWITH_BOOTSTRAP=OFF \
-DNATIVE_BUILD=OFF \
Expand Down
2 changes: 1 addition & 1 deletion crypto/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ add_library(lokinet-cryptography
libntrup/src/ref/rq.c
)

target_include_directories(lokinet-cryptography PUBLIC libntrup/include)
target_include_directories(lokinet-cryptography 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
Expand Down
25 changes: 24 additions & 1 deletion external/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

option(SUBMODULE_CHECK "Enables checking that vendored library submodules are up to date" ON)
if(SUBMODULE_CHECK)
find_package(Git)
Expand Down Expand Up @@ -140,3 +139,27 @@ if(WITH_BOOTSTRAP)
endif()

endif()


# libcrypt defaults, only on with macos and non static linux
set(default_libcrypt OFF)

if(LINUX AND NOT STATIC_LINK)
set(default_libcrypt ON)
endif()
if(MACOS)
set(default_libcrypt ON)
endif()

option(WITH_LIBCRYPT "enable fast password hash with libcrypt" ${default_libcrypt})

add_library(lokinet-libcrypt INTERFACE)
if(WITH_LIBCRYPT)
pkg_check_modules(LIBCRYPT libcrypt IMPORTED_TARGET REQUIRED)
add_definitions(-DHAVE_CRYPT)
target_link_libraries(lokinet-libcrypt INTERFACE PkgConfig::LIBCRYPT)
message(STATUS "using libcrypt ${LIBCRYPT_VERSION}")
else()
# TODO static build lib crypt?
message(STATUS "not building with libcrypt")
endif()
Loading

0 comments on commit 2498a08

Please sign in to comment.