Skip to content

Commit

Permalink
Fix gitlab CI and examples to work with Boost Json
Browse files Browse the repository at this point in the history
  • Loading branch information
MPogotsky committed Sep 7, 2024
1 parent 6044b18 commit 47797ea
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/cmakeLinux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update
sudo add-apt-repository ppa:mhier/libboost-latest
sudo add-apt-repository ppa:mhier/libboost-latest -y
sudo apt install libboost-system1.83-dev
sudo apt install libboost-url1.83-dev
sudo apt install libboost-json1.83-dev
sudo apt install libjsoncpp-dev libssl-dev libgtest-dev
Expand Down
2 changes: 1 addition & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ add_executable(ExampleApp
target_link_libraries(ExampleApp PRIVATE
Boost::system
Boost::url
jsoncpp_lib
Boost::json
Xapi::Xapi
)
6 changes: 2 additions & 4 deletions examples/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <string>

#include <boost/asio.hpp>
#include <jsoncpp/json/json.h>
#include <boost/json.hpp>
#include <xapi/Xapi.hpp>

boost::asio::awaitable<void> run(boost::asio::io_context &context)
Expand All @@ -29,9 +29,7 @@ boost::asio::awaitable<void> run(boost::asio::io_context &context)
{
std::cout << "Processing " << counter << std::endl;
auto result = co_await stream.listen();
Json::StreamWriterBuilder writer;
auto resultStr = Json::writeString(writer, result);
std::cout << resultStr << std::endl;
std::cout << boost::json::serialize(result) << std::endl;

counter += 1;
}
Expand Down

0 comments on commit 47797ea

Please sign in to comment.