Move source out of root and into the cruft directory

This commit is contained in:
Danny Robson 2024-07-18 09:51:47 +10:00
parent aa8f4590c6
commit ed45e02d33
74 changed files with 62 additions and 44 deletions

View File

@ -1,10 +1,15 @@
###############################################################################
cmake_minimum_required(VERSION 3.7.0)
cmake_minimum_required(VERSION 3.20.0)
project(cruft-crypto CXX)
###############################################################################
nc_deps(util)
find_package (fmt REQUIRED)
###############################################################################
list (APPEND components
hash/blake
hash/blake2
@ -36,6 +41,7 @@ list (APPEND components
###############################################################################
list (APPEND sources fwd.hpp)
foreach (c ${components})
list (APPEND sources "${c}.cpp" "${c}.hpp")
endforeach()
@ -45,7 +51,34 @@ list (APPEND sources
hash/blake/traits.hpp
)
list (TRANSFORM sources PREPEND "cruft/crypto/")
###############################################################################
add_library (libcruft-crypto STATIC ${sources})
target_link_libraries (libcruft-crypto PUBLIC cruft::util PRIVATE fmt::fmt)
##-----------------------------------------------------------------------------
target_include_directories (libcruft-crypto
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)
add_library(cruft::crypto ALIAS libcruft-crypto)
###############################################################################
add_executable (crypto_bench tools/bench.cpp)
target_link_libraries (crypto_bench cruft::crypto)
##-----------------------------------------------------------------------------
add_executable (crypto_hash tools/hash.cpp)
target_link_libraries (crypto_hash cruft::crypto)
###############################################################################
option (TESTS "enable unit testing" ON)
if (TESTS)
@ -55,28 +88,13 @@ if (TESTS)
foreach (t ${components})
string(REPLACE "/" "_" name "test/${t}")
add_executable(crypto_${name} test/${t}.cpp)
target_link_libraries(crypto_${name} PRIVATE cruft-crypto)
target_link_libraries(crypto_${name} PRIVATE cruft::crypto)
target_include_directories(crypto_${name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
add_test(NAME crypto_${name} COMMAND crypto_${name})
endforeach()
endif ()
###############################################################################
add_library (cruft-crypto STATIC ${sources})
target_link_libraries (cruft-crypto INTERFACE cruft PRIVATE fmt::fmt)
##-----------------------------------------------------------------------------
add_executable (crypto_bench tools/bench.cpp)
target_link_libraries (crypto_bench cruft-crypto)
##-----------------------------------------------------------------------------
add_executable (crypto_hash tools/hash.cpp)
target_link_libraries (crypto_hash cruft-crypto)
###############################################################################
configure_file(libcruft-crypto.pc.in libcruft-crypto.pc)
configure_file(Doxyfile.in Doxyfile)

View File

@ -1,6 +1,6 @@
#include <cruft/util/tap.hpp>
#include "block/rc2.hpp"
#include <cruft/crypto/block/rc2.hpp>
#include <cruft/util/endian.hpp>

View File

@ -1,6 +1,6 @@
#include <cruft/util/tap.hpp>
#include "block/speck.hpp"
#include <cruft/crypto/block/speck.hpp>
int

View File

@ -1,4 +1,4 @@
#include "block/tea.hpp"
#include <cruft/crypto/block/tea.hpp>
#include <cruft/util/tap.hpp>
#include <cruft/util/types.hpp>

View File

@ -1,4 +1,4 @@
#include "block/xtea.hpp"
#include <cruft/crypto/block/xtea.hpp>
#include <cruft/util/tap.hpp>
#include <cruft/util/types.hpp>

View File

@ -1,4 +1,4 @@
#include "block/xxtea.hpp"
#include <cruft/crypto/block/xxtea.hpp>
#include <cruft/util/debug/assert.hpp>
#include <cruft/util/tap.hpp>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////
#include "hash/blake.hpp"
#include <cruft/crypto/hash/blake.hpp>
#include <cruft/util/ascii.hpp>
#include <cruft/util/tap.hpp>

View File

@ -1,7 +1,7 @@
#include <cruft/util/ascii.hpp>
#include <cruft/util/tap.hpp>
#include "hash/blake2.hpp"
#include <cruft/crypto/hash/blake2.hpp>
using cruft::crypto::hash::blake2;

View File

@ -1,7 +1,7 @@
#include "hash/hmac.hpp"
#include <cruft/crypto/hash/hmac.hpp>
#include "hash/md5.hpp"
#include "hash/sha1.hpp"
#include <cruft/crypto/hash/md5.hpp>
#include <cruft/crypto/hash/sha1.hpp>
#include <cruft/util/tap.hpp>
#include <cruft/util/types.hpp>

View File

@ -1,4 +1,4 @@
#include "hash/hotp.hpp"
#include <cruft/crypto/hash/hotp.hpp>
#include <cruft/util/tap.hpp>
#include <cruft/util/types.hpp>

View File

@ -1,4 +1,4 @@
#include "hash/md2.hpp"
#include <cruft/crypto/hash/md2.hpp>
#include <cruft/util/tap.hpp>

View File

@ -1,4 +1,4 @@
#include "hash/md4.hpp"
#include <cruft/crypto/hash/md4.hpp>
#include <cruft/util/tap.hpp>

View File

@ -1,4 +1,4 @@
#include "hash/md5.hpp"
#include <cruft/crypto/hash/md5.hpp>
#include <cruft/util/tap.hpp>

View File

@ -1,3 +1,3 @@
#include "hash/md6.hpp"
#include <cruft/crypto/hash/md6.hpp>
int main () {}

View File

@ -1,4 +1,4 @@
#include "hash/ripemd.hpp"
#include <cruft/crypto/hash/ripemd.hpp>
#include <cruft/util/tap.hpp>
#include <cruft/util/types.hpp>

View File

@ -1,4 +1,4 @@
#include "hash/sha1.hpp"
#include <cruft/crypto/hash/sha1.hpp>
#include <cruft/util/debug/assert.hpp>
#include <cruft/util/tap.hpp>

View File

@ -1,4 +1,4 @@
#include "hash/sha2.hpp"
#include <cruft/crypto/hash/sha2.hpp>
#include <cruft/util/tap.hpp>

View File

@ -1,4 +1,4 @@
#include "hash/tiger.hpp"
#include <cruft/crypto/hash/tiger.hpp>
#include <cruft/util/tap.hpp>
#include <cruft/util/endian.hpp>

View File

@ -1,4 +1,4 @@
#include "stream/rc4.hpp"
#include <cruft/crypto/stream/rc4.hpp>
#include <cruft/util/tap.hpp>
#include <cruft/util/types.hpp>

View File

@ -1,4 +1,4 @@
#include "stream/salsa.hpp"
#include <cruft/crypto/stream/salsa.hpp>
#include <cruft/util/tap.hpp>

View File

@ -7,12 +7,12 @@
* 2014-2016, Danny Robson <danny@nerdcruft.net>
*/
#include "../hash/md2.hpp"
#include "../hash/md4.hpp"
#include "../hash/md5.hpp"
#include "../hash/ripemd.hpp"
#include "../hash/sha1.hpp"
#include "../hash/sha2.hpp"
#include <cruft/crypto/hash/md2.hpp>
#include <cruft/crypto/hash/md4.hpp>
#include <cruft/crypto/hash/md5.hpp>
#include <cruft/crypto/hash/ripemd.hpp>
#include <cruft/crypto/hash/sha1.hpp>
#include <cruft/crypto/hash/sha2.hpp>
#include <cruft/util/hash/adler.hpp>
#include <cruft/util/hash/bsdsum.cpp>