ADD: added protobuf compile options and a folder for all .proto Files
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,2 +1,5 @@
|
||||
build
|
||||
.cache
|
||||
|
||||
/include/WHISPER/Messages/Protos/*.pb.cc
|
||||
/include/WHISPER/Messages/Protos/*.pb.h
|
||||
@@ -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()
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user