From 573643a1d3220830de47c810cb1a6be629ce7abd Mon Sep 17 00:00:00 2001 From: lonkaars Date: Fri, 10 May 2024 14:49:36 +0200 Subject: WIP protobuf hello world --- client/.gitignore | 1 + client/CMakeLists.txt | 14 ++++++++++++++ client/compile_commands.json | 1 + client/main.cpp | 25 +++++++++++++++++++++++++ client/makefile | 2 ++ 5 files changed, 43 insertions(+) create mode 100644 client/.gitignore create mode 100644 client/CMakeLists.txt create mode 120000 client/compile_commands.json create mode 100644 client/main.cpp create mode 100644 client/makefile (limited to 'client') diff --git a/client/.gitignore b/client/.gitignore new file mode 100644 index 0000000..ba2906d --- /dev/null +++ b/client/.gitignore @@ -0,0 +1 @@ +main diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt new file mode 100644 index 0000000..9e433b1 --- /dev/null +++ b/client/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.29) + +set(CMAKE_C_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +include(../proto/include.cmake) + +project(puzzlebox_client C CXX) + +add_executable(main + main.cpp + ) + diff --git a/client/compile_commands.json b/client/compile_commands.json new file mode 120000 index 0000000..25eb4b2 --- /dev/null +++ b/client/compile_commands.json @@ -0,0 +1 @@ +build/compile_commands.json \ No newline at end of file diff --git a/client/main.cpp b/client/main.cpp new file mode 100644 index 0000000..7a05049 --- /dev/null +++ b/client/main.cpp @@ -0,0 +1,25 @@ +#include +#include + +#include "puzbusv1.pb.h" + +int main() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + + puzbus::I2CMsg test_msg; + + test_msg.set_address(0x39); + test_msg.set_data("Test message data!"); + + std::string output; + test_msg.SerializeToString(&output); + + printf("output[%lu]:\n", output.size()); + for (size_t i = 0; i < output.size(); i++) { + printf("%02x ", output[i]); + } + printf("\n"); + + return 0; +} + diff --git a/client/makefile b/client/makefile new file mode 100644 index 0000000..8352615 --- /dev/null +++ b/client/makefile @@ -0,0 +1,2 @@ +include ../lazy.mk + -- cgit v1.2.3