Skip to content

Commit

Permalink
Move all submodules into one directory
Browse files Browse the repository at this point in the history
  • Loading branch information
clemahieu committed Jan 23, 2023
1 parent 0acfd54 commit ae4d91d
Show file tree
Hide file tree
Showing 32 changed files with 142 additions and 105 deletions.
38 changes: 19 additions & 19 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
[submodule "miniupnp"]
path = miniupnp
[submodule "submodules/miniupnp"]
path = submodules/miniupnp
url = https://github.com/miniupnp/miniupnp.git
[submodule "lmdb"]
path = lmdb
[submodule "submodules/lmdb"]
path = submodules/lmdb
url = https://github.com/nanocurrency/lmdb.git
branch = lmdb_0_9_23
[submodule "crypto/cryptopp"]
path = crypto/cryptopp
[submodule "submodules/cryptopp"]
path = submodules/cryptopp
url = https://github.com/weidai11/cryptopp.git
[submodule "crypto/phc-winner-argon2"]
path = crypto/phc-winner-argon2
[submodule "submodules/phc-winner-argon2"]
path = submodules/phc-winner-argon2
url = https://github.com/nanocurrency/phc-winner-argon2.git
[submodule "gtest"]
path = gtest
[submodule "submodules/gtest"]
path = submodules/gtest
url = https://github.com/google/googletest.git
[submodule "cpptoml"]
path = cpptoml
[submodule "submodules/cpptoml"]
path = submodules/cpptoml
url = https://github.com/cryptocode/cpptoml.git
[submodule "flatbuffers"]
path = flatbuffers
[submodule "submodules/flatbuffers"]
path = submodules/flatbuffers
url = https://github.com/google/flatbuffers.git
[submodule "rocksdb"]
path = rocksdb
[submodule "submodules/rocksdb"]
path = submodules/rocksdb
url = https://github.com/facebook/rocksdb.git
[submodule "diskhash"]
path = diskhash
[submodule "submodules/diskhash"]
path = submodules/diskhash
url = https://github.com/nanocurrency/diskhash.git
[submodule "boost"]
path = boost
path = submodules/boost
url = https://github.com/boostorg/boost.git
131 changes: 69 additions & 62 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ endif()
include_directories(${CMAKE_SOURCE_DIR})
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules")

set(Boost_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/boost/libs/config/include)
set(Boost_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/submodules/boost/libs/config/include)
set(BOOST_MODULE_LIBS
algorithm
align
Expand Down Expand Up @@ -434,7 +434,7 @@ set(BOOST_MODULE_LIBS

add_definitions(-DBOOST_ALL_NO_LIB) # Disable automatic boost linking
foreach(lib IN LISTS BOOST_MODULE_LIBS)
add_subdirectory(boost/libs/${lib} EXCLUDE_FROM_ALL)
add_subdirectory(submodules/boost/libs/${lib} EXCLUDE_FROM_ALL)
endforeach()
include_directories(${BOOST_LIBRARY_INCLUDES})
add_library(Boost::stacktrace ALIAS boost_stacktrace_basic)
Expand All @@ -451,12 +451,13 @@ target_link_libraries(boost_property_tree INTERFACE Boost::multi_index)

# diskhash
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
add_library(diskhash STATIC ${CMAKE_SOURCE_DIR}/diskhash/src/diskhash.c)
include_directories(diskhash/src)
add_library(diskhash STATIC
${CMAKE_SOURCE_DIR}/submodules/diskhash/src/diskhash.c)
include_directories(submodules/diskhash/src)
endif()

# RocksDB
include_directories(rocksdb/include)
include_directories(submodules/rocksdb/include)
set(USE_RTTI
ON
CACHE BOOL "")
Expand Down Expand Up @@ -492,7 +493,7 @@ set(FAIL_ON_WARNINGS
CACHE BOOL "") # Ignore unreachable code warning in merging_iterator.cc
# RocksDB v7.8.3 on Windows
# https://github.com/facebook/rocksdb/issues/11072
add_subdirectory(rocksdb EXCLUDE_FROM_ALL)
add_subdirectory(submodules/rocksdb EXCLUDE_FROM_ALL)

include_directories(cpptoml/include)
add_subdirectory(crypto/ed25519-donna)
Expand All @@ -503,7 +504,7 @@ add_subdirectory(nano/ipc_flatbuffers_test)
set(UPNPC_BUILD_SHARED
OFF
CACHE BOOL "")
add_subdirectory(miniupnp/miniupnpc EXCLUDE_FROM_ALL)
add_subdirectory(submodules/miniupnp/miniupnpc EXCLUDE_FROM_ALL)

set(BUILD_SHARED
OFF
Expand All @@ -521,13 +522,14 @@ if(WIN32)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64"
AND (NANO_SIMD_OPTIMIZATIONS OR RAIBLOCKS_SIMD_OPTIMIZATIONS))
set(CRYPTOPP_EXTRA
crypto/cryptopp/crc_simd.cpp crypto/cryptopp/gcm_simd.cpp
crypto/cryptopp/gf2n_simd.cpp crypto/cryptopp/neon_simd.cpp)
submodules/cryptopp/crc_simd.cpp submodules/cryptopp/gcm_simd.cpp
submodules/cryptopp/gf2n_simd.cpp submodules/cryptopp/neon_simd.cpp)
add_definitions(-DCRYPTOPP_NO_CPU_FEATURE_PROBES)
endif()
# Some Clang cannot handle mixed asm with positional arguments, where the body
# is Intel style with no prefix and the templates are AT&T style. See:
# crypto/cryptopp/config.h Also see https://bugs.llvm.org/show_bug.cgi?id=39895
# submodules/cryptopp/config.h Also see
# https://bugs.llvm.org/show_bug.cgi?id=39895
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_definitions(-DCRYPTOPP_DISABLE_MIXED_ASM -DCRYPTOPP_DISABLE_ASM)
message(
Expand All @@ -542,68 +544,71 @@ add_definitions(-DCRYPTOPP_DISABLE_CLMUL)
set(CRYPTOPP_LIBRARY cryptopp)
add_library(
cryptopp
crypto/cryptopp/algparam.cpp
crypto/cryptopp/allocate.cpp
crypto/cryptopp/asn.cpp
crypto/cryptopp/basecode.cpp
crypto/cryptopp/cpu.cpp
crypto/cryptopp/cryptlib.cpp
crypto/cryptopp/default.cpp
crypto/cryptopp/des.cpp
crypto/cryptopp/dessp.cpp
crypto/cryptopp/dll.cpp
crypto/cryptopp/ec2n.cpp
crypto/cryptopp/ecp.cpp
crypto/cryptopp/filters.cpp
crypto/cryptopp/fips140.cpp
crypto/cryptopp/gcm.cpp
crypto/cryptopp/gf2n.cpp
crypto/cryptopp/gfpcrypt.cpp
crypto/cryptopp/hex.cpp
crypto/cryptopp/hmac.cpp
crypto/cryptopp/hrtimer.cpp
crypto/cryptopp/integer.cpp
crypto/cryptopp/iterhash.cpp
crypto/cryptopp/misc.cpp
crypto/cryptopp/modes.cpp
crypto/cryptopp/mqueue.cpp
crypto/cryptopp/nbtheory.cpp
crypto/cryptopp/oaep.cpp
crypto/cryptopp/osrng.cpp
crypto/cryptopp/pubkey.cpp
crypto/cryptopp/queue.cpp
crypto/cryptopp/randpool.cpp
crypto/cryptopp/rdtables.cpp
crypto/cryptopp/rijndael.cpp
crypto/cryptopp/rijndael_simd.cpp
crypto/cryptopp/rng.cpp
crypto/cryptopp/sha.cpp
crypto/cryptopp/sha_simd.cpp
crypto/cryptopp/simple.cpp
crypto/cryptopp/sse_simd.cpp
submodules/cryptopp/algparam.cpp
submodules/cryptopp/allocate.cpp
submodules/cryptopp/asn.cpp
submodules/cryptopp/basecode.cpp
submodules/cryptopp/cpu.cpp
submodules/cryptopp/cryptlib.cpp
submodules/cryptopp/default.cpp
submodules/cryptopp/des.cpp
submodules/cryptopp/dessp.cpp
submodules/cryptopp/dll.cpp
submodules/cryptopp/ec2n.cpp
submodules/cryptopp/ecp.cpp
submodules/cryptopp/filters.cpp
submodules/cryptopp/fips140.cpp
submodules/cryptopp/gcm.cpp
submodules/cryptopp/gf2n.cpp
submodules/cryptopp/gfpcrypt.cpp
submodules/cryptopp/hex.cpp
submodules/cryptopp/hmac.cpp
submodules/cryptopp/hrtimer.cpp
submodules/cryptopp/integer.cpp
submodules/cryptopp/iterhash.cpp
submodules/cryptopp/misc.cpp
submodules/cryptopp/modes.cpp
submodules/cryptopp/mqueue.cpp
submodules/cryptopp/nbtheory.cpp
submodules/cryptopp/oaep.cpp
submodules/cryptopp/osrng.cpp
submodules/cryptopp/pubkey.cpp
submodules/cryptopp/queue.cpp
submodules/cryptopp/randpool.cpp
submodules/cryptopp/rdtables.cpp
submodules/cryptopp/rijndael.cpp
submodules/cryptopp/rijndael_simd.cpp
submodules/cryptopp/rng.cpp
submodules/cryptopp/sha.cpp
submodules/cryptopp/sha_simd.cpp
submodules/cryptopp/simple.cpp
submodules/cryptopp/sse_simd.cpp
${CRYPTOPP_EXTRA})

if(WIN32 OR CMAKE_SYSTEM_PROCESSOR MATCHES "^(i.86|x86(_64)?)$")
set(ARGON_CORE crypto/phc-winner-argon2/src/opt.c)
set(ARGON_CORE submodules/phc-winner-argon2/src/opt.c)
else()
set(ARGON_CORE crypto/phc-winner-argon2/src/ref.c)
set(ARGON_CORE submodules/phc-winner-argon2/src/ref.c)
endif()

add_library(
argon2
crypto/phc-winner-argon2/src/argon2.c
crypto/phc-winner-argon2/include/argon2.h
crypto/phc-winner-argon2/src/core.c
crypto/phc-winner-argon2/src/thread.c
crypto/phc-winner-argon2/src/encoding.c
submodules/phc-winner-argon2/src/argon2.c
submodules/phc-winner-argon2/include/argon2.h
submodules/phc-winner-argon2/src/core.c
submodules/phc-winner-argon2/src/thread.c
submodules/phc-winner-argon2/src/encoding.c
${ARGON_CORE})

target_include_directories(argon2 PUBLIC crypto/phc-winner-argon2/include)
target_include_directories(argon2 PUBLIC crypto/phc-winner-argon2/src)
target_include_directories(argon2 PUBLIC submodules/phc-winner-argon2/include)
target_include_directories(argon2 PUBLIC submodules/phc-winner-argon2/src)
target_include_directories(argon2 PUBLIC crypto/blake2)

add_library(lmdb lmdb/libraries/liblmdb/lmdb.h lmdb/libraries/liblmdb/mdb.c
lmdb/libraries/liblmdb/midl.c)
add_library(
lmdb
submodules/lmdb/libraries/liblmdb/lmdb.h
submodules/lmdb/libraries/liblmdb/mdb.c
submodules/lmdb/libraries/liblmdb/midl.c)

if(WIN32)
target_link_libraries(lmdb ntdll)
Expand Down Expand Up @@ -657,13 +662,13 @@ if(NANO_TEST OR RAIBLOCKS_TEST)

# FIXME: This fixes googletest GOOGLETEST_VERSION requirement
set(GOOGLETEST_VERSION 1.11.0)
add_subdirectory(gtest/googletest)
add_subdirectory(submodules/gtest/googletest)
# FIXME: This fixes gtest include directories without modifying gtest's
# CMakeLists.txt. Ideally we should use GTest::GTest and GTest::Main as
# dependencies but it requires building gtest differently
set_target_properties(
gtest PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
"${CMAKE_SOURCE_DIR}/gtest/googletest/include")
"${CMAKE_SOURCE_DIR}/submodules/gtest/googletest/include")

add_subdirectory(nano/test_common)
add_subdirectory(nano/core_test)
Expand Down Expand Up @@ -709,6 +714,8 @@ if(NANO_GUI OR RAIBLOCKS_GUI)
find_package(Qt5 COMPONENTS Core Gui Widgets Test ${PLATFORM_QT_PACKAGES})

add_library(qt nano/qt/qt.cpp nano/qt/qt.hpp)
include_directories(${CMAKE_SOURCE_DIR}/submodules)
include_directories(${CMAKE_SOURCE_DIR}/submodules/cpptoml/include)

target_link_libraries(
qt
Expand Down
11 changes: 6 additions & 5 deletions coverage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ add_custom_target(
COMMAND echo "REMOVING FLUFF FROM REPORT"
COMMAND
${LCOV_PATH} --remove lcov.info.raw '/usr/*' '/tmp/*'
'${PROJECT_SOURCE_DIR}/cpptoml/*' '${PROJECT_SOURCE_DIR}/crypto/*'
'${PROJECT_SOURCE_DIR}/flatbuffers/*' '${PROJECT_SOURCE_DIR}/gtest/*'
'${PROJECT_SOURCE_DIR}/rocksdb/*' '${PROJECT_SOURCE_DIR}/valgrind/*'
'${PROJECT_SOURCE_DIR}/nano/core_test/*' '${PROJECT_SOURCE_DIR}/diskhash/*'
'${PROJECT_SOURCE_DIR}/nano/load_test/*'
'${PROJECT_SOURCE_DIR}/submodules/cpptoml/*'
'${PROJECT_SOURCE_DIR}/crypto/*'
'${PROJECT_SOURCE_DIR}/submodules/flatbuffers/*'
'${PROJECT_SOURCE_DIR}/gtest/*' '${PROJECT_SOURCE_DIR}/submodules/rocksdb/*'
'${PROJECT_SOURCE_DIR}/valgrind/*' '${PROJECT_SOURCE_DIR}/nano/core_test/*'
'${PROJECT_SOURCE_DIR}/diskhash/*' '${PROJECT_SOURCE_DIR}/nano/load_test/*'
'${PROJECT_SOURCE_DIR}/nano/ipc_flatbuffers_test/*'
'${PROJECT_SOURCE_DIR}/nano/ipc_flatbuffers_lib/*'
'${PROJECT_SOURCE_DIR}/nano/nano_node/*'
Expand Down
4 changes: 4 additions & 0 deletions nano/core_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,7 @@ target_link_libraries(
libminiupnpc-static
Boost::log_setup
Boost::log)

include_directories(${CMAKE_SOURCE_DIR}/submodules)
include_directories(${CMAKE_SOURCE_DIR}/submodules/cpptoml/include)
include_directories(${CMAKE_SOURCE_DIR}/submodules/gtest/googletest/include)
4 changes: 2 additions & 2 deletions nano/crypto_lib/random_pool.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <nano/crypto_lib/random_pool.hpp>

#include <crypto/cryptopp/misc.h>
#include <crypto/cryptopp/osrng.h>
#include <submodules/cryptopp/misc.h>
#include <submodules/cryptopp/osrng.h>

void nano::random_pool::generate_block (unsigned char * output, size_t size)
{
Expand Down
2 changes: 1 addition & 1 deletion nano/crypto_lib/random_pool_shuffle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <nano/crypto_lib/random_pool.hpp>

#include <crypto/cryptopp/osrng.h>
#include <cryptopp/osrng.h>

namespace nano
{
Expand Down
2 changes: 1 addition & 1 deletion nano/ipc_flatbuffers_lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ mark_as_advanced(
FLATBUFFERS_PACKAGE_DEBIAN
FLATBUFFERS_PACKAGE_REDHAT
FLATBUFFERS_STATIC_FLATC)
add_subdirectory(../../flatbuffers
add_subdirectory(../../submodules/flatbuffers
${CMAKE_CURRENT_BINARY_DIR}/flatbuffers-build EXCLUDE_FROM_ALL)

# Generate Flatbuffers files into the ipc_flatbuffers_lib library, which will be
Expand Down
5 changes: 5 additions & 0 deletions nano/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ add_library(
work.hpp
work.cpp)

include_directories(${CMAKE_SOURCE_DIR}/submodules)
include_directories(${CMAKE_SOURCE_DIR}/submodules/cpptoml/include)
include_directories(
${CMAKE_SOURCE_DIR}/submodules/nano-pow-server/deps/cpptoml/include)

target_link_libraries(
nano_lib
ed25519
Expand Down
4 changes: 2 additions & 2 deletions nano/lib/blockbuilders.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include <nano/lib/blockbuilders.hpp>

#include <crypto/cryptopp/osrng.h>

#include <unordered_map>

#include <cryptopp/osrng.h>

namespace
{
template <typename BLOCKTYPE>
Expand Down
4 changes: 2 additions & 2 deletions nano/lib/blocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
#include <nano/lib/threading.hpp>
#include <nano/secure/common.hpp>

#include <crypto/cryptopp/words.h>

#include <boost/endian/conversion.hpp>
#include <boost/property_tree/json_parser.hpp>

#include <bitset>

#include <cryptopp/words.h>

/** Compare blocks, first by type, then content. This is an optimization over dynamic_cast, which is very slow on some platforms. */
namespace
{
Expand Down
5 changes: 2 additions & 3 deletions nano/lib/numbers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
#include <nano/lib/utility.hpp>
#include <nano/secure/common.hpp>

#include <crypto/cryptopp/aes.h>
#include <crypto/cryptopp/modes.h>

#include <crypto/ed25519-donna/ed25519.h>
#include <cryptopp/aes.h>
#include <cryptopp/modes.h>

namespace
{
Expand Down
4 changes: 4 additions & 0 deletions nano/load_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
add_executable(load_test entry.cpp)

target_link_libraries(load_test boost_process node secure test_common gtest)

include_directories(${CMAKE_SOURCE_DIR}/submodules)
include_directories(${CMAKE_SOURCE_DIR}/submodules/cpptoml/include)
include_directories(${CMAKE_SOURCE_DIR}/submodules/gtest/googletest/include)
1 change: 1 addition & 0 deletions nano/nano_node/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ target_link_libraries(
secure
argon2
${PLATFORM_LIBS})
include_directories(${CMAKE_SOURCE_DIR}/submodules)

target_compile_definitions(
nano_node PRIVATE -DTAG_VERSION_STRING=${TAG_VERSION_STRING}
Expand Down
Loading

0 comments on commit ae4d91d

Please sign in to comment.