From c61beeba8b270d3bf47a000c225e35b5280b5b21 Mon Sep 17 00:00:00 2001 From: Pierre Ferran Date: Wed, 17 Jan 2024 18:13:37 -0500 Subject: [PATCH] No c++20 --- .github/workflows/ci.yml | 12 ++----- .github/workflows/release.yml | 6 +--- CMakeLists.txt | 2 +- include/sdk/sdk.h | 1 - src/sdk/sdk.cpp | 65 +++++++++++++++++------------------ 5 files changed, 36 insertions(+), 50 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 00f6607..faeea52 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,11 +40,7 @@ jobs: submodules: recursive - name: Install native dependencies run: | - brew install pkg-config llvm - brew link llvm - echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> /Users/runner/.bash_profile - export LDFLAGS="-L/usr/local/opt/llvm/lib" - export CPPFLAGS="-I/usr/local/opt/llvm/include" + brew install pkg-config - name: Configure cmake (intel) run: | cmake -S . -B build_intel/ -DVCPKG_BUILD_TYPE=release -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_OSX_ARCHITECTURES=x86_64 -DVCPKG_TARGET_TRIPLET=x64-osx @@ -59,11 +55,7 @@ jobs: submodules: recursive - name: Install native dependencies run: | - brew install pkg-config llvm - sudo brew link llvm - echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> /Users/runner/.bash_profile - export LDFLAGS="-L/usr/local/opt/llvm/lib" - export CPPFLAGS="-I/usr/local/opt/llvm/include" + brew install pkg-config - name: Configure cmake (arm64) run: | cmake -S . -B build_arm64/ -DVCPKG_BUILD_TYPE=release -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_OSX_ARCHITECTURES=arm64 -DVCPKG_TARGET_TRIPLET=arm64-osx diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e97379f..59362f7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -129,11 +129,7 @@ jobs: p12-password: ${{ secrets.APPLE_CERT_PASSWORD }} - name: Install native dependencies run: | - brew install pkg-config llvm - brew link llvm - echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> /Users/runner/.bash_profile - export LDFLAGS="-L/usr/local/opt/llvm/lib" - export CPPFLAGS="-I/usr/local/opt/llvm/include" + brew install pkg-config - name: Run build script run: | ./manual_osx_build.sh 1 diff --git a/CMakeLists.txt b/CMakeLists.txt index c5426f9..3a805c3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10) set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake) project(vector_audio LANGUAGES CXX) -set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set_property(GLOBAL PROPERTY USE_FOLDERS ON) diff --git a/include/sdk/sdk.h b/include/sdk/sdk.h index 324e4cc..0d984b1 100644 --- a/include/sdk/sdk.h +++ b/include/sdk/sdk.h @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include diff --git a/src/sdk/sdk.cpp b/src/sdk/sdk.cpp index 9242dc5..3962f5b 100644 --- a/src/sdk/sdk.cpp +++ b/src/sdk/sdk.cpp @@ -96,27 +96,30 @@ void SDK::handleAFVEventForWebsocket(sdk::types::Event event, // Lock needed outside of this function due to it being called somewhere // where the mutex is already locked - auto rxBar = shared::fetchedStations - | std::ranges::views::filter([this](const ns::Station& s) { - return pClient->GetRxState(s.getFrequencyHz()); - }); - - auto txBar = shared::fetchedStations - | std::ranges::views::filter([this](const ns::Station& s) { - return pClient->GetTxState(s.getFrequencyHz()); - }); - - auto xcBar = shared::fetchedStations - | std::ranges::views::filter([this](const ns::Station& s) { - return pClient->GetXcState(s.getFrequencyHz()); - }); - - jsonMessage["value"]["rx"] = std::move( - std::vector { rxBar.begin(), rxBar.end() }); - jsonMessage["value"]["tx"] = std::move( - std::vector { txBar.begin(), txBar.end() }); - jsonMessage["value"]["xc"] = std::move( - std::vector { xcBar.begin(), xcBar.end() }); + std::vector rxBar; + for (const auto& s : shared::fetchedStations) { + if (pClient->GetRxState(s.getFrequencyHz())) { + rxBar.push_back(s); + } + } + + std::vector txBar; + for (const auto& s : shared::fetchedStations) { + if (pClient->GetTxState(s.getFrequencyHz())) { + txBar.push_back(s); + } + } + + std::vector xcBar; + for (const auto& s : shared::fetchedStations) { + if (pClient->GetXcState(s.getFrequencyHz())) { + xcBar.push_back(s); + } + } + + jsonMessage["value"]["rx"] = std::move(rxBar); + jsonMessage["value"]["tx"] = std::move(txBar); + jsonMessage["value"]["xc"] = std::move(xcBar); this->broadcastOnWebsocket(jsonMessage.dump()); @@ -175,13 +178,11 @@ restinio::request_handling_status_t SDK::handleRxSDKCall( std::lock_guard lock(shared::fetchedStationMutex); - auto bar = shared::fetchedStations - | std::ranges::views::filter([this](const ns::Station& s) { - return pClient->GetRxState(s.getFrequencyHz()); - }); - std::string out; - for (const auto& f : bar) { + for (const auto& f : shared::fetchedStations) { + if (!pClient->GetRxState(f.getFrequencyHz())) { + continue; + } out += f.getCallsign() + ":" + f.getHumanFrequency() + ","; } @@ -203,13 +204,11 @@ restinio::request_handling_status_t SDK::handleTxSDKCall( std::lock_guard lock(shared::fetchedStationMutex); - auto bar = shared::fetchedStations - | std::ranges::views::filter([this](const ns::Station& s) { - return pClient->GetTxState(s.getFrequencyHz()); - }); - std::string out; - for (const auto& f : bar) { + for (const auto& f : shared::fetchedStations) { + if (!pClient->GetTxState(f.getFrequencyHz())) { + continue; + } out += f.getCallsign() + ":" + f.getHumanFrequency() + ","; }