ADD: added protobuf compile options and a folder for all .proto Files

This commit is contained in:
Henry Winkel
2022-10-22 16:47:34 +02:00
parent a9eb981de2
commit 4e4fdb5b23
3 changed files with 10 additions and 8 deletions

5
.gitignore vendored
View File

@@ -1,2 +1,5 @@
build
.cache
.cache
/include/WHISPER/Messages/Protos/*.pb.cc
/include/WHISPER/Messages/Protos/*.pb.h

View File

@@ -29,6 +29,7 @@ set(protobuf_BUILD_EXAMPLES OFF CACHE INTERNAL "")
add_subdirectory(libs/protobuf EXCLUDE_FROM_ALL)
include(protobuf)
protobuf_generate_cpp(PROTO_PATH include/WHISPER/Messages/Protos/ CPP_PATH include/WHISPER/Messages/Protos HPP_PATH include/WHISPER/Messages/Protos)
if(protobuf_VERBOSE)
message(STATUS "Using Protocol Buffers ${protobuf_VERSION}")
@@ -59,17 +60,16 @@ target_include_directories(whisper-com PUBLIC
add_executable(main
src/main.cpp
../include/WHISPER/Messages/Protos/join.pb.cc
)
add_dependencies(main protoc)
target_link_libraries(main
whisper-com
loguru
libprotobuf
)
protobuf_generate_cpp(PROTO_PATH protos CPP_PATH include/WHISPER/Messages/Protos HPP_PATH include/WHISPER/Messages/Protos)
#
@@ -83,6 +83,5 @@ IF (${TEST_WHISPER_COMMUNICATION_LIBRARY})
target_link_libraries(test_test Catch2::Catch2 whisper-com loguru)
catch_discover_tests(test_test)
add_dependencies(test_test protoc)
ENDIF()

View File

@@ -1,12 +1,12 @@
#include <iostream>
#include "protos/join.pb.h"
#include "../include/WHISPER/Messages/Protos/join.pb.h"
int main()
{
GOOGLE_PROTOBUF_VERIFY_VERSION;
return 0;
}