Cross compiling fixes and improvements (#59)
* CMake: Expose CMake options to includes
This change shuffles the order of several CMake steps to expose CMake
options to included files.
By defining options before inclusion, included files are able to access
the input provided by the build system.
* CMake: Exclude test dependencies when building tests
* CMake: Allow build system to provide protobuf compiler
When building without Hunter, it is desirable to pass the path to protoc and
the protobuf include directory from the build system. Allow these variables
to be overridden.
Fixes the error:
| CMake Error at cmake/functions.cmake:52 (message):
| Protobuf_PROTOC_EXECUTABLE is empty
| Call Stack (most recent call first):
| cmake/functions.cmake:96 (compile_proto_to_cpp)
| src/crypto/protobuf/CMakeLists.txt:6 (add_proto_library)
* Fix build error due to missing include
Error was:
| literals.cpp: In function 'libp2p::common::Hash256 libp2p::common::operator""_hash256(const char*, size_t)':
| literals.cpp:17:36: error: no matching function for call to 'min(size_t&, long unsigned int)'
| 17 | std::copy_n(c, std::min(s, 32ul), hash.rbegin());
| | ^
* Fix build error due to mismatched types
Error was:
| literals.cpp: In function 'libp2p::common::Hash256 libp2p::common::operator""_hash256(const char*, size_t)':
| literals.cpp:19:36: error: no matching function for call to 'min(size_t&, long unsigned int)'
| 19 | std::copy_n(c, std::min(s, 32ul), hash.rbegin());
| | ^
* Fix compiler warning due to sign comparison
When compiling with -Werror, this causes the build to fail.
Warning was:
| yamux_frame.cpp:103:28: error: comparison of integers of different signs: 'gsl::span::index_type' (aka 'int') and 'const uint32_t' (aka 'const unsigned int') [-Werror,-Wsign-compare]
| if (frame_bytes.size() < YamuxFrame::kHeaderLength) {
| ~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
4 years ago
|
|
|
#
|
|
|
|
# Copyright Quadrivium LLC
|
|
|
|
# All Rights Reserved
|
Cross compiling fixes and improvements (#59)
* CMake: Expose CMake options to includes
This change shuffles the order of several CMake steps to expose CMake
options to included files.
By defining options before inclusion, included files are able to access
the input provided by the build system.
* CMake: Exclude test dependencies when building tests
* CMake: Allow build system to provide protobuf compiler
When building without Hunter, it is desirable to pass the path to protoc and
the protobuf include directory from the build system. Allow these variables
to be overridden.
Fixes the error:
| CMake Error at cmake/functions.cmake:52 (message):
| Protobuf_PROTOC_EXECUTABLE is empty
| Call Stack (most recent call first):
| cmake/functions.cmake:96 (compile_proto_to_cpp)
| src/crypto/protobuf/CMakeLists.txt:6 (add_proto_library)
* Fix build error due to missing include
Error was:
| literals.cpp: In function 'libp2p::common::Hash256 libp2p::common::operator""_hash256(const char*, size_t)':
| literals.cpp:17:36: error: no matching function for call to 'min(size_t&, long unsigned int)'
| 17 | std::copy_n(c, std::min(s, 32ul), hash.rbegin());
| | ^
* Fix build error due to mismatched types
Error was:
| literals.cpp: In function 'libp2p::common::Hash256 libp2p::common::operator""_hash256(const char*, size_t)':
| literals.cpp:19:36: error: no matching function for call to 'min(size_t&, long unsigned int)'
| 19 | std::copy_n(c, std::min(s, 32ul), hash.rbegin());
| | ^
* Fix compiler warning due to sign comparison
When compiling with -Werror, this causes the build to fail.
Warning was:
| yamux_frame.cpp:103:28: error: comparison of integers of different signs: 'gsl::span::index_type' (aka 'int') and 'const uint32_t' (aka 'const unsigned int') [-Werror,-Wsign-compare]
| if (frame_bytes.size() < YamuxFrame::kHeaderLength) {
| ~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
4 years ago
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
#
|
|
|
|
|
|
|
|
if (TESTING)
|
|
|
|
# https://docs.hunter.sh/en/latest/packages/pkg/GTest.html
|
|
|
|
hunter_add_package(GTest)
|
|
|
|
find_package(GTest CONFIG REQUIRED)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# https://docs.hunter.sh/en/latest/packages/pkg/Boost.html
|
|
|
|
hunter_add_package(Boost COMPONENTS random filesystem program_options)
|
|
|
|
find_package(Boost CONFIG REQUIRED random filesystem program_options)
|
|
|
|
|
|
|
|
# https://www.openssl.org/
|
|
|
|
hunter_add_package(OpenSSL)
|
|
|
|
find_package(OpenSSL REQUIRED)
|
|
|
|
|
|
|
|
# https://developers.google.com/protocol-buffers/
|
|
|
|
hunter_add_package(Protobuf)
|
|
|
|
find_package(Protobuf CONFIG REQUIRED)
|
|
|
|
|
|
|
|
hunter_add_package(qtils)
|
|
|
|
find_package(qtils CONFIG REQUIRED)
|
|
|
|
|
|
|
|
find_package(Threads)
|
|
|
|
|
|
|
|
hunter_add_package(c-ares)
|
|
|
|
find_package(c-ares CONFIG REQUIRED)
|
|
|
|
|
|
|
|
hunter_add_package(fmt)
|
|
|
|
find_package(fmt CONFIG REQUIRED)
|
|
|
|
|
|
|
|
hunter_add_package(yaml-cpp)
|
|
|
|
find_package(yaml-cpp CONFIG REQUIRED)
|
|
|
|
|
|
|
|
hunter_add_package(soralog)
|
|
|
|
find_package(soralog CONFIG REQUIRED)
|
|
|
|
|
|
|
|
# https://github.com/masterjedy/hat-trie
|
|
|
|
hunter_add_package(tsl_hat_trie)
|
|
|
|
find_package(tsl_hat_trie CONFIG REQUIRED)
|
|
|
|
|
|
|
|
# https://github.com/masterjedy/di
|
|
|
|
hunter_add_package(Boost.DI)
|
|
|
|
find_package(Boost.DI CONFIG REQUIRED)
|
|
|
|
|
|
|
|
# https://github.com/qdrvm/libp2p-sqlite-modern-cpp/tree/hunter
|
|
|
|
hunter_add_package(SQLiteModernCpp)
|
|
|
|
find_package(SQLiteModernCpp CONFIG REQUIRED)
|