aboutsummaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2024-05-10 14:49:36 +0200
committerlonkaars <loek@pipeframe.xyz>2024-05-10 14:49:36 +0200
commit573643a1d3220830de47c810cb1a6be629ce7abd (patch)
tree162a6923f388fef4ab62ddb7ed4a2c82f274fa97 /client
parentae8dfd2028bfbac5f37bbf4f5d7c2d8bff618b02 (diff)
WIP protobuf hello world
Diffstat (limited to 'client')
-rw-r--r--client/.gitignore1
-rw-r--r--client/CMakeLists.txt14
l---------client/compile_commands.json1
-rw-r--r--client/main.cpp25
-rw-r--r--client/makefile2
5 files changed, 43 insertions, 0 deletions
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 <cstdio>
+#include <string>
+
+#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
+