mirror of
https://github.com/XRPLF/clio.git
synced 2026-04-29 15:37:53 +00:00
@@ -75,7 +75,7 @@ else
|
||||
grep_code "#include <\($main_src_dirs\)/.*>" | xargs sed -i -E "s|#include <(($main_src_dirs)/.*)>|#include \"\1\"|g"
|
||||
fi
|
||||
|
||||
cmake_dirs=$(echo CMake $sources)
|
||||
cmake_dirs=$(echo cmake $sources)
|
||||
cmake_files=$(find $cmake_dirs -type f \( -name "CMakeLists.txt" -o -name "*.cmake" \))
|
||||
cmake_files=$(echo $cmake_files ./CMakeLists.txt)
|
||||
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
set(Boost_USE_STATIC_LIBS ON)
|
||||
set(Boost_USE_STATIC_RUNTIME ON)
|
||||
|
||||
find_package(Boost 1.82 REQUIRED COMPONENTS program_options coroutine system log log_setup)
|
||||
@@ -1 +0,0 @@
|
||||
find_package(cassandra-cpp-driver REQUIRED)
|
||||
@@ -1 +0,0 @@
|
||||
find_package(benchmark REQUIRED)
|
||||
@@ -1,3 +0,0 @@
|
||||
target_compile_definitions(clio PUBLIC BOOST_STACKTRACE_LINK)
|
||||
target_compile_definitions(clio PUBLIC BOOST_STACKTRACE_USE_BACKTRACE)
|
||||
find_package(libbacktrace REQUIRED)
|
||||
@@ -1 +0,0 @@
|
||||
find_package(fmt REQUIRED)
|
||||
@@ -1 +0,0 @@
|
||||
find_package(xrpl REQUIRED)
|
||||
440
CMakeLists.txt
440
CMakeLists.txt
@@ -1,5 +1,10 @@
|
||||
cmake_minimum_required(VERSION 3.16.3)
|
||||
project(clio)
|
||||
|
||||
set(CMAKE_PROJECT_INCLUDE_BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/cmake/ClioVersion.cmake)
|
||||
|
||||
project(clio VERSION ${CLIO_VERSION} HOMEPAGE_URL "https://github.com/XRPLF/clio"
|
||||
DESCRIPTION "An XRP Ledger API Server"
|
||||
)
|
||||
|
||||
# =========================== Options ====================================== #
|
||||
option(verbose "Verbose build" FALSE)
|
||||
@@ -15,15 +20,23 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
|
||||
set_property(CACHE san PROPERTY STRINGS ";undefined;memory;address;thread")
|
||||
# ========================================================================== #
|
||||
|
||||
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
|
||||
|
||||
# Include required modules
|
||||
include(CMake/Ccache.cmake)
|
||||
include(Ccache)
|
||||
include(CheckCXXCompilerFlag)
|
||||
include(CMake/ClangTidy.cmake)
|
||||
include(ClangTidy)
|
||||
|
||||
add_library(clio_options INTERFACE)
|
||||
target_include_directories(clio_options INTERFACE ${CMAKE_SOURCE_DIR}/src)
|
||||
|
||||
# Set coverage build options
|
||||
if (tests AND coverage)
|
||||
include(CMake/CodeCoverage.cmake)
|
||||
append_coverage_compiler_flags()
|
||||
if (coverage)
|
||||
if (NOT tests)
|
||||
message(FATAL_ERROR "Coverage requires tests to be enabled")
|
||||
endif ()
|
||||
include(CodeCoverage)
|
||||
append_coverage_compiler_flags_to_target(clio_options INTERFACE)
|
||||
endif ()
|
||||
|
||||
if (verbose)
|
||||
@@ -32,414 +45,31 @@ endif ()
|
||||
|
||||
if (packaging)
|
||||
add_definitions(-DPKG=1)
|
||||
target_compile_definitions(clio_options INTERFACE PKG=1)
|
||||
endif ()
|
||||
|
||||
add_library(clio)
|
||||
|
||||
# Clio tweaks and checks
|
||||
include(CMake/CheckCompiler.cmake)
|
||||
include(CMake/Settings.cmake)
|
||||
include(CMake/ClioVersion.cmake)
|
||||
include(CMake/SourceLocation.cmake)
|
||||
include(CheckCompiler)
|
||||
include(Settings)
|
||||
include(SourceLocation)
|
||||
|
||||
# Clio deps
|
||||
include(CMake/deps/libxrpl.cmake)
|
||||
include(CMake/deps/Boost.cmake)
|
||||
include(CMake/deps/OpenSSL.cmake)
|
||||
include(CMake/deps/Threads.cmake)
|
||||
include(CMake/deps/libfmt.cmake)
|
||||
include(CMake/deps/cassandra.cmake)
|
||||
include(CMake/deps/libbacktrace.cmake)
|
||||
include(deps/libxrpl)
|
||||
include(deps/Boost)
|
||||
include(deps/OpenSSL)
|
||||
include(deps/Threads)
|
||||
include(deps/libfmt)
|
||||
include(deps/cassandra)
|
||||
include(deps/libbacktrace)
|
||||
|
||||
# TODO: Include directory will be wrong when installed.
|
||||
target_include_directories(clio PUBLIC src)
|
||||
target_compile_features(clio PUBLIC cxx_std_20)
|
||||
add_subdirectory(src)
|
||||
|
||||
target_link_libraries(
|
||||
clio
|
||||
PUBLIC Boost::boost
|
||||
PUBLIC Boost::coroutine
|
||||
PUBLIC Boost::program_options
|
||||
PUBLIC Boost::system
|
||||
PUBLIC Boost::log
|
||||
PUBLIC Boost::log_setup
|
||||
PUBLIC Boost::stacktrace_backtrace
|
||||
PUBLIC cassandra-cpp-driver::cassandra-cpp-driver
|
||||
PUBLIC fmt::fmt
|
||||
PUBLIC OpenSSL::Crypto
|
||||
PUBLIC OpenSSL::SSL
|
||||
PUBLIC xrpl::libxrpl
|
||||
PUBLIC dl
|
||||
PUBLIC libbacktrace::libbacktrace
|
||||
INTERFACE Threads::Threads
|
||||
)
|
||||
|
||||
if (is_gcc)
|
||||
# FIXME: needed on gcc for now
|
||||
target_compile_definitions(clio PUBLIC BOOST_ASIO_DISABLE_CONCEPTS)
|
||||
endif ()
|
||||
|
||||
target_sources(
|
||||
clio
|
||||
PRIVATE # Main
|
||||
src/main/impl/Build.cpp
|
||||
# Backend
|
||||
src/data/BackendCounters.cpp
|
||||
src/data/BackendInterface.cpp
|
||||
src/data/LedgerCache.cpp
|
||||
src/data/cassandra/impl/Future.cpp
|
||||
src/data/cassandra/impl/Cluster.cpp
|
||||
src/data/cassandra/impl/Batch.cpp
|
||||
src/data/cassandra/impl/Result.cpp
|
||||
src/data/cassandra/impl/Tuple.cpp
|
||||
src/data/cassandra/impl/SslContext.cpp
|
||||
src/data/cassandra/Handle.cpp
|
||||
src/data/cassandra/SettingsProvider.cpp
|
||||
# ETL
|
||||
src/etl/NFTHelpers.cpp
|
||||
src/etl/ETLService.cpp
|
||||
src/etl/ETLState.cpp
|
||||
src/etl/LoadBalancer.cpp
|
||||
src/etl/CacheLoaderSettings.cpp
|
||||
src/etl/Source.cpp
|
||||
src/etl/impl/ForwardingCache.cpp
|
||||
src/etl/impl/ForwardingSource.cpp
|
||||
src/etl/impl/GrpcSource.cpp
|
||||
src/etl/impl/SubscriptionSource.cpp
|
||||
# Feed
|
||||
src/feed/SubscriptionManager.cpp
|
||||
src/feed/impl/TransactionFeed.cpp
|
||||
src/feed/impl/LedgerFeed.cpp
|
||||
src/feed/impl/ProposedTransactionFeed.cpp
|
||||
src/feed/impl/SingleFeedBase.cpp
|
||||
# Web
|
||||
src/web/impl/AdminVerificationStrategy.cpp
|
||||
src/web/IntervalSweepHandler.cpp
|
||||
src/web/Resolver.cpp
|
||||
# RPC
|
||||
src/rpc/Errors.cpp
|
||||
src/rpc/Factories.cpp
|
||||
src/rpc/AMMHelpers.cpp
|
||||
src/rpc/RPCHelpers.cpp
|
||||
src/rpc/Counters.cpp
|
||||
src/rpc/WorkQueue.cpp
|
||||
src/rpc/common/Specs.cpp
|
||||
src/rpc/common/Validators.cpp
|
||||
src/rpc/common/MetaProcessors.cpp
|
||||
src/rpc/common/impl/APIVersionParser.cpp
|
||||
src/rpc/common/impl/HandlerProvider.cpp
|
||||
# RPC handlers
|
||||
src/rpc/handlers/AccountChannels.cpp
|
||||
src/rpc/handlers/AccountCurrencies.cpp
|
||||
src/rpc/handlers/AccountInfo.cpp
|
||||
src/rpc/handlers/AccountLines.cpp
|
||||
src/rpc/handlers/AccountNFTs.cpp
|
||||
src/rpc/handlers/AccountObjects.cpp
|
||||
src/rpc/handlers/AccountOffers.cpp
|
||||
src/rpc/handlers/AccountTx.cpp
|
||||
src/rpc/handlers/AMMInfo.cpp
|
||||
src/rpc/handlers/BookChanges.cpp
|
||||
src/rpc/handlers/BookOffers.cpp
|
||||
src/rpc/handlers/DepositAuthorized.cpp
|
||||
src/rpc/handlers/GatewayBalances.cpp
|
||||
src/rpc/handlers/Ledger.cpp
|
||||
src/rpc/handlers/LedgerData.cpp
|
||||
src/rpc/handlers/LedgerEntry.cpp
|
||||
src/rpc/handlers/LedgerRange.cpp
|
||||
src/rpc/handlers/NFTsByIssuer.cpp
|
||||
src/rpc/handlers/NFTBuyOffers.cpp
|
||||
src/rpc/handlers/NFTHistory.cpp
|
||||
src/rpc/handlers/NFTInfo.cpp
|
||||
src/rpc/handlers/NFTOffersCommon.cpp
|
||||
src/rpc/handlers/NFTSellOffers.cpp
|
||||
src/rpc/handlers/NoRippleCheck.cpp
|
||||
src/rpc/handlers/Random.cpp
|
||||
src/rpc/handlers/TransactionEntry.cpp
|
||||
# Util
|
||||
src/util/config/Config.cpp
|
||||
src/util/log/Logger.cpp
|
||||
src/util/prometheus/Http.cpp
|
||||
src/util/prometheus/Label.cpp
|
||||
src/util/prometheus/MetricBase.cpp
|
||||
src/util/prometheus/MetricBuilder.cpp
|
||||
src/util/prometheus/MetricsFamily.cpp
|
||||
src/util/prometheus/OStream.cpp
|
||||
src/util/prometheus/Prometheus.cpp
|
||||
src/util/Random.cpp
|
||||
src/util/Retry.cpp
|
||||
src/util/requests/RequestBuilder.cpp
|
||||
src/util/requests/Types.cpp
|
||||
src/util/requests/WsConnection.cpp
|
||||
src/util/requests/impl/SslContext.cpp
|
||||
src/util/Taggable.cpp
|
||||
src/util/TerminationHandler.cpp
|
||||
src/util/TxUtils.cpp
|
||||
src/util/LedgerUtils.cpp
|
||||
)
|
||||
|
||||
# Clio server
|
||||
add_executable(clio_server src/main/Main.cpp)
|
||||
target_link_libraries(clio_server PRIVATE clio)
|
||||
target_link_options(
|
||||
clio_server PRIVATE $<$<AND:$<NOT:$<BOOL:${APPLE}>>,$<NOT:$<BOOL:${san}>>>:-static-libstdc++ -static-libgcc>
|
||||
)
|
||||
|
||||
# Unittesting
|
||||
if (tests)
|
||||
set(TEST_TARGET clio_tests)
|
||||
add_executable(
|
||||
${TEST_TARGET}
|
||||
# Common
|
||||
unittests/ConfigTests.cpp
|
||||
unittests/data/BackendCountersTests.cpp
|
||||
unittests/data/BackendCountersTests.cpp
|
||||
unittests/data/BackendFactoryTests.cpp
|
||||
unittests/data/BackendFactoryTests.cpp
|
||||
unittests/data/cassandra/AsyncExecutorTests.cpp
|
||||
# Webserver
|
||||
unittests/data/cassandra/AsyncExecutorTests.cpp
|
||||
# Webserver
|
||||
unittests/data/cassandra/BackendTests.cpp
|
||||
unittests/data/cassandra/BackendTests.cpp
|
||||
unittests/data/cassandra/BaseTests.cpp
|
||||
unittests/data/cassandra/BaseTests.cpp
|
||||
unittests/data/cassandra/ExecutionStrategyTests.cpp
|
||||
unittests/data/cassandra/ExecutionStrategyTests.cpp
|
||||
unittests/data/cassandra/RetryPolicyTests.cpp
|
||||
unittests/data/cassandra/RetryPolicyTests.cpp
|
||||
unittests/data/cassandra/SettingsProviderTests.cpp
|
||||
unittests/data/cassandra/SettingsProviderTests.cpp
|
||||
unittests/DOSGuardTests.cpp
|
||||
unittests/etl/AmendmentBlockHandlerTests.cpp
|
||||
unittests/etl/AmendmentBlockHandlerTests.cpp
|
||||
unittests/etl/CacheLoaderSettingsTests.cpp
|
||||
unittests/etl/CacheLoaderTests.cpp
|
||||
unittests/etl/CacheLoaderTests.cpp
|
||||
unittests/etl/CursorProviderTests.cpp
|
||||
unittests/etl/ETLStateTests.cpp
|
||||
unittests/etl/ETLStateTests.cpp
|
||||
unittests/etl/ExtractionDataPipeTests.cpp
|
||||
unittests/etl/ExtractionDataPipeTests.cpp
|
||||
unittests/etl/ExtractorTests.cpp
|
||||
unittests/etl/ExtractorTests.cpp
|
||||
unittests/etl/ForwardingCacheTests.cpp
|
||||
unittests/etl/ForwardingSourceTests.cpp
|
||||
unittests/etl/ForwardingSourceTests.cpp
|
||||
unittests/etl/GrpcSourceTests.cpp
|
||||
unittests/etl/GrpcSourceTests.cpp
|
||||
unittests/etl/LedgerPublisherTests.cpp
|
||||
unittests/etl/LedgerPublisherTests.cpp
|
||||
unittests/etl/SourceTests.cpp
|
||||
unittests/etl/SourceTests.cpp
|
||||
unittests/etl/SubscriptionSourceDependenciesTests.cpp
|
||||
unittests/etl/SubscriptionSourceDependenciesTests.cpp
|
||||
unittests/etl/SubscriptionSourceTests.cpp
|
||||
unittests/etl/SubscriptionSourceTests.cpp
|
||||
unittests/etl/TransformerTests.cpp
|
||||
# RPC
|
||||
unittests/etl/TransformerTests.cpp
|
||||
# RPC
|
||||
unittests/feed/BookChangesFeedTests.cpp
|
||||
unittests/feed/ForwardFeedTests.cpp
|
||||
unittests/feed/LedgerFeedTests.cpp
|
||||
unittests/feed/ProposedTransactionFeedTests.cpp
|
||||
unittests/feed/SingleFeedBaseTests.cpp
|
||||
unittests/feed/SubscriptionManagerTests.cpp
|
||||
unittests/feed/TrackableSignalTests.cpp
|
||||
unittests/feed/TransactionFeedTests.cpp
|
||||
unittests/JsonUtilTests.cpp
|
||||
unittests/LoggerTests.cpp
|
||||
unittests/Main.cpp
|
||||
unittests/Playground.cpp
|
||||
unittests/ProfilerTests.cpp
|
||||
unittests/rpc/AmendmentsTests.cpp
|
||||
unittests/rpc/AmendmentsTests.cpp
|
||||
unittests/rpc/APIVersionTests.cpp
|
||||
unittests/rpc/APIVersionTests.cpp
|
||||
unittests/rpc/BaseTests.cpp
|
||||
unittests/rpc/BaseTests.cpp
|
||||
unittests/rpc/CountersTests.cpp
|
||||
unittests/rpc/CountersTests.cpp
|
||||
unittests/rpc/ErrorTests.cpp
|
||||
unittests/rpc/ErrorTests.cpp
|
||||
unittests/rpc/ForwardingProxyTests.cpp
|
||||
unittests/rpc/ForwardingProxyTests.cpp
|
||||
unittests/rpc/handlers/AccountChannelsTests.cpp
|
||||
unittests/rpc/handlers/AccountChannelsTests.cpp
|
||||
unittests/rpc/handlers/AccountCurrenciesTests.cpp
|
||||
unittests/rpc/handlers/AccountCurrenciesTests.cpp
|
||||
unittests/rpc/handlers/AccountInfoTests.cpp
|
||||
unittests/rpc/handlers/AccountInfoTests.cpp
|
||||
unittests/rpc/handlers/AccountLinesTests.cpp
|
||||
unittests/rpc/handlers/AccountLinesTests.cpp
|
||||
unittests/rpc/handlers/AccountNFTsTests.cpp
|
||||
unittests/rpc/handlers/AccountNFTsTests.cpp
|
||||
unittests/rpc/handlers/AccountObjectsTests.cpp
|
||||
unittests/rpc/handlers/AccountObjectsTests.cpp
|
||||
unittests/rpc/handlers/AccountOffersTests.cpp
|
||||
unittests/rpc/handlers/AccountOffersTests.cpp
|
||||
unittests/rpc/handlers/AccountTxTests.cpp
|
||||
unittests/rpc/handlers/AccountTxTests.cpp
|
||||
unittests/rpc/handlers/AMMInfoTests.cpp
|
||||
# Backend
|
||||
unittests/rpc/handlers/AMMInfoTests.cpp
|
||||
# Backend
|
||||
unittests/rpc/handlers/BookChangesTests.cpp
|
||||
unittests/rpc/handlers/BookChangesTests.cpp
|
||||
unittests/rpc/handlers/BookOffersTests.cpp
|
||||
unittests/rpc/handlers/BookOffersTests.cpp
|
||||
unittests/rpc/handlers/DefaultProcessorTests.cpp
|
||||
unittests/rpc/handlers/DefaultProcessorTests.cpp
|
||||
unittests/rpc/handlers/DepositAuthorizedTests.cpp
|
||||
unittests/rpc/handlers/DepositAuthorizedTests.cpp
|
||||
unittests/rpc/handlers/GatewayBalancesTests.cpp
|
||||
unittests/rpc/handlers/GatewayBalancesTests.cpp
|
||||
unittests/rpc/handlers/LedgerDataTests.cpp
|
||||
unittests/rpc/handlers/LedgerDataTests.cpp
|
||||
unittests/rpc/handlers/LedgerEntryTests.cpp
|
||||
unittests/rpc/handlers/LedgerEntryTests.cpp
|
||||
unittests/rpc/handlers/LedgerRangeTests.cpp
|
||||
unittests/rpc/handlers/LedgerRangeTests.cpp
|
||||
unittests/rpc/handlers/LedgerTests.cpp
|
||||
unittests/rpc/handlers/LedgerTests.cpp
|
||||
unittests/rpc/handlers/NFTBuyOffersTests.cpp
|
||||
unittests/rpc/handlers/NFTBuyOffersTests.cpp
|
||||
unittests/rpc/handlers/NFTHistoryTests.cpp
|
||||
unittests/rpc/handlers/NFTHistoryTests.cpp
|
||||
unittests/rpc/handlers/NFTInfoTests.cpp
|
||||
unittests/rpc/handlers/NFTInfoTests.cpp
|
||||
unittests/rpc/handlers/NFTsByIssuerTest.cpp
|
||||
unittests/rpc/handlers/NFTsByIssuerTest.cpp
|
||||
unittests/rpc/handlers/NFTSellOffersTests.cpp
|
||||
unittests/rpc/handlers/NFTSellOffersTests.cpp
|
||||
unittests/rpc/handlers/NoRippleCheckTests.cpp
|
||||
unittests/rpc/handlers/NoRippleCheckTests.cpp
|
||||
unittests/rpc/handlers/PingTests.cpp
|
||||
unittests/rpc/handlers/PingTests.cpp
|
||||
unittests/rpc/handlers/RandomTests.cpp
|
||||
unittests/rpc/handlers/RandomTests.cpp
|
||||
unittests/rpc/handlers/ServerInfoTests.cpp
|
||||
unittests/rpc/handlers/ServerInfoTests.cpp
|
||||
unittests/rpc/handlers/SubscribeTests.cpp
|
||||
unittests/rpc/handlers/SubscribeTests.cpp
|
||||
unittests/rpc/handlers/TestHandlerTests.cpp
|
||||
unittests/rpc/handlers/TestHandlerTests.cpp
|
||||
unittests/rpc/handlers/TransactionEntryTests.cpp
|
||||
unittests/rpc/handlers/TransactionEntryTests.cpp
|
||||
unittests/rpc/handlers/TxTests.cpp
|
||||
unittests/rpc/handlers/TxTests.cpp
|
||||
unittests/rpc/handlers/UnsubscribeTests.cpp
|
||||
unittests/rpc/handlers/UnsubscribeTests.cpp
|
||||
unittests/rpc/handlers/VersionHandlerTests.cpp
|
||||
unittests/rpc/handlers/VersionHandlerTests.cpp
|
||||
unittests/rpc/JsonBoolTests.cpp
|
||||
# RPC handlers
|
||||
unittests/rpc/JsonBoolTests.cpp
|
||||
# RPC handlers
|
||||
unittests/rpc/RPCHelpersTests.cpp
|
||||
unittests/rpc/RPCHelpersTests.cpp
|
||||
unittests/rpc/WorkQueueTests.cpp
|
||||
unittests/rpc/WorkQueueTests.cpp
|
||||
unittests/util/AssertTests.cpp
|
||||
unittests/util/async/AnyExecutionContextTests.cpp
|
||||
unittests/util/async/AnyOperationTests.cpp
|
||||
unittests/util/async/AnyStopTokenTests.cpp
|
||||
unittests/util/async/AnyStrandTests.cpp
|
||||
unittests/util/async/AsyncExecutionContextTests.cpp
|
||||
# Requests framework
|
||||
unittests/util/BatchingTests.cpp
|
||||
unittests/util/LedgerUtilsTests.cpp
|
||||
# Prometheus support
|
||||
unittests/util/prometheus/CounterTests.cpp
|
||||
unittests/util/prometheus/GaugeTests.cpp
|
||||
unittests/util/prometheus/HistogramTests.cpp
|
||||
unittests/util/prometheus/HttpTests.cpp
|
||||
unittests/util/prometheus/LabelTests.cpp
|
||||
unittests/util/prometheus/MetricBuilderTests.cpp
|
||||
unittests/util/prometheus/MetricsFamilyTests.cpp
|
||||
unittests/util/prometheus/OStreamTests.cpp
|
||||
unittests/util/requests/RequestBuilderTests.cpp
|
||||
unittests/util/requests/SslContextTests.cpp
|
||||
unittests/util/requests/WsConnectionTests.cpp
|
||||
# ETL
|
||||
unittests/util/RetryTests.cpp
|
||||
# Async framework
|
||||
unittests/util/StringUtils.cpp
|
||||
unittests/util/TestGlobals.cpp
|
||||
unittests/util/TestHttpServer.cpp
|
||||
unittests/util/TestObject.cpp
|
||||
unittests/util/TestWsServer.cpp
|
||||
unittests/util/TxUtilTests.cpp
|
||||
unittests/web/AdminVerificationTests.cpp
|
||||
unittests/web/RPCServerHandlerTests.cpp
|
||||
unittests/web/ServerTests.cpp
|
||||
unittests/web/SweepHandlerTests.cpp
|
||||
# Feed
|
||||
unittests/web/WhitelistHandlerTests.cpp
|
||||
)
|
||||
|
||||
include(CMake/deps/gtest.cmake)
|
||||
|
||||
# See https://github.com/google/googletest/issues/3475
|
||||
gtest_discover_tests(clio_tests DISCOVERY_TIMEOUT 90)
|
||||
|
||||
# Fix for dwarf5 bug on ci
|
||||
target_compile_options(clio PUBLIC -gdwarf-4)
|
||||
|
||||
target_compile_definitions(${TEST_TARGET} PUBLIC UNITTEST_BUILD)
|
||||
target_include_directories(${TEST_TARGET} PRIVATE unittests)
|
||||
target_link_libraries(${TEST_TARGET} PUBLIC clio gtest::gtest)
|
||||
|
||||
# Generate `coverage_report` target if coverage is enabled
|
||||
if (coverage)
|
||||
if (DEFINED CODE_COVERAGE_REPORT_FORMAT)
|
||||
set(CODE_COVERAGE_FORMAT ${CODE_COVERAGE_REPORT_FORMAT})
|
||||
else ()
|
||||
set(CODE_COVERAGE_FORMAT html-details)
|
||||
endif ()
|
||||
|
||||
if (DEFINED CODE_COVERAGE_TESTS_ARGS)
|
||||
set(TESTS_ADDITIONAL_ARGS ${CODE_COVERAGE_TESTS_ARGS})
|
||||
separate_arguments(TESTS_ADDITIONAL_ARGS)
|
||||
else ()
|
||||
set(TESTS_ADDITIONAL_ARGS "")
|
||||
endif ()
|
||||
|
||||
set(GCOVR_ADDITIONAL_ARGS --exclude-throw-branches -s)
|
||||
|
||||
setup_target_for_coverage_gcovr(
|
||||
NAME
|
||||
coverage_report
|
||||
FORMAT
|
||||
${CODE_COVERAGE_FORMAT}
|
||||
EXECUTABLE
|
||||
clio_tests
|
||||
EXECUTABLE_ARGS
|
||||
--gtest_brief=1
|
||||
${TESTS_ADDITIONAL_ARGS}
|
||||
EXCLUDE
|
||||
"unittests"
|
||||
DEPENDENCIES
|
||||
clio_tests
|
||||
)
|
||||
endif ()
|
||||
add_subdirectory(unittests)
|
||||
endif ()
|
||||
|
||||
# Benchmarks
|
||||
if (benchmark)
|
||||
set(BENCH_TARGET clio_benchmarks)
|
||||
add_executable(
|
||||
${BENCH_TARGET}
|
||||
# Common
|
||||
benchmarks/Main.cpp benchmarks/Playground.cpp
|
||||
# ExecutionContext
|
||||
benchmarks/util/async/ExecutionContextBenchmarks.cpp
|
||||
)
|
||||
|
||||
include(CMake/deps/gbench.cmake)
|
||||
|
||||
target_include_directories(${BENCH_TARGET} PRIVATE benchmarks)
|
||||
target_link_libraries(${BENCH_TARGET} PUBLIC clio benchmark::benchmark_main)
|
||||
add_subdirectory(benchmarks)
|
||||
endif ()
|
||||
|
||||
# Enable selected sanitizer if enabled via `san`
|
||||
@@ -460,7 +90,7 @@ if (docs)
|
||||
add_subdirectory(docs)
|
||||
endif ()
|
||||
|
||||
include(CMake/install/install.cmake)
|
||||
include(install/install)
|
||||
if (packaging)
|
||||
include(CMake/packaging.cmake) # This file exists only in build runner
|
||||
include(cmake/packaging.cmake) # This file exists only in build runner
|
||||
endif ()
|
||||
|
||||
16
benchmarks/CMakeLists.txt
Normal file
16
benchmarks/CMakeLists.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
add_executable(clio_benchmark)
|
||||
|
||||
target_sources(
|
||||
clio_benchmark
|
||||
PRIVATE # Common
|
||||
Main.cpp
|
||||
Playground.cpp
|
||||
# ExecutionContext
|
||||
util/async/ExecutionContextBenchmarks.cpp
|
||||
)
|
||||
|
||||
include(deps/gbench)
|
||||
|
||||
target_include_directories(clio_benchmark PRIVATE .)
|
||||
target_link_libraries(clio_benchmark PUBLIC clio benchmark::benchmark_main)
|
||||
set_target_properties(clio_benchmark PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <string>
|
||||
|
||||
namespace Build {
|
||||
static constexpr char versionString[] = "@VERSION@";
|
||||
static constexpr char versionString[] = "@CLIO_VERSION@";
|
||||
|
||||
std::string const&
|
||||
getClioVersionString()
|
||||
@@ -23,23 +23,22 @@ endif ()
|
||||
if (NOT (BRANCH MATCHES master OR BRANCH MATCHES release/*)) # for develop and any other branch name
|
||||
# YYYYMMDDHMS-<branch>-<git-rev>
|
||||
execute_process(COMMAND date +%Y%m%d%H%M%S OUTPUT_VARIABLE DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
set(VERSION "${DATE}-${BRANCH}-${REV}")
|
||||
set(CLIO_VERSION "${DATE}-${BRANCH}-${REV}")
|
||||
set(DOC_CLIO_VERSION "develop")
|
||||
else ()
|
||||
set(GIT_COMMAND describe --tags)
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} ${GIT_COMMAND} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE TAG_VERSION
|
||||
COMMAND ${GIT_EXECUTABLE} ${GIT_COMMAND} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE CLIO_TAG_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
set(VERSION "${TAG_VERSION}-${REV}")
|
||||
set(DOC_CLIO_VERSION "${TAG_VERSION}")
|
||||
set(CLIO_VERSION "${CLIO_TAG_VERSION}-${REV}")
|
||||
set(DOC_CLIO_VERSION "${CLIO_TAG_VERSION}")
|
||||
endif ()
|
||||
|
||||
if (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
set(VERSION "${VERSION}+DEBUG")
|
||||
set(CLIO_VERSION "${CLIO_VERSION}+DEBUG")
|
||||
endif ()
|
||||
|
||||
message(STATUS "Build version: ${VERSION}")
|
||||
set(clio_version "${VERSION}")
|
||||
message(STATUS "Build version: ${CLIO_VERSION}")
|
||||
|
||||
configure_file(${CMAKE_CURRENT_LIST_DIR}/Build.cpp.in ${CMAKE_CURRENT_LIST_DIR}/../src/main/impl/Build.cpp)
|
||||
@@ -352,10 +352,10 @@ function (append_coverage_compiler_flags)
|
||||
endfunction () # append_coverage_compiler_flags
|
||||
|
||||
# Setup coverage for specific library
|
||||
function (append_coverage_compiler_flags_to_target name)
|
||||
function (append_coverage_compiler_flags_to_target name mode)
|
||||
separate_arguments(_flag_list NATIVE_COMMAND "${COVERAGE_COMPILER_FLAGS}")
|
||||
target_compile_options(${name} PRIVATE ${_flag_list})
|
||||
target_compile_options(${name} ${mode} ${_flag_list})
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
|
||||
target_link_libraries(${name} PRIVATE gcov)
|
||||
target_link_libraries(${name} ${mode} gcov)
|
||||
endif ()
|
||||
endfunction ()
|
||||
@@ -35,4 +35,4 @@ endif ()
|
||||
# See https://github.com/cpp-best-practices/cppbestpractices/blob/master/02-Use_the_Tools_Available.md#gcc--clang for
|
||||
# the flags description
|
||||
|
||||
target_compile_options(clio PUBLIC ${COMPILER_FLAGS})
|
||||
target_compile_options(clio_options INTERFACE ${COMPILER_FLAGS})
|
||||
@@ -2,10 +2,10 @@ include(CheckIncludeFileCXX)
|
||||
|
||||
check_include_file_cxx("source_location" SOURCE_LOCATION_AVAILABLE)
|
||||
if (SOURCE_LOCATION_AVAILABLE)
|
||||
target_compile_definitions(clio PUBLIC "HAS_SOURCE_LOCATION")
|
||||
target_compile_definitions(clio_options INTERFACE "HAS_SOURCE_LOCATION")
|
||||
endif ()
|
||||
|
||||
check_include_file_cxx("experimental/source_location" EXPERIMENTAL_SOURCE_LOCATION_AVAILABLE)
|
||||
if (EXPERIMENTAL_SOURCE_LOCATION_AVAILABLE)
|
||||
target_compile_definitions(clio PUBLIC "HAS_EXPERIMENTAL_SOURCE_LOCATION")
|
||||
target_compile_definitions(clio_options INTERFACE "HAS_EXPERIMENTAL_SOURCE_LOCATION")
|
||||
endif ()
|
||||
4
cmake/deps/Boost.cmake
Normal file
4
cmake/deps/Boost.cmake
Normal file
@@ -0,0 +1,4 @@
|
||||
set(Boost_USE_STATIC_LIBS ON)
|
||||
set(Boost_USE_STATIC_RUNTIME ON)
|
||||
|
||||
find_package(Boost 1.82 REQUIRED CONFIG COMPONENTS program_options coroutine system log log_setup)
|
||||
@@ -1,3 +1,3 @@
|
||||
find_package(OpenSSL 1.1.1 REQUIRED)
|
||||
find_package(OpenSSL 1.1.1 REQUIRED CONFIG)
|
||||
|
||||
set_target_properties(OpenSSL::SSL PROPERTIES INTERFACE_COMPILE_DEFINITIONS OPENSSL_NO_SSL2)
|
||||
@@ -1,2 +1,2 @@
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package(Threads)
|
||||
find_package(Threads REQUIRED)
|
||||
1
cmake/deps/cassandra.cmake
Normal file
1
cmake/deps/cassandra.cmake
Normal file
@@ -0,0 +1 @@
|
||||
find_package(cassandra-cpp-driver REQUIRED CONFIG)
|
||||
1
cmake/deps/gbench.cmake
Normal file
1
cmake/deps/gbench.cmake
Normal file
@@ -0,0 +1 @@
|
||||
find_package(benchmark REQUIRED CONFIG)
|
||||
3
cmake/deps/libbacktrace.cmake
Normal file
3
cmake/deps/libbacktrace.cmake
Normal file
@@ -0,0 +1,3 @@
|
||||
target_compile_definitions(clio_options INTERFACE BOOST_STACKTRACE_LINK)
|
||||
target_compile_definitions(clio_options INTERFACE BOOST_STACKTRACE_USE_BACKTRACE)
|
||||
find_package(libbacktrace REQUIRED CONFIG)
|
||||
1
cmake/deps/libfmt.cmake
Normal file
1
cmake/deps/libfmt.cmake
Normal file
@@ -0,0 +1 @@
|
||||
find_package(fmt REQUIRED CONFIG)
|
||||
1
cmake/deps/libxrpl.cmake
Normal file
1
cmake/deps/libxrpl.cmake
Normal file
@@ -0,0 +1 @@
|
||||
find_package(xrpl REQUIRED CONFIG)
|
||||
@@ -8,6 +8,6 @@ string(REGEX REPLACE "./clio_log" "/var/log/clio/" config "${config}")
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/install-config.json "${config}")
|
||||
install(FILES ${CMAKE_BINARY_DIR}/install-config.json DESTINATION etc RENAME config.json)
|
||||
|
||||
configure_file("${CMAKE_SOURCE_DIR}/CMake/install/clio.service.in" "${CMAKE_BINARY_DIR}/clio.service")
|
||||
configure_file("${CMAKE_SOURCE_DIR}/cmake/install/clio.service.in" "${CMAKE_BINARY_DIR}/clio.service")
|
||||
|
||||
install(FILES "${CMAKE_BINARY_DIR}/clio.service" DESTINATION /lib/systemd/system)
|
||||
@@ -56,7 +56,7 @@ class Clio(ConanFile):
|
||||
}
|
||||
|
||||
exports_sources = (
|
||||
'CMakeLists.txt', 'CMake/*', 'src/*'
|
||||
'CMakeLists.txt', 'cmake/*', 'src/*'
|
||||
)
|
||||
|
||||
def requirements(self):
|
||||
@@ -84,6 +84,7 @@ class Clio(ConanFile):
|
||||
tc.variables['lint'] = self.options.lint
|
||||
tc.variables['docs'] = self.options.docs
|
||||
tc.variables['packaging'] = self.options.packaging
|
||||
tc.variables['benchmark'] = self.options.benchmark
|
||||
tc.generate()
|
||||
|
||||
def build(self):
|
||||
|
||||
16
docker/develop/compose.yaml
Normal file
16
docker/develop/compose.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
version: '3.7'
|
||||
services:
|
||||
clio_develop:
|
||||
image: rippleci/clio_ci:latest
|
||||
volumes:
|
||||
- clio_develop_conan_data:/root/.conan/data
|
||||
- clio_develop_ccache:/root/.ccache
|
||||
- ../../:/root/clio
|
||||
- clio_develop_build:/root/clio/build_docker
|
||||
working_dir: /root/clio/build_docker
|
||||
tty: true
|
||||
|
||||
volumes:
|
||||
clio_develop_conan_data:
|
||||
clio_develop_ccache:
|
||||
clio_develop_build:
|
||||
62
docker/develop/run
Executable file
62
docker/develop/run
Executable file
@@ -0,0 +1,62 @@
|
||||
#!/bin/bash
|
||||
|
||||
script_dir=$(dirname $0)
|
||||
|
||||
pushd $script_dir > /dev/null
|
||||
|
||||
function start_container {
|
||||
if [ -z "$(docker ps -q -f name=clio_develop)" ]; then
|
||||
docker compose up -d
|
||||
fi
|
||||
}
|
||||
|
||||
function run {
|
||||
start_container
|
||||
docker compose exec clio_develop "$@"
|
||||
}
|
||||
|
||||
function stop_container {
|
||||
docker compose down
|
||||
}
|
||||
|
||||
function open_terminal {
|
||||
start_container
|
||||
docker compose exec clio_develop /bin/bash
|
||||
}
|
||||
|
||||
function print_help {
|
||||
cat <<EOF
|
||||
run: Run a command inside the development container.
|
||||
|
||||
Usage:
|
||||
run [options or command]
|
||||
|
||||
If no options are provided, the command will be executed inside the container.
|
||||
|
||||
Options:
|
||||
-h, --help Show this help message and exit.
|
||||
-t, --terminal Open a terminal inside the container.
|
||||
-s, --stop Stop the container.
|
||||
EOF
|
||||
}
|
||||
|
||||
case $1 in
|
||||
-h|--help)
|
||||
print_help ;;
|
||||
|
||||
-t|--terminal)
|
||||
open_terminal ;;
|
||||
|
||||
-s|--stop)
|
||||
stop_container ;;
|
||||
|
||||
-*)
|
||||
echo "Unknown option: $1"
|
||||
print_help ;;
|
||||
|
||||
*)
|
||||
run "$@" ;;
|
||||
esac
|
||||
|
||||
popd > /dev/null
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.16.3)
|
||||
project(docs)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../CMake/ClioVersion.cmake)
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/ClioVersion.cmake)
|
||||
|
||||
# Generate `docs` target for doxygen documentation
|
||||
# Note: use `cmake --build . --target docs` from your `build` directory to generate the documentation
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../CMake/Docs.cmake)
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/Docs.cmake)
|
||||
|
||||
@@ -25,7 +25,7 @@ The above steps are automated into a single target `coverage_report`. The instru
|
||||
|
||||
In case of a spurious failure of unit tests, it is possible to re-run the `coverage_report` target without rebuilding the `clio_tests` binary (since it is simply a dependency of the coverage report target).
|
||||
|
||||
The default coverage report format is `html-details`, but developers can override it to any of the formats listed in `CMake/CodeCoverage.cmake` by setting `CODE_COVERAGE_REPORT_FORMAT` variable in `cmake`. For example, CI is setting this parameter to `xml` for the [codecov](https://codecov.io) integration.
|
||||
The default coverage report format is `html-details`, but developers can override it to any of the formats listed in `cmake/CodeCoverage.cmake` by setting `CODE_COVERAGE_REPORT_FORMAT` variable in `cmake`. For example, CI is setting this parameter to `xml` for the [codecov](https://codecov.io) integration.
|
||||
|
||||
If some unit tests predictably fail (e.g., due to absence of a Cassandra database), it is possible to set unit tests options in the `CODE_COVERAGE_TESTS_ARGS` cmake variable, as demonstrated below:
|
||||
|
||||
|
||||
7
src/CMakeLists.txt
Normal file
7
src/CMakeLists.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
add_subdirectory(util)
|
||||
add_subdirectory(data)
|
||||
add_subdirectory(etl)
|
||||
add_subdirectory(feed)
|
||||
add_subdirectory(rpc)
|
||||
add_subdirectory(web)
|
||||
add_subdirectory(main)
|
||||
17
src/data/CMakeLists.txt
Normal file
17
src/data/CMakeLists.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
add_library(clio_data)
|
||||
target_sources(
|
||||
clio_data
|
||||
PRIVATE BackendCounters.cpp
|
||||
BackendInterface.cpp
|
||||
LedgerCache.cpp
|
||||
cassandra/impl/Future.cpp
|
||||
cassandra/impl/Cluster.cpp
|
||||
cassandra/impl/Batch.cpp
|
||||
cassandra/impl/Result.cpp
|
||||
cassandra/impl/Tuple.cpp
|
||||
cassandra/impl/SslContext.cpp
|
||||
cassandra/Handle.cpp
|
||||
cassandra/SettingsProvider.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(clio_data PUBLIC cassandra-cpp-driver::cassandra-cpp-driver clio_util)
|
||||
17
src/etl/CMakeLists.txt
Normal file
17
src/etl/CMakeLists.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
add_library(clio_etl)
|
||||
|
||||
target_sources(
|
||||
clio_etl
|
||||
PRIVATE NFTHelpers.cpp
|
||||
ETLService.cpp
|
||||
ETLState.cpp
|
||||
LoadBalancer.cpp
|
||||
CacheLoaderSettings.cpp
|
||||
Source.cpp
|
||||
impl/ForwardingCache.cpp
|
||||
impl/ForwardingSource.cpp
|
||||
impl/GrpcSource.cpp
|
||||
impl/SubscriptionSource.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(clio_etl PUBLIC clio_data)
|
||||
7
src/feed/CMakeLists.txt
Normal file
7
src/feed/CMakeLists.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
add_library(clio_feed)
|
||||
target_sources(
|
||||
clio_feed PRIVATE SubscriptionManager.cpp impl/TransactionFeed.cpp impl/LedgerFeed.cpp
|
||||
impl/ProposedTransactionFeed.cpp impl/SingleFeedBase.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(clio_feed PRIVATE clio_util)
|
||||
15
src/main/CMakeLists.txt
Normal file
15
src/main/CMakeLists.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
add_library(clio)
|
||||
target_sources(clio PRIVATE impl/Build.cpp)
|
||||
|
||||
target_link_libraries(clio PUBLIC clio_etl clio_feed clio_web clio_rpc)
|
||||
|
||||
target_compile_features(clio PUBLIC cxx_std_20)
|
||||
|
||||
# Clio server
|
||||
add_executable(clio_server)
|
||||
target_sources(clio_server PRIVATE Main.cpp)
|
||||
target_link_libraries(clio_server PRIVATE clio)
|
||||
target_link_options(
|
||||
clio_server PRIVATE $<$<AND:$<NOT:$<BOOL:${APPLE}>>,$<NOT:$<BOOL:${san}>>>:-static-libstdc++ -static-libgcc>
|
||||
)
|
||||
set_target_properties(clio_server PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
44
src/rpc/CMakeLists.txt
Normal file
44
src/rpc/CMakeLists.txt
Normal file
@@ -0,0 +1,44 @@
|
||||
add_library(clio_rpc)
|
||||
|
||||
target_sources(
|
||||
clio_rpc
|
||||
PRIVATE Errors.cpp
|
||||
Factories.cpp
|
||||
AMMHelpers.cpp
|
||||
RPCHelpers.cpp
|
||||
Counters.cpp
|
||||
WorkQueue.cpp
|
||||
common/Specs.cpp
|
||||
common/Validators.cpp
|
||||
common/MetaProcessors.cpp
|
||||
common/impl/APIVersionParser.cpp
|
||||
common/impl/HandlerProvider.cpp
|
||||
handlers/AccountChannels.cpp
|
||||
handlers/AccountCurrencies.cpp
|
||||
handlers/AccountInfo.cpp
|
||||
handlers/AccountLines.cpp
|
||||
handlers/AccountNFTs.cpp
|
||||
handlers/AccountObjects.cpp
|
||||
handlers/AccountOffers.cpp
|
||||
handlers/AccountTx.cpp
|
||||
handlers/AMMInfo.cpp
|
||||
handlers/BookChanges.cpp
|
||||
handlers/BookOffers.cpp
|
||||
handlers/DepositAuthorized.cpp
|
||||
handlers/GatewayBalances.cpp
|
||||
handlers/Ledger.cpp
|
||||
handlers/LedgerData.cpp
|
||||
handlers/LedgerEntry.cpp
|
||||
handlers/LedgerRange.cpp
|
||||
handlers/NFTsByIssuer.cpp
|
||||
handlers/NFTBuyOffers.cpp
|
||||
handlers/NFTHistory.cpp
|
||||
handlers/NFTInfo.cpp
|
||||
handlers/NFTOffersCommon.cpp
|
||||
handlers/NFTSellOffers.cpp
|
||||
handlers/NoRippleCheck.cpp
|
||||
handlers/Random.cpp
|
||||
handlers/TransactionEntry.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(clio_rpc PRIVATE clio_util)
|
||||
44
src/util/CMakeLists.txt
Normal file
44
src/util/CMakeLists.txt
Normal file
@@ -0,0 +1,44 @@
|
||||
add_library(clio_util)
|
||||
|
||||
target_sources(
|
||||
clio_util
|
||||
PRIVATE config/Config.cpp
|
||||
log/Logger.cpp
|
||||
prometheus/Http.cpp
|
||||
prometheus/Label.cpp
|
||||
prometheus/MetricBase.cpp
|
||||
prometheus/MetricBuilder.cpp
|
||||
prometheus/MetricsFamily.cpp
|
||||
prometheus/OStream.cpp
|
||||
prometheus/Prometheus.cpp
|
||||
Random.cpp
|
||||
Retry.cpp
|
||||
requests/RequestBuilder.cpp
|
||||
requests/Types.cpp
|
||||
requests/WsConnection.cpp
|
||||
requests/impl/SslContext.cpp
|
||||
Taggable.cpp
|
||||
TerminationHandler.cpp
|
||||
TxUtils.cpp
|
||||
LedgerUtils.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
clio_util
|
||||
PUBLIC Boost::headers
|
||||
Boost::stacktrace_backtrace
|
||||
dl
|
||||
libbacktrace::libbacktrace
|
||||
fmt::fmt
|
||||
openssl::openssl
|
||||
xrpl::libxrpl
|
||||
Threads::Threads
|
||||
clio_options
|
||||
)
|
||||
|
||||
if (is_gcc)
|
||||
# FIXME: needed on gcc for now
|
||||
#
|
||||
# For some reason cmake doesn't propagate the compile definitions from clio_options so we need to add them here
|
||||
target_compile_definitions(clio_util PUBLIC BOOST_ASIO_DISABLE_CONCEPTS)
|
||||
endif ()
|
||||
5
src/web/CMakeLists.txt
Normal file
5
src/web/CMakeLists.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
add_library(clio_web)
|
||||
|
||||
target_sources(clio_web PRIVATE impl/AdminVerificationStrategy.cpp IntervalSweepHandler.cpp Resolver.cpp)
|
||||
|
||||
target_link_libraries(clio_web PUBLIC clio_util)
|
||||
173
unittests/CMakeLists.txt
Normal file
173
unittests/CMakeLists.txt
Normal file
@@ -0,0 +1,173 @@
|
||||
add_executable(clio_tests)
|
||||
|
||||
target_sources(
|
||||
clio_tests
|
||||
PRIVATE # Common
|
||||
ConfigTests.cpp
|
||||
data/BackendCountersTests.cpp
|
||||
data/BackendFactoryTests.cpp
|
||||
data/cassandra/AsyncExecutorTests.cpp
|
||||
# Webserver
|
||||
data/cassandra/BackendTests.cpp
|
||||
data/cassandra/BaseTests.cpp
|
||||
data/cassandra/ExecutionStrategyTests.cpp
|
||||
data/cassandra/RetryPolicyTests.cpp
|
||||
data/cassandra/SettingsProviderTests.cpp
|
||||
DOSGuardTests.cpp
|
||||
etl/AmendmentBlockHandlerTests.cpp
|
||||
etl/CacheLoaderSettingsTests.cpp
|
||||
etl/CacheLoaderTests.cpp
|
||||
etl/CursorProviderTests.cpp
|
||||
etl/ETLStateTests.cpp
|
||||
etl/ExtractionDataPipeTests.cpp
|
||||
etl/ExtractorTests.cpp
|
||||
etl/ForwardingCacheTests.cpp
|
||||
etl/ForwardingSourceTests.cpp
|
||||
etl/GrpcSourceTests.cpp
|
||||
etl/LedgerPublisherTests.cpp
|
||||
etl/SourceTests.cpp
|
||||
etl/SubscriptionSourceDependenciesTests.cpp
|
||||
etl/SubscriptionSourceTests.cpp
|
||||
etl/TransformerTests.cpp
|
||||
# RPC
|
||||
feed/BookChangesFeedTests.cpp
|
||||
feed/ForwardFeedTests.cpp
|
||||
feed/LedgerFeedTests.cpp
|
||||
feed/ProposedTransactionFeedTests.cpp
|
||||
feed/SingleFeedBaseTests.cpp
|
||||
feed/SubscriptionManagerTests.cpp
|
||||
feed/TrackableSignalTests.cpp
|
||||
feed/TransactionFeedTests.cpp
|
||||
JsonUtilTests.cpp
|
||||
LoggerTests.cpp
|
||||
Main.cpp
|
||||
Playground.cpp
|
||||
ProfilerTests.cpp
|
||||
rpc/AmendmentsTests.cpp
|
||||
rpc/APIVersionTests.cpp
|
||||
rpc/BaseTests.cpp
|
||||
rpc/CountersTests.cpp
|
||||
rpc/ErrorTests.cpp
|
||||
rpc/ForwardingProxyTests.cpp
|
||||
rpc/handlers/AccountChannelsTests.cpp
|
||||
rpc/handlers/AccountCurrenciesTests.cpp
|
||||
rpc/handlers/AccountInfoTests.cpp
|
||||
rpc/handlers/AccountLinesTests.cpp
|
||||
rpc/handlers/AccountNFTsTests.cpp
|
||||
rpc/handlers/AccountObjectsTests.cpp
|
||||
rpc/handlers/AccountOffersTests.cpp
|
||||
rpc/handlers/AccountTxTests.cpp
|
||||
rpc/handlers/AMMInfoTests.cpp
|
||||
# Backend
|
||||
rpc/handlers/BookChangesTests.cpp
|
||||
rpc/handlers/BookOffersTests.cpp
|
||||
rpc/handlers/DefaultProcessorTests.cpp
|
||||
rpc/handlers/DepositAuthorizedTests.cpp
|
||||
rpc/handlers/GatewayBalancesTests.cpp
|
||||
rpc/handlers/LedgerDataTests.cpp
|
||||
rpc/handlers/LedgerEntryTests.cpp
|
||||
rpc/handlers/LedgerRangeTests.cpp
|
||||
rpc/handlers/LedgerTests.cpp
|
||||
rpc/handlers/NFTBuyOffersTests.cpp
|
||||
rpc/handlers/NFTHistoryTests.cpp
|
||||
rpc/handlers/NFTInfoTests.cpp
|
||||
rpc/handlers/NFTsByIssuerTest.cpp
|
||||
rpc/handlers/NFTSellOffersTests.cpp
|
||||
rpc/handlers/NoRippleCheckTests.cpp
|
||||
rpc/handlers/PingTests.cpp
|
||||
rpc/handlers/RandomTests.cpp
|
||||
rpc/handlers/ServerInfoTests.cpp
|
||||
rpc/handlers/SubscribeTests.cpp
|
||||
rpc/handlers/TestHandlerTests.cpp
|
||||
rpc/handlers/TransactionEntryTests.cpp
|
||||
rpc/handlers/TxTests.cpp
|
||||
rpc/handlers/UnsubscribeTests.cpp
|
||||
rpc/handlers/VersionHandlerTests.cpp
|
||||
rpc/JsonBoolTests.cpp
|
||||
# RPC handlers
|
||||
rpc/RPCHelpersTests.cpp
|
||||
rpc/WorkQueueTests.cpp
|
||||
util/AssertTests.cpp
|
||||
util/async/AnyExecutionContextTests.cpp
|
||||
util/async/AnyOperationTests.cpp
|
||||
util/async/AnyStopTokenTests.cpp
|
||||
util/async/AnyStrandTests.cpp
|
||||
util/async/AsyncExecutionContextTests.cpp
|
||||
# Requests framework
|
||||
util/BatchingTests.cpp
|
||||
util/LedgerUtilsTests.cpp
|
||||
# Prometheus support
|
||||
util/prometheus/CounterTests.cpp
|
||||
util/prometheus/GaugeTests.cpp
|
||||
util/prometheus/HistogramTests.cpp
|
||||
util/prometheus/HttpTests.cpp
|
||||
util/prometheus/LabelTests.cpp
|
||||
util/prometheus/MetricBuilderTests.cpp
|
||||
util/prometheus/MetricsFamilyTests.cpp
|
||||
util/prometheus/OStreamTests.cpp
|
||||
util/requests/RequestBuilderTests.cpp
|
||||
util/requests/SslContextTests.cpp
|
||||
util/requests/WsConnectionTests.cpp
|
||||
# ETL
|
||||
util/RetryTests.cpp
|
||||
# Async framework
|
||||
util/StringUtils.cpp
|
||||
util/TestGlobals.cpp
|
||||
util/TestHttpServer.cpp
|
||||
util/TestObject.cpp
|
||||
util/TestWsServer.cpp
|
||||
util/TxUtilTests.cpp
|
||||
web/AdminVerificationTests.cpp
|
||||
web/RPCServerHandlerTests.cpp
|
||||
web/ServerTests.cpp
|
||||
web/SweepHandlerTests.cpp
|
||||
# Feed
|
||||
web/WhitelistHandlerTests.cpp
|
||||
)
|
||||
|
||||
include(deps/gtest)
|
||||
|
||||
# See https://github.com/google/googletest/issues/3475
|
||||
gtest_discover_tests(clio_tests DISCOVERY_TIMEOUT 90)
|
||||
|
||||
# Fix for dwarf5 bug on ci
|
||||
target_compile_options(clio PUBLIC -gdwarf-4)
|
||||
|
||||
target_compile_definitions(clio_tests PUBLIC UNITTEST_BUILD)
|
||||
target_include_directories(clio_tests PRIVATE .)
|
||||
target_link_libraries(clio_tests PUBLIC clio gtest::gtest)
|
||||
set_target_properties(clio_tests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
|
||||
# Generate `coverage_report` target if coverage is enabled
|
||||
if (coverage)
|
||||
if (DEFINED CODE_COVERAGE_REPORT_FORMAT)
|
||||
set(CODE_COVERAGE_FORMAT ${CODE_COVERAGE_REPORT_FORMAT})
|
||||
else ()
|
||||
set(CODE_COVERAGE_FORMAT html-details)
|
||||
endif ()
|
||||
|
||||
if (DEFINED CODE_COVERAGE_TESTS_ARGS)
|
||||
set(TESTS_ADDITIONAL_ARGS ${CODE_COVERAGE_TESTS_ARGS})
|
||||
separate_arguments(TESTS_ADDITIONAL_ARGS)
|
||||
else ()
|
||||
set(TESTS_ADDITIONAL_ARGS "")
|
||||
endif ()
|
||||
|
||||
set(GCOVR_ADDITIONAL_ARGS --exclude-throw-branches -s)
|
||||
|
||||
setup_target_for_coverage_gcovr(
|
||||
NAME
|
||||
coverage_report
|
||||
FORMAT
|
||||
${CODE_COVERAGE_FORMAT}
|
||||
EXECUTABLE
|
||||
clio_tests
|
||||
EXECUTABLE_ARGS
|
||||
--gtest_brief=1
|
||||
${TESTS_ADDITIONAL_ARGS}
|
||||
EXCLUDE
|
||||
"unittests"
|
||||
DEPENDENCIES
|
||||
clio_tests
|
||||
)
|
||||
endif ()
|
||||
Reference in New Issue
Block a user