Problem adding external libraries to plugin
Posted: Tue Sep 13, 2011 6:51 pm
One of the functions in the plugin I'm writing uses Google Protocol Buffers. I'm having a little trouble modifying to configure script to suit my needs.
Some context on how the protocol buffers work: You write a .proto file that specifies the contents of a buffer, which gets compiled into a pair of files. foo.proto becomes foo.pb.cc and foo.pb.h. In the linker phase, you need to include -lprotobuf.
My first attempt to account for this was to compile the .proto file I use into the C++ source and header files before running the configure script. I also renamed the .cc files to .cpp so I wouldn't have to change that part of the configure script in order to find them. Then, I modified this section of createPluginMakefile() in configure:
This successfully built and the -lprotobuf flag appeared in the Makefile for my plugin, but the plugin stopped showing up in CodeLite after building. I also tried explicitly adding -lprotobuf to both LINK_FLAGS and PLUGIN_LINK_FLAGS in the createVariables() function and had the same issue.
On a side note: There is one minor change that I had to make to the configure script to get the Makefile to generate properly. I have reported this as bug #3408692.
Some context on how the protocol buffers work: You write a .proto file that specifies the contents of a buffer, which gets compiled into a pair of files. foo.proto becomes foo.pb.cc and foo.pb.h. In the linker phase, you need to include -lprotobuf.
My first attempt to account for this was to compile the .proto file I use into the C++ source and header files before running the configure script. I also renamed the .cc files to .cpp so I wouldn't have to change that part of the configure script in order to find them. Then, I modified this section of createPluginMakefile() in configure:
Code: Select all
if [ "$plugin_name" = "CppCheck" ] ; then
createVariables "yes" "-I../sdk/codelite_cppcheck/"
elif [ "$plugin_name" = "DatabaseExplorer" ] ; then
createVariables "yes" "-I../sdk/databaselayer/include/"
elif [ "$plugin_name" = "MyPlugin" ] ; then
createVariables "yes" "" "-lprotobuf"
else
createVariables "yes"
fi
On a side note: There is one minor change that I had to make to the configure script to get the Makefile to generate properly. I have reported this as bug #3408692.