Browse Source

Update hunter, switch to C++20 (#214)

* Update hunter links

* Switch to C++20

* Update ci.yml

* Remove ninja, fix cmake version

* Fix event emitter test

* Update cmake/toolchain/clang-15_cxx17.cmake

Co-authored-by: Dmitriy Khaustov <khaustov.dm@gmail.com>

---------

Co-authored-by: Dmitriy Khaustov <khaustov.dm@gmail.com>
pull/215/head v0.1.13
kamilsa 1 year ago
committed by GitHub
parent
commit
b5da81b6c2
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      .github/workflows/ci.yml
  2. 2
      CMakeLists.txt
  3. 6
      cmake/Hunter/init.cmake
  4. 3
      cmake/Hunter/passwords.cmake
  5. 10
      cmake/san.cmake
  6. 3
      cmake/san/clang-14_cxx20_asan.cmake
  7. 3
      cmake/san/clang-14_cxx20_lsan.cmake
  8. 3
      cmake/san/clang-14_cxx20_msan.cmake
  9. 3
      cmake/san/clang-14_cxx20_tsan.cmake
  10. 3
      cmake/san/clang-14_cxx20_ubsan.cmake
  11. 3
      cmake/san/clang-15_cxx20_asan.cmake
  12. 3
      cmake/san/clang-8_cxx17_asan.cmake
  13. 3
      cmake/san/clang-8_cxx17_lsan.cmake
  14. 3
      cmake/san/clang-8_cxx17_msan.cmake
  15. 3
      cmake/san/clang-8_cxx17_tsan.cmake
  16. 3
      cmake/san/clang-8_cxx17_ubsan.cmake
  17. 3
      cmake/san/clang-9_cxx17_asan.cmake
  18. 3
      cmake/san/gcc-11_cxx20_asan.cmake
  19. 3
      cmake/san/gcc-8_cxx17_asan.cmake
  20. 3
      cmake/toolchain/clang-15_cxx17.cmake
  21. 3
      cmake/toolchain/clang-8_cxx17.cmake
  22. 8
      cmake/toolchain/compiler/clang-14.cmake
  23. 8
      cmake/toolchain/compiler/clang-15.cmake
  24. 8
      cmake/toolchain/compiler/gcc-11.cmake
  25. 2
      cmake/toolchain/cxx20.cmake
  26. 3
      cmake/toolchain/gcc-11_cxx20.cmake
  27. 3
      cmake/toolchain/gcc-8_cxx17.cmake
  28. 4
      src/transport/tcp/tcp_connection.cpp
  29. 3
      test/libp2p/event/event_emitter_test.cpp

14
.github/workflows/ci.yml

@ -15,7 +15,7 @@ jobs:
fail-fast: false
matrix:
# 3 jobs in total
os: [ubuntu-20.04, macOS-latest]
os: [ubuntu-latest, macos-latest]
compiler: [{
"cc": "gcc",
"cxx": "g++"
@ -24,7 +24,7 @@ jobs:
"cxx": "clang++"
}]
exclude:
- os: macOS-latest
- os: macos-latest
compiler:
cc: gcc
steps:
@ -37,21 +37,15 @@ jobs:
- name: install dependencies
run: |
set -e
if [ "$RUNNER_OS" = "macOS" ]; then
brew install ninja
else
sudo apt-get update || true
sudo apt-get install -y ninja-build
fi
sudo python3 -m pip install --upgrade pip
sudo pip3 install scikit-build
sudo pip3 install cmake requests gitpython gcovr pyyaml
sudo pip3 install cmake=="3.25.0" requests gitpython gcovr pyyaml
- name: cmake
env:
CC: ${{ matrix.compiler.cc }}
CXX: ${{ matrix.compiler.cxx }}
run: cmake . -GNinja -Bbuild
run: cmake . -Bbuild
- name: build
run: cmake --build build -- -j4
- name: test

2
CMakeLists.txt

@ -7,7 +7,7 @@ if (CCACHE_FOUND)
endif (CCACHE_FOUND)
set(CMAKE_TOOLCHAIN_FILE
"${CMAKE_SOURCE_DIR}/cmake/toolchain/cxx17.cmake"
"${CMAKE_SOURCE_DIR}/cmake/toolchain/cxx20.cmake"
CACHE
FILEPATH
"Default toolchain"

6
cmake/Hunter/init.cmake

@ -22,7 +22,7 @@ set(
set(
HUNTER_CACHE_SERVERS
"https://github.com/soramitsu/hunter-binary-cache"
"https://github.com/qdrvm/hunter-binary-cache"
CACHE
STRING
"Binary cache server"
@ -31,7 +31,7 @@ set(
include(${CMAKE_CURRENT_LIST_DIR}/HunterGate.cmake)
HunterGate(
URL "https://github.com/soramitsu/soramitsu-hunter/archive/v0.23.257-soramitsu42.tar.gz"
SHA1 "6f54ad82c2322ff0e234ab96a44a12da1478f1be"
URL "https://github.com/qdrvm/hunter/archive/refs/tags/v0.23.257-qdrvm1.zip"
SHA1 "e6aee2a8086d749d19d31d587f1f19c750a820ea"
LOCAL
)

3
cmake/Hunter/passwords.cmake

@ -1,9 +1,8 @@
hunter_upload_password(
# REPO_OWNER + REPO = https://github.com/forexample/hunter-cache
REPO_OWNER "soramitsu"
REPO_OWNER "qdrvm"
REPO "hunter-binary-cache"
# USERNAME = warchant
USERNAME "$ENV{GITHUB_HUNTER_USERNAME}"
# PASSWORD = GitHub token saved as a secure environment variable

10
cmake/san.cmake

@ -1,16 +1,16 @@
if(ASAN)
print("Address Sanitizer is enabled")
include(${CMAKE_CURRENT_LIST_DIR}/san/clang-8_cxx17_asan.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/san/clang-14_cxx20_asan.cmake)
elseif(LSAN)
print("Leak Sanitizer is enabled")
include(${CMAKE_CURRENT_LIST_DIR}/san/clang-8_cxx17_lsan.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/san/clang-14_cxx20_lsan.cmake)
elseif(MSAN)
print("Memory Sanitizer is enabled")
include(${CMAKE_CURRENT_LIST_DIR}/san/clang-8_cxx17_msan.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/san/clang-14_cxx20_msan.cmake)
elseif(TSAN)
print("Thread Sanitizer is enabled")
include(${CMAKE_CURRENT_LIST_DIR}/san/clang-8_cxx17_tsan.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/san/clang-14_cxx20_tsan.cmake)
elseif(UBSAN)
print("Undefined Behavior Sanitizer is enabled")
include(${CMAKE_CURRENT_LIST_DIR}/san/clang-8_cxx17_ubsan.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/san/clang-14_cxx20_ubsan.cmake)
endif()

3
cmake/san/clang-14_cxx20_asan.cmake

@ -0,0 +1,3 @@
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/flags/sanitize_address.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/compiler/clang-14.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/cxx20.cmake)

3
cmake/san/clang-14_cxx20_lsan.cmake

@ -0,0 +1,3 @@
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/flags/sanitize_leak.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/compiler/clang-14.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/cxx20.cmake)

3
cmake/san/clang-14_cxx20_msan.cmake

@ -0,0 +1,3 @@
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/flags/sanitize_memory.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/compiler/clang-14.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/cxx20.cmake)

3
cmake/san/clang-14_cxx20_tsan.cmake

@ -0,0 +1,3 @@
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/flags/sanitize_thread.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/compiler/clang-14.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/cxx20.cmake)

3
cmake/san/clang-14_cxx20_ubsan.cmake

@ -0,0 +1,3 @@
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/flags/sanitize_undefined.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/compiler/clang-14.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/cxx20.cmake)

3
cmake/san/clang-15_cxx20_asan.cmake

@ -0,0 +1,3 @@
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/flags/sanitize_address.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/compiler/clang-15.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/cxx20.cmake)

3
cmake/san/clang-8_cxx17_asan.cmake

@ -1,3 +0,0 @@
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/flags/sanitize_address.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/compiler/clang-8.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/cxx17.cmake)

3
cmake/san/clang-8_cxx17_lsan.cmake

@ -1,3 +0,0 @@
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/flags/sanitize_leak.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/compiler/clang-8.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/cxx17.cmake)

3
cmake/san/clang-8_cxx17_msan.cmake

@ -1,3 +0,0 @@
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/flags/sanitize_memory.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/compiler/clang-8.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/cxx17.cmake)

3
cmake/san/clang-8_cxx17_tsan.cmake

@ -1,3 +0,0 @@
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/flags/sanitize_thread.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/compiler/clang-8.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/cxx17.cmake)

3
cmake/san/clang-8_cxx17_ubsan.cmake

@ -1,3 +0,0 @@
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/flags/sanitize_undefined.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/compiler/clang-8.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/cxx17.cmake)

3
cmake/san/clang-9_cxx17_asan.cmake

@ -1,3 +0,0 @@
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/flags/sanitize_address.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/compiler/clang-9.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/cxx17.cmake)

3
cmake/san/gcc-11_cxx20_asan.cmake

@ -0,0 +1,3 @@
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/flags/sanitize_address.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/compiler/gcc-11.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/cxx20.cmake)

3
cmake/san/gcc-8_cxx17_asan.cmake

@ -1,3 +0,0 @@
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/flags/sanitize_address.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/compiler/gcc-8.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../toolchain/cxx17.cmake)

3
cmake/toolchain/clang-15_cxx17.cmake

@ -0,0 +1,3 @@
include(${CMAKE_CURRENT_LIST_DIR}/../print.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/compiler/clang-15.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/cxx20.cmake)

3
cmake/toolchain/clang-8_cxx17.cmake

@ -1,3 +0,0 @@
include(${CMAKE_CURRENT_LIST_DIR}/../print.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/compiler/clang-8.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/cxx17.cmake)

8
cmake/toolchain/compiler/clang-8.cmake → cmake/toolchain/compiler/clang-14.cmake

@ -11,15 +11,15 @@ if(XCODE_VERSION)
fatal_error(${_err})
endif()
find_program(CMAKE_C_COMPILER clang-8)
find_program(CMAKE_CXX_COMPILER clang++-8)
find_program(CMAKE_C_COMPILER clang-14)
find_program(CMAKE_CXX_COMPILER clang++-14)
if(NOT CMAKE_C_COMPILER)
fatal_error("clang-8 not found")
fatal_error("clang-14 not found")
endif()
if(NOT CMAKE_CXX_COMPILER)
fatal_error("clang++-8 not found")
fatal_error("clang++-14 not found")
endif()
set(

8
cmake/toolchain/compiler/clang-9.cmake → cmake/toolchain/compiler/clang-15.cmake

@ -13,15 +13,15 @@ if(XCODE_VERSION)
fatal_error(${_err})
endif()
find_program(CMAKE_C_COMPILER clang-9)
find_program(CMAKE_CXX_COMPILER clang++-9)
find_program(CMAKE_C_COMPILER clang-15)
find_program(CMAKE_CXX_COMPILER clang++-15)
if(NOT CMAKE_C_COMPILER)
fatal_error("clang-9 not found")
fatal_error("clang-15 not found")
endif()
if(NOT CMAKE_CXX_COMPILER)
fatal_error("clang++-9 not found")
fatal_error("clang++-15 not found")
endif()
set(

8
cmake/toolchain/compiler/gcc-8.cmake → cmake/toolchain/compiler/gcc-11.cmake

@ -4,15 +4,15 @@ else()
set(POLLY_COMPILER_GCC_8_CMAKE_ 1)
endif()
find_program(CMAKE_C_COMPILER gcc-8)
find_program(CMAKE_CXX_COMPILER g++-8)
find_program(CMAKE_C_COMPILER gcc-11)
find_program(CMAKE_CXX_COMPILER g++-11)
if(NOT CMAKE_C_COMPILER)
fatal_error("gcc-8 not found")
fatal_error("gcc-11 not found")
endif()
if(NOT CMAKE_CXX_COMPILER)
fatal_error("g++-8 not found")
fatal_error("g++-11 not found")
endif()
set(

2
cmake/toolchain/cxx17.cmake → cmake/toolchain/cxx20.cmake

@ -1,3 +1,3 @@
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

3
cmake/toolchain/gcc-11_cxx20.cmake

@ -0,0 +1,3 @@
include(${CMAKE_CURRENT_LIST_DIR}/../print.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/compiler/gcc-11.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/cxx20.cmake)

3
cmake/toolchain/gcc-8_cxx17.cmake

@ -1,3 +0,0 @@
include(${CMAKE_CURRENT_LIST_DIR}/../print.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/compiler/gcc-8.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/cxx17.cmake)

4
src/transport/tcp/tcp_connection.cpp

@ -188,8 +188,8 @@ namespace libp2p::transport {
}
boost::asio::async_connect(
socket_, iterator,
[wptr{weak_from_this()}, cb{std::move(cb)}](auto &&ec,
auto &&endpoint) {
[wptr{weak_from_this()}, cb{std::move(cb)}](
auto &&ec, const Tcp::endpoint &endpoint) {
auto self = wptr.lock();
if (!self || self->closed_by_host_) {
return;

3
test/libp2p/event/event_emitter_test.cpp

@ -83,6 +83,7 @@ TEST_F(EventEmitterTest, Unsubscribe) {
*/
TEST_F(EventEmitterTest, NonCopyableEvent) {
struct NonCopyableEvent {
explicit NonCopyableEvent(int i) : value(i) {}
NonCopyableEvent(const NonCopyableEvent &other) = delete;
NonCopyableEvent &operator=(const NonCopyableEvent &other) = delete;
NonCopyableEvent(NonCopyableEvent &&other) noexcept = default;
@ -109,6 +110,7 @@ TEST_F(EventEmitterTest, NonCopyableEvent) {
*/
TEST_F(EventEmitterTest, NonMovableEvent) {
struct NonMovableEvent {
explicit NonMovableEvent(int v) : value(v) {}
NonMovableEvent(const NonMovableEvent &other) = default;
NonMovableEvent &operator=(const NonMovableEvent &other) = default;
NonMovableEvent(NonMovableEvent &&other) noexcept = delete;
@ -134,6 +136,7 @@ TEST_F(EventEmitterTest, NonMovableEvent) {
*/
TEST_F(EventEmitterTest, NonCopyableOrMovableEvent) {
struct NonCopyableOrMovableEvent {
explicit NonCopyableOrMovableEvent(int v) : value(v) {}
NonCopyableOrMovableEvent(const NonCopyableOrMovableEvent &other) = delete;
NonCopyableOrMovableEvent &operator=(
const NonCopyableOrMovableEvent &other) = delete;

Loading…
Cancel
Save