Fix compatibility with Conan 2.x: (#5001)

Closes #4926, #4990
This commit is contained in:
John Freeman
2024-06-11 12:26:01 -05:00
committed by GitHub
parent 2df635693d
commit e3d1bb271f
2 changed files with 77 additions and 50 deletions

View File

@@ -36,9 +36,15 @@ See [System Requirements](https://xrpl.org/system-requirements.html).
Building rippled generally requires git, Python, Conan, CMake, and a C++ compiler. Some guidance on setting up such a [C++ development environment can be found here](./docs/build/environment.md). Building rippled generally requires git, Python, Conan, CMake, and a C++ compiler. Some guidance on setting up such a [C++ development environment can be found here](./docs/build/environment.md).
- [Python 3.7](https://www.python.org/downloads/) - [Python 3.7](https://www.python.org/downloads/)
- [Conan 1.55](https://conan.io/downloads.html) - [Conan 1.60](https://conan.io/downloads.html)[^1]
- [CMake 3.16](https://cmake.org/download/) - [CMake 3.16](https://cmake.org/download/)
[^1]: It is possible to build with Conan 2.x,
but the instructions are significantly different,
which is why we are not recommending it yet.
Notably, the `conan profile update` command is removed in 2.x.
Profiles must be edited by hand.
`rippled` is written in the C++20 dialect and includes the `<concepts>` header. `rippled` is written in the C++20 dialect and includes the `<concepts>` header.
The [minimum compiler versions][2] required are: The [minimum compiler versions][2] required are:
@@ -67,9 +73,6 @@ Here are [sample instructions for setting up a C++ development environment on ma
Windows is not recommended for production use at this time. Windows is not recommended for production use at this time.
- Additionally, 32-bit Windows development is not supported. - Additionally, 32-bit Windows development is not supported.
- Visual Studio 2022 is not yet supported.
- rippled generally requires [Boost][] 1.77, which Conan cannot build with VS 2022.
- Until rippled is updated for compatibility with later versions of Boost, Windows developers may need to use Visual Studio 2019.
[Boost]: https://www.boost.org/ [Boost]: https://www.boost.org/
@@ -144,21 +147,30 @@ It does not explicitly link the C++ standard library,
which allows you to statically link it with GCC, if you want. which allows you to statically link it with GCC, if you want.
``` ```
# Conan 1.x
conan export external/snappy snappy/1.1.10@ conan export external/snappy snappy/1.1.10@
# Conan 2.x
conan export --version 1.1.10 external/snappy
``` ```
Export our [Conan recipe for RocksDB](./external/rocksdb). Export our [Conan recipe for RocksDB](./external/rocksdb).
It does not override paths to dependencies when building with Visual Studio. It does not override paths to dependencies when building with Visual Studio.
``` ```
# Conan 1.x
conan export external/rocksdb rocksdb/6.29.5@ conan export external/rocksdb rocksdb/6.29.5@
# Conan 2.x
conan export --version 6.29.5 external/rocksdb
``` ```
Export our [Conan recipe for SOCI](./external/soci). Export our [Conan recipe for SOCI](./external/soci).
It patches their CMake to correctly import its dependencies. It patches their CMake to correctly import its dependencies.
``` ```
# Conan 1.x
conan export external/soci soci/4.0.3@ conan export external/soci soci/4.0.3@
# Conan 2.x
conan export --version 4.0.3 external/soci
``` ```
### Build and Test ### Build and Test
@@ -196,13 +208,13 @@ It patches their CMake to correctly import its dependencies.
generated by the first. You can pass the build type on the command line with generated by the first. You can pass the build type on the command line with
`--settings build_type=$BUILD_TYPE` or in the profile itself, `--settings build_type=$BUILD_TYPE` or in the profile itself,
under the section `[settings]` with the key `build_type`. under the section `[settings]` with the key `build_type`.
If you are using a Microsoft Visual C++ compiler, If you are using a Microsoft Visual C++ compiler,
then you will need to ensure consistency between the `build_type` setting then you will need to ensure consistency between the `build_type` setting
and the `compiler.runtime` setting. and the `compiler.runtime` setting.
When `build_type` is `Release`, `compiler.runtime` should be `MT`. When `build_type` is `Release`, `compiler.runtime` should be `MT`.
When `build_type` is `Debug`, `compiler.runtime` should be `MTd`. When `build_type` is `Debug`, `compiler.runtime` should be `MTd`.
``` ```

View File

@@ -24,17 +24,13 @@ class Xrpl(ConanFile):
} }
requires = [ requires = [
'boost/1.82.0',
'date/3.0.1', 'date/3.0.1',
'grpc/1.50.1', 'grpc/1.50.1',
'libarchive/3.6.2', 'libarchive/3.6.2',
'lz4/1.9.3',
'nudb/2.0.8', 'nudb/2.0.8',
'openssl/1.1.1u', 'openssl/1.1.1u',
'protobuf/3.21.9',
'snappy/1.1.10', 'snappy/1.1.10',
'soci/4.0.3', 'soci/4.0.3',
'sqlite3/3.42.0',
'zlib/1.2.13', 'zlib/1.2.13',
'xxhash/0.8.2', 'xxhash/0.8.2',
] ]
@@ -55,43 +51,43 @@ class Xrpl(ConanFile):
'tests': True, 'tests': True,
'unity': False, 'unity': False,
'cassandra-cpp-driver:shared': False, 'cassandra-cpp-driver/*:shared': False,
'cassandra-cpp-driver:use_atomic': None, 'cassandra-cpp-driver/*:use_atomic': None,
'date:header_only': True, 'date/*:header_only': True,
'grpc:shared': False, 'grpc/*:shared': False,
'grpc:secure': True, 'grpc/*:secure': True,
'libarchive:shared': False, 'libarchive/*:shared': False,
'libarchive:with_acl': False, 'libarchive/*:with_acl': False,
'libarchive:with_bzip2': False, 'libarchive/*:with_bzip2': False,
'libarchive:with_cng': False, 'libarchive/*:with_cng': False,
'libarchive:with_expat': False, 'libarchive/*:with_expat': False,
'libarchive:with_iconv': False, 'libarchive/*:with_iconv': False,
'libarchive:with_libxml2': False, 'libarchive/*:with_libxml2': False,
'libarchive:with_lz4': True, 'libarchive/*:with_lz4': True,
'libarchive:with_lzma': False, 'libarchive/*:with_lzma': False,
'libarchive:with_lzo': False, 'libarchive/*:with_lzo': False,
'libarchive:with_nettle': False, 'libarchive/*:with_nettle': False,
'libarchive:with_openssl': False, 'libarchive/*:with_openssl': False,
'libarchive:with_pcreposix': False, 'libarchive/*:with_pcreposix': False,
'libarchive:with_xattr': False, 'libarchive/*:with_xattr': False,
'libarchive:with_zlib': False, 'libarchive/*:with_zlib': False,
'libpq:shared': False, 'libpq/*:shared': False,
'lz4:shared': False, 'lz4/*:shared': False,
'openssl:shared': False, 'openssl/*:shared': False,
'protobuf:shared': False, 'protobuf/*:shared': False,
'protobuf:with_zlib': True, 'protobuf/*:with_zlib': True,
'rocksdb:enable_sse': False, 'rocksdb/*:enable_sse': False,
'rocksdb:lite': False, 'rocksdb/*:lite': False,
'rocksdb:shared': False, 'rocksdb/*:shared': False,
'rocksdb:use_rtti': True, 'rocksdb/*:use_rtti': True,
'rocksdb:with_jemalloc': False, 'rocksdb/*:with_jemalloc': False,
'rocksdb:with_lz4': True, 'rocksdb/*:with_lz4': True,
'rocksdb:with_snappy': True, 'rocksdb/*:with_snappy': True,
'snappy:shared': False, 'snappy/*:shared': False,
'soci:shared': False, 'soci/*:shared': False,
'soci:with_sqlite3': True, 'soci/*:with_sqlite3': True,
'soci:with_boost': True, 'soci/*:with_boost': True,
'xxhash:shared': False, 'xxhash/*:shared': False,
} }
def set_version(self): def set_version(self):
@@ -107,6 +103,10 @@ class Xrpl(ConanFile):
self.options['boost'].visibility = 'global' self.options['boost'].visibility = 'global'
def requirements(self): def requirements(self):
self.requires('boost/1.82.0', force=True)
self.requires('lz4/1.9.3', force=True)
self.requires('protobuf/3.21.9', force=True)
self.requires('sqlite3/3.42.0', force=True)
if self.options.jemalloc: if self.options.jemalloc:
self.requires('jemalloc/5.3.0') self.requires('jemalloc/5.3.0')
if self.options.reporting: if self.options.reporting:
@@ -116,7 +116,12 @@ class Xrpl(ConanFile):
self.requires('rocksdb/6.29.5') self.requires('rocksdb/6.29.5')
exports_sources = ( exports_sources = (
'CMakeLists.txt', 'Builds/*', 'bin/getRippledInfo', 'src/*', 'cfg/*', 'external/*' 'CMakeLists.txt',
'Builds/*',
'bin/getRippledInfo',
'cfg/*'
'external/*',
'src/*',
) )
def layout(self): def layout(self):
@@ -163,8 +168,18 @@ class Xrpl(ConanFile):
libxrpl.includedirs = ['include', 'include/ripple/proto'] libxrpl.includedirs = ['include', 'include/ripple/proto']
libxrpl.requires = [ libxrpl.requires = [
'boost::boost', 'boost::boost',
'openssl::crypto',
'date::date', 'date::date',
'grpc::grpc++', 'grpc::grpc++',
'libarchive::libarchive',
'lz4::lz4',
'nudb::nudb',
'openssl::crypto',
'protobuf::libprotobuf',
'snappy::snappy',
'soci::soci',
'sqlite3::sqlite',
'xxhash::xxhash', 'xxhash::xxhash',
'zlib::zlib',
] ]
if self.options.rocksdb:
libxrpl.requires.append('rocksdb::librocksdb')