Integrated protobuf, added some empty messages

This commit is contained in:
Michael Mandl 2018-11-12 22:15:42 +01:00
parent 590e1dbfc6
commit 7b02a34cf3
5 changed files with 53 additions and 0 deletions

12
proto/DataModel.proto Normal file
View file

@ -0,0 +1,12 @@
syntax = "proto3";
package ESGRAF48;
import "MetaDataModel.proto";
import "V2SvkModel.proto";
message DataModel
{
MetaDataModel MetaData = 1;
V2SvkModel V2Svk = 2;
}

View file

@ -0,0 +1,8 @@
syntax = "proto3";
package ESGRAF48;
message MetaDataModel
{
string dummy = 1;
}

8
proto/V2SvkModel.proto Normal file
View file

@ -0,0 +1,8 @@
syntax = "proto3";
package ESGRAF48;
message V2SvkModel
{
string dummy = 1;
}

View file

@ -4,6 +4,7 @@ project(ESGRAF48 LANGUAGES CXX)
find_package(Qt5Widgets REQUIRED) find_package(Qt5Widgets REQUIRED)
find_package(Qt5PrintSupport REQUIRED) find_package(Qt5PrintSupport REQUIRED)
find_package(Protobuf REQUIRED)
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON) set(CMAKE_AUTORCC ON)
@ -16,6 +17,15 @@ qt5_add_resources(LOGO_TEST_QRC
mainwindow.qrc mainwindow.qrc
) )
set(DataModel_PROTO_FILES
../proto/DataModel.proto
../proto/MetaDataModel.proto
../proto/V2SvkModel.proto
)
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS
${DataModel_PROTO_FILES})
add_executable(${PROJECT_NAME} WIN32 add_executable(${PROJECT_NAME} WIN32
LogoTest.cpp LogoTest.cpp
DataModel.cpp DataModel.cpp
@ -23,6 +33,8 @@ add_executable(${PROJECT_NAME} WIN32
Age.cpp Age.cpp
${LOGO_TEST_UI} ${LOGO_TEST_UI}
${LOGO_TEST_QRC} ${LOGO_TEST_QRC}
${PROTO_SRCS}
${PROTO_HDRS}
) )
set_target_properties(${PROJECT_NAME} set_target_properties(${PROJECT_NAME}
@ -33,6 +45,7 @@ target_include_directories(${PROJECT_NAME}
PRIVATE PRIVATE
${CMAKE_CURRENT_LIST_DIR} ${CMAKE_CURRENT_LIST_DIR}
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
${Protobuf_INCLUDE_DIRS}
) )
target_link_libraries(${PROJECT_NAME} target_link_libraries(${PROJECT_NAME}
@ -50,6 +63,7 @@ target_link_libraries(${PROJECT_NAME}
ResultWidget ResultWidget
Qt5::Widgets Qt5::Widgets
Qt5::PrintSupport Qt5::PrintSupport
${Protobuf_LIBRARIES}
) )
add_subdirectory(CheckableItem) add_subdirectory(CheckableItem)

View file

@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 3.6)
project(V2Svk LANGUAGES CXX) project(V2Svk LANGUAGES CXX)
find_package(Qt5Widgets REQUIRED) find_package(Qt5Widgets REQUIRED)
find_package(Protobuf REQUIRED)
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
@ -10,10 +11,18 @@ qt5_wrap_ui(UI_HEADERS
V2SvkWidget.ui V2SvkWidget.ui
) )
set(V2Svk_PROTO_FILES
../../../proto/V2SvkModel.proto
)
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${V2Svk_PROTO_FILES})
add_library(${PROJECT_NAME} add_library(${PROJECT_NAME}
V2SvkWidget.cpp V2SvkWidget.cpp
V2SvkModel.cpp V2SvkModel.cpp
${UI_HEADERS} ${UI_HEADERS}
${PROTO_SRCS}
${PROTO_HDRS}
) )
set_target_properties(${PROJECT_NAME} set_target_properties(${PROJECT_NAME}
@ -25,6 +34,7 @@ target_include_directories(${PROJECT_NAME}
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE PRIVATE
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
${Protobuf_INCLUDE_DIRS}
) )
target_link_libraries(${PROJECT_NAME} target_link_libraries(${PROJECT_NAME}
@ -33,4 +43,5 @@ target_link_libraries(${PROJECT_NAME}
CheckableTest CheckableTest
CheckableTestModel CheckableTestModel
Qt5::Widgets Qt5::Widgets
${Protobuf_LIBRARIES}
) )