Skip to content
This repository has been archived by the owner on May 9, 2024. It is now read-only.

Commit

Permalink
No c++20
Browse files Browse the repository at this point in the history
  • Loading branch information
pierr3 committed Jan 17, 2024
1 parent 3687a7b commit c61beeb
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 50 deletions.
12 changes: 2 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion include/sdk/sdk.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <memory>
#include <mutex>
#include <optional>
#include <ranges>
#include <restinio/all.hpp>
#include <restinio/common_types.hpp>
#include <restinio/http_headers.hpp>
Expand Down
65 changes: 32 additions & 33 deletions src/sdk/sdk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ns::Station> { rxBar.begin(), rxBar.end() });
jsonMessage["value"]["tx"] = std::move(
std::vector<ns::Station> { txBar.begin(), txBar.end() });
jsonMessage["value"]["xc"] = std::move(
std::vector<ns::Station> { xcBar.begin(), xcBar.end() });
std::vector<ns::Station> rxBar;
for (const auto& s : shared::fetchedStations) {
if (pClient->GetRxState(s.getFrequencyHz())) {
rxBar.push_back(s);
}
}

std::vector<ns::Station> txBar;
for (const auto& s : shared::fetchedStations) {
if (pClient->GetTxState(s.getFrequencyHz())) {
txBar.push_back(s);
}
}

std::vector<ns::Station> 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());

Expand Down Expand Up @@ -175,13 +178,11 @@ restinio::request_handling_status_t SDK::handleRxSDKCall(

std::lock_guard<std::mutex> 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() + ",";
}

Expand All @@ -203,13 +204,11 @@ restinio::request_handling_status_t SDK::handleTxSDKCall(

std::lock_guard<std::mutex> 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() + ",";
}

Expand Down

0 comments on commit c61beeb

Please sign in to comment.