Commit c48526fa authored by Sonja Happ's avatar Sonja Happ

Change usage of protobuf library

parent f9226871
......@@ -60,15 +60,10 @@ message(STATUS "${FEATURES}")
add_subdirectory(libs)
if(WITH_DB)
#compile protobuf lib (as submodule)
execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build/compile_protobuf.sh)
#find libprotobuf
find_library(LIB_PROTOBUF protobuf HINTS libs/protocolbuffers/)
#generate cpp and h files from proto files
execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build/proto_to_cpp.sh)
find_package(Protobuf 3.3.2 REQUIRED)
add_subdirectory(proto)
#add protobuf .cc files to source list of distaix
file(GLOB_RECURSE PROTO_SRC_LIST ${CMAKE_CURRENT_SOURCE_DIR}/proto/cpp/*.cc)
list(APPEND SRC_LIST ${PROTO_SRC_LIST})
list(APPEND SRC_LIST ${PROTO_SRC})
endif()
set(LIBRARIES_DISTAIX
......@@ -88,8 +83,8 @@ set(INCLUDE_DIRS_DISTAIX
if(WITH_DB)
#add a definition to use in the code
add_definitions(-DUSE_DB)
list(APPEND LIBRARIES_DISTAIX dbconnector ${LIB_PROTOBUF})
list(APPEND INCLUDE_DIRS_DISTAIX libs/protocolbuffers/src/ proto/cpp)
list(APPEND LIBRARIES_DISTAIX dbconnector ${Protobuf_LIBRARIES} ${Protobuf_PROTOC_LIBRARIES})
list(APPEND INCLUDE_DIRS_DISTAIX ${Protobuf_INCLUDE_DIRS} proto)
endif()
if(WITH_VILLAS)
......
......@@ -69,6 +69,16 @@ RUN cd /tmp && mkdir boost && cd boost && \
ldconfig && \
rm -rf /tmp/*
RUN cd /tmp && mkdir protobuf && cd protobuf && \
git clone https://github.com/protocolbuffers/protobuf . && \
git checkout 3.3.x && \
git submodule update --init --recursive && \
./autogen.sh && \
./configure && \
make -j$(nproc) && make install \
ldconfig && \
rm -rf /tmp/*
# Dependencies of DBconnector Library
RUN apt-get update && apt-get install -y \
libuv1-dev libssl-dev libpq-dev \
......
file(GLOB PROTOS ${CMAKE_CURRENT_SOURCE_DIR}/*.proto)
MESSAGE(STATUS "PROTOC: ${Protobuf_PROTOC_EXECUTABLE}")
foreach( proto_file ${PROTOS} )
FILE(TO_NATIVE_PATH ${proto_file} proto_native)
#generate cpp and h files from proto files
EXECUTE_PROCESS(COMMAND ${Protobuf_PROTOC_EXECUTABLE} --proto_path=${CMAKE_CURRENT_SOURCE_DIR} --cpp_out=${CMAKE_CURRENT_SOURCE_DIR} ${proto_native}
RESULT_VARIABLE rv)
MESSAGE("Generation of data model returned ${rv} for proto ${proto_native}")
endforeach( proto_file)
file(GLOB PROTO_SRC *.cc)
file(GLOB PROTO_HDR *.h)
set(PROTO_SRC ${PROTO_SRC} PARENT_SCOPE)
set(PROTO_HDR ${PROTO_HDR} PARENT_SCOPE)
#MESSAGE(STATUS "Generated cc: ${PROTO_SRC}")
#MESSAGE(STATUS "Generated h: ${PROTO_HDR}")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment