Commit cc9fc4e1 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

Add protobuf to cmake files.

parent 8c46c680
......@@ -557,6 +557,10 @@ SET(PARAVIEW_LINK_XDMF ON)
ADD_SUBDIRECTORY(Utilities/Xdmf2)
#########################################################################
# Configure protobuf
ADD_SUBDIRECTORY(Utilities/protobuf)
#########################################################################
# Configure mpeg2 encoding
SET(VTKMPEG2_INSTALL_NO_DEVELOPMENT ${PV_INSTALL_NO_DEVELOPMENT})
......
......@@ -197,3 +197,20 @@ FUNCTION (add_executable_with_forwarding2
set (${out_real_exe_suffix} "${PV_EXE_SUFFIX}" PARENT_SCOPE)
ENDFUNCTION (add_executable_with_forwarding2)
#########################################################################
# Function to compile a proto file to generate a .h and .cc file
# Arguments:
# out_cpp_file_variable: variable that gets set with the full path to output file
# in_proto_file: full path to input file (e.g. ${CMAKE_CURRENT_SOURCE_DIR}/foo.pb)
FUNCTION (protobuf_generate out_cpp_file in_proto_file)
GET_FILENAME_COMPONENT(basename ${in_proto_file} NAME_WE)
GET_FILENAME_COMPONENT(absolute ${in_proto_file} ABSOLUTE)
GET_FILENAME_COMPONENT(path ${absolute} PATH)
SET(${outfile} ${CMAKE_CURRENT_BINARY_DIR}/${basename}.pb.cc)
ADD_CUSTOM_COMMAND(
OUTPUT ${${outfile}}
COMMAND protoc_compiler --cpp_out=${CMAKE_CURRENT_BINARY_DIR} --proto_path ${path} ${absolute}
DEPENDS ${in_proto_file} protoc_compiler
)
ENDFUNCTION (protobuf_generate)
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