Prepare to rearrange sources: (#4997)

- Remove CMake module "MultiConfig".
- Update clang-format configuration, CodeCov configuration,
  levelization script.
- Replace source lists in CMake with globs.
This commit is contained in:
John Freeman
2024-03-29 20:21:18 -05:00
parent c706926ee3
commit ae20a3ad3f
11 changed files with 113 additions and 1204 deletions

View File

@@ -45,9 +45,11 @@ DisableFormat: false
ExperimentalAutoDetectBinPacking: false ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ Q_FOREACH, BOOST_FOREACH ] ForEachMacros: [ Q_FOREACH, BOOST_FOREACH ]
IncludeCategories: IncludeCategories:
- Regex: '^<(BeastConfig)' - Regex: '^<(test)/'
Priority: 0 Priority: 0
- Regex: '^<(ripple)/' - Regex: '^<(xrpld)/'
Priority: 1
- Regex: '^<(xrpl)/'
Priority: 2 Priority: 2
- Regex: '^<(boost)/' - Regex: '^<(boost)/'
Priority: 3 Priority: 3

View File

@@ -33,5 +33,5 @@ slack_app: false
ignore: ignore:
- "src/test/" - "src/test/"
- "src/ripple/beast/test/" - "include/xrpl/beast/test/"
- "src/ripple/beast/unit_test/" - "include/xrpl/beast/unit_test/"

View File

@@ -19,10 +19,8 @@ jobs:
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add
sudo apt-get update sudo apt-get update
sudo apt-get install clang-format-${CLANG_VERSION} sudo apt-get install clang-format-${CLANG_VERSION}
- name: Format src/ripple - name: Format sources
run: find src/ripple -type f \( -name '*.cpp' -o -name '*.h' -o -name '*.ipp' \) -print0 | xargs -0 clang-format-${CLANG_VERSION} -i run: find include src -type f \( -name '*.cpp' -o -name '*.h' -o -name '*.ipp' \) -exec clang-format-${CLANG_VERSION} -i {} +
- name: Format src/test
run: find src/test -type f \( -name '*.cpp' -o -name '*.h' -o -name '*.ipp' \) -print0 | xargs -0 clang-format-${CLANG_VERSION} -i
- name: Check for differences - name: Check for differences
id: assert id: assert
run: | run: |

File diff suppressed because it is too large Load Diff

View File

@@ -25,8 +25,7 @@ file(GLOB_RECURSE doxygen_input
src/ripple/*.cpp src/ripple/*.cpp
src/ripple/*.md src/ripple/*.md
src/test/*.h src/test/*.h
src/test/*.md src/test/*.md)
Builds/*/README.md)
list(APPEND doxygen_input list(APPEND doxygen_input
README.md README.md
RELEASENOTES.md RELEASENOTES.md

View File

@@ -8,14 +8,19 @@ install (
opts opts
ripple_syslibs ripple_syslibs
ripple_boost ripple_boost
xrpl_core
xrpl.libpb xrpl.libpb
xrpl.libxrpl
EXPORT RippleExports EXPORT RippleExports
LIBRARY DESTINATION lib LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin RUNTIME DESTINATION bin
INCLUDES DESTINATION include) INCLUDES DESTINATION include)
install(
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/xrpl"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
)
install (EXPORT RippleExports install (EXPORT RippleExports
FILE RippleTargets.cmake FILE RippleTargets.cmake
NAMESPACE Ripple:: NAMESPACE Ripple::
@@ -31,7 +36,7 @@ if (is_root_project)
set_target_properties(rippled PROPERTIES INSTALL_RPATH_USE_LINK_PATH ON) set_target_properties(rippled PROPERTIES INSTALL_RPATH_USE_LINK_PATH ON)
install ( install (
FILES FILES
${CMAKE_CURRENT_SOURCE_DIR}/Builds/CMake/RippleConfig.cmake ${CMAKE_CURRENT_SOURCE_DIR}/cmake/RippleConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/RippleConfigVersion.cmake ${CMAKE_CURRENT_BINARY_DIR}/RippleConfigVersion.cmake
DESTINATION lib/cmake/ripple) DESTINATION lib/cmake/ripple)
# sample configs should not overwrite existing files # sample configs should not overwrite existing files
@@ -49,3 +54,17 @@ if (is_root_project)
copy_if_not_exists(\"${CMAKE_CURRENT_SOURCE_DIR}/cfg/validators-example.txt\" etc validators.txt) copy_if_not_exists(\"${CMAKE_CURRENT_SOURCE_DIR}/cfg/validators-example.txt\" etc validators.txt)
") ")
endif () endif ()
if(NOT WIN32)
install(
CODE "file(CREATE_LINK xrpl \
\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/ripple SYMBOLIC)"
)
endif()
if(NOT WIN32)
install(
CODE "file(CREATE_LINK rippled${suffix} \
\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/xrpld${suffix} SYMBOLIC)"
)
endif()

View File

@@ -1,39 +0,0 @@
#[===================================================================[
multiconfig misc
#]===================================================================]
if (is_multiconfig)
# This code finds all source files in the src subdirectory for inclusion
# in the IDE file tree as non-compiled sources. Since this file list will
# have some overlap with files we have already added to our targets to
# be compiled, we explicitly remove any of these target source files from
# this list.
file (GLOB_RECURSE all_sources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
CONFIGURE_DEPENDS
src/*.* Builds/*.md docs/*.md src/*.md Builds/*.cmake)
file(GLOB md_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} CONFIGURE_DEPENDS
*.md)
LIST(APPEND all_sources ${md_files})
foreach (_target secp256k1::secp256k1 ed25519::ed25519 xrpl_core rippled)
get_target_property (_type ${_target} TYPE)
if(_type STREQUAL "INTERFACE_LIBRARY")
continue()
endif()
get_target_property (_src ${_target} SOURCES)
list (REMOVE_ITEM all_sources ${_src})
endforeach ()
target_sources (rippled PRIVATE ${all_sources})
set_property (
SOURCE ${all_sources}
APPEND
PROPERTY HEADER_FILE_ONLY true)
if (MSVC)
set_property(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
PROPERTY VS_STARTUP_PROJECT rippled)
endif ()
group_sources(src)
group_sources(docs)
group_sources(Builds)
endif ()

View File

@@ -2,14 +2,14 @@
read version from source read version from source
#]===================================================================] #]===================================================================]
file (STRINGS src/ripple/protocol/impl/BuildInfo.cpp BUILD_INFO) file(STRINGS src/libxrpl/protocol/BuildInfo.cpp BUILD_INFO)
foreach (line_ ${BUILD_INFO}) foreach(line_ ${BUILD_INFO})
if (line_ MATCHES "versionString[ ]*=[ ]*\"(.+)\"") if(line_ MATCHES "versionString[ ]*=[ ]*\"(.+)\"")
set (rippled_version ${CMAKE_MATCH_1}) set(rippled_version ${CMAKE_MATCH_1})
endif () endif()
endforeach () endforeach()
if (rippled_version) if(rippled_version)
message (STATUS "rippled version: ${rippled_version}") message(STATUS "rippled version: ${rippled_version}")
else () else()
message (FATAL_ERROR "unable to determine rippled version") message(FATAL_ERROR "unable to determine rippled version")
endif () endif()

View File

@@ -18,7 +18,7 @@ mkdir results
includes="$( pwd )/results/rawincludes.txt" includes="$( pwd )/results/rawincludes.txt"
pushd ../.. pushd ../..
echo Raw includes: echo Raw includes:
grep -r '#include.*/.*\.h' src/ripple/ src/test/ | \ grep -r '#include.*/.*\.h' include src | \
grep -v boost | tee ${includes} grep -v boost | tee ${includes}
popd popd
pushd results pushd results

View File

@@ -9,9 +9,9 @@ endif()
# Fix "unrecognized escape" issues when passing CMAKE_MODULE_PATH on Windows. # Fix "unrecognized escape" issues when passing CMAKE_MODULE_PATH on Windows.
file(TO_CMAKE_PATH "${CMAKE_MODULE_PATH}" CMAKE_MODULE_PATH) file(TO_CMAKE_PATH "${CMAKE_MODULE_PATH}" CMAKE_MODULE_PATH)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/Builds/CMake") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
project(rippled) project(xrpl)
set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -81,7 +81,6 @@ find_package(lz4 REQUIRED)
find_package(LibArchive REQUIRED) find_package(LibArchive REQUIRED)
find_package(SOCI REQUIRED) find_package(SOCI REQUIRED)
find_package(SQLite3 REQUIRED) find_package(SQLite3 REQUIRED)
find_package(Snappy REQUIRED)
option(rocksdb "Enable RocksDB" ON) option(rocksdb "Enable RocksDB" ON)
if(rocksdb) if(rocksdb)
@@ -129,9 +128,7 @@ if(coverage)
include(RippledCov) include(RippledCov)
endif() endif()
### set(PROJECT_EXPORT_SET RippleExports)
include(RippledCore) include(RippledCore)
include(RippledInstall) include(RippledInstall)
include(RippledMultiConfig)
include(RippledValidatorKeys) include(RippledValidatorKeys)

View File

@@ -29,10 +29,9 @@ class Xrpl(ConanFile):
'libarchive/3.6.2', 'libarchive/3.6.2',
'nudb/2.0.8', 'nudb/2.0.8',
'openssl/1.1.1u', 'openssl/1.1.1u',
'snappy/1.1.10',
'soci/4.0.3', 'soci/4.0.3',
'zlib/1.2.13',
'xxhash/0.8.2', 'xxhash/0.8.2',
'zlib/1.2.13',
] ]
tool_requires = [ tool_requires = [
@@ -91,7 +90,7 @@ class Xrpl(ConanFile):
} }
def set_version(self): def set_version(self):
path = f'{self.recipe_folder}/src/ripple/protocol/impl/BuildInfo.cpp' path = f'{self.recipe_folder}/src/libxrpl/protocol/BuildInfo.cpp'
regex = r'versionString\s?=\s?\"(.*)\"' regex = r'versionString\s?=\s?\"(.*)\"'
with open(path, 'r') as file: with open(path, 'r') as file:
matches = (re.search(regex, line) for line in file) matches = (re.search(regex, line) for line in file)
@@ -117,10 +116,11 @@ class Xrpl(ConanFile):
exports_sources = ( exports_sources = (
'CMakeLists.txt', 'CMakeLists.txt',
'Builds/*',
'bin/getRippledInfo', 'bin/getRippledInfo',
'cfg/*', 'cfg/*',
'cmake/*',
'external/*', 'external/*',
'include/*',
'src/*', 'src/*',
) )
@@ -158,7 +158,7 @@ class Xrpl(ConanFile):
def package_info(self): def package_info(self):
libxrpl = self.cpp_info.components['libxrpl'] libxrpl = self.cpp_info.components['libxrpl']
libxrpl.libs = [ libxrpl.libs = [
'xrpl_core', 'xrpl',
'xrpl.libpb', 'xrpl.libpb',
'ed25519', 'ed25519',
'secp256k1', 'secp256k1',
@@ -175,7 +175,6 @@ class Xrpl(ConanFile):
'nudb::nudb', 'nudb::nudb',
'openssl::crypto', 'openssl::crypto',
'protobuf::libprotobuf', 'protobuf::libprotobuf',
'snappy::snappy',
'soci::soci', 'soci::soci',
'sqlite3::sqlite', 'sqlite3::sqlite',
'xxhash::xxhash', 'xxhash::xxhash',