protocol buffers - How to get Google Protobuf working in Matlab? -
so if 1 want use google protocol buffers in matlab , using windows computer best way since matlab not in list of supported languages?
i haven't seen answer on , thought solution bit obscure going post how matlab_out using protoc.exe
a how google protocol buffer matlab out, using resources internet include zip file containing done.
unzip protobuf-‘version#’.zip (looks like: protobuf-#.#.#)
open file protobuf-#.#.# -> src
- choose favorite editor (notepad++ good) , change makefile.am (do not include quotes)
a. under “nobase_include_headers =” , below “$(gzheaders)”
add line “farsounder/protobuf/compiler/matlab/matlab_generator.h \” (note slash)
b. under “libprotoc_la_libadd = $(pthread_libs) libprotobuf.la”
add lines
“farsounder/protobuf/compiler/matlab/matlab_generator.cc \”
“farsounder/protobuf/compiler/matlab/matlab_plugin.cc \”
c. save file , exit out
- while still in src directory go ->google ->protobuf->compiler , change main.cc
a. under “#include <google/protobuf/compiler/java/java_generator.h>”
add line “#include <farsounder/protobuf/compiler/matlab/matlab_generator.h>”
b. in main function add lines “// proto2 matlab farsounder::protobuf::compiler::matlab::matlabgenerator matlab_generator; cli.registergenerator("--matlab_out", &matlab_generator, "generate matlab m files.");”
c. save file , exit out
- unzip protobuf-matlab
- open file protobuf-matlab ->src , copy farsounder directory protobuf-#.#.# -> src directory
- go protobuf-#.#.# directory , -> vsprojects , open protobuf.sln in visual studio, believe version should work
- there should popup wants convert solution file more updated version, go ahead , that
- if not see solutions explorer open using ctrl+alt+l
- open new windows explorer , go protobuf-#.#.# ->src->farsounder->protobuf->compiler->matlab, in visual studio using solutions explorer expand libprotoc->header files, in windows explorer copy matlab_generator.h file , paste header files directory
- still in solutions explorer go source files directory , copy in matlab_generator.cc
- contract libprotoc , right click on protoc , click on properties
- under configuration properties->linker->general, edit enable incremental linking no
- under configuration properties->linker->input, edit additional dependencies a. add lines “release\libprotobuf.lib” , underneath “release\libprotoc.lib” b. click ok on additional dependencies window , ok on protoc property page
- change build type release
- right-click on libprotobuf , select build, once completed right-click on libprotoc , select build
- once completed right-click on protoc , select build, should provide protoc.exe under protobuf-#.#.# ->vsprojects->release, allow create matlab .m files using matlab_out command
help find protobuf-#.#.# , protobuf-matlab:
follow these links:
https://code.google.com/p/protobuf-matlab/source/browse/
download zip file
https://github.com/google/protobuf/releases
download source code
extra help, using protoc.exe
- copy , paste created protoc.exe .proto file is
- run cmd , change directory protoc.exe , .proto file is
- run command (lets pretend name of .proto file “afunprotofile”) “
protoc –matlab_out=./ -i./ afunprotofile.proto”
Comments
Post a Comment