Documentation to create addons

#1

Hi forum,

I have gone through some documentations about using an addon, but almost nothing about how to create an addon.

Any hint or reference ?

Thanks

2 Likes
#2

Yepp, ofxaddons.com has a how to guide and there’s also an addon template on github.

5 Likes
#3

And, as is the way (for better or worse) of openFrameworks :smile: , looking at the structure of the popular addons on ofxAddons.com might also give you some hints.

2 Likes
#4

Thanks for the references!

While going through the following:

http://ofxaddons.com/howto/

I came down to the following issue:

If the addon is for interfacing with external libraries include the source or any static libs for these in a libs folder
	ofxMyAddons/libs

I am interfacing with the external libraries, it is installed and dynamically linked. In that case do I have have to include the source inside the libs since the source is already included inside the /usr/include/bullet

How to refer to the dynamically linked libraries while building the addons ?

Thanks

#5

It varies depending on platform and whether or not the dynamic libs are installed – basically it isn’t completely worked out yet :slight_smile:

The best way we currently have (and the direction moving forward) is to define these dependencies on a per-platform basis in the addon_config.mk file included with the addon.

It sounds like you are working on linux and want to include a library that is installed on the system already. For an example of how to do this might be ofxJSON. It links into the system jsoncpp on Linux and compiles from source on other platforms.

You can find an example of the addon_config.mk file in this repo https://github.com/bakercp/ofxJSON.

In the future, we’ll have flags for including frameworks and dylibs for other platforms … but it’s still a work in progress.

Keep the questions coming!

#6

Also, unfortunately full documentation for the addon_config.mk stuff is still buried in one of my repos … but here’s a good example with more comments about what is available and what the makefile system can recognize:

#7

Hi @bakercp,

It is quite a hint, I must say. I have the following issue though:

ADDON_INCLUDES_EXCLUDE = libs/jsoncpp/include/json

I have nothing inside the libs directory from the very beginning, (ofxAppAddon/libs/(empty)),since i shall be linking dynamically. In that case do i have put any entry for

ADDON_INCLUDES_EXCLUDE ?

Thanks

#8

Hello again,

I am on my way to make a plugin and i am stuck of the following issue:

/obj/linux/Release/ofxUI/src/ofxUIDropDownList.o ../../../addons/obj/linux/Release/ofxUI/src/ofxUIFPSSlider.o ../../../addons/obj/linux/Release/ofxUI/src/ofxUINumberDialer.o ../../../addons/obj/linux/Release/ofxUI/src/ofxUISpectrum.o ../../../addons/obj/linux/Release/ofxUI/src/ofxUIToggleMatrix.o ../../../addons/obj/linux/Release/ofxUI/src/ofxUIDragableLabelButton.o ../../../addons/obj/linux/Release/ofxUI/src/ofxUIScrollableCanvas.o ../../../addons/obj/linux/Release/ofxUI/src/ofxUILabelToggle.o ../../../addons/obj/linux/Release/ofxUI/src/ofxUI2DPad.o ../../../addons/obj/linux/Release/ofxUI/src/ofxUIMovingGraph.o ../../../addons/obj/linux/Release/ofxUI/src/ofxUIImageToggle.o ../../../libs/openFrameworksCompiled/lib/linux/libopenFrameworks.a  ../../../addons/ofxAssimpModelLoader/libs/assimp/lib/linux/libassimp.a  ../../../addons/ofxAssimpModelLoader/libs/assimp/lib/linux/libassimp.a  ../../../addons/ofxBullet/libs/necessaryLib/lib/linux/static_necessaryLib2.a ../../../addons/ofxBullet/libs/necessaryLib/lib/linux/static_necessaryLib1.a  ../../../addons/ofxBullet/libs/necessaryLib/lib/linux/static_necessaryLib2.a ../../../addons/ofxBullet/libs/necessaryLib/lib/linux/static_necessaryLib1.a  -Wl,-rpath=./libs:./bin/libs -Wl,--as-needed -Wl,--gc-sections -L../../../libs/fmodex/lib/linux/ -lfmodex -lLinearMath -lBulletDynamics -lBulletCollision -lBulletFileLoader -lBulletSoftBody -lBulletWorldImporter -lBulletXmlWorldImporter ../../../libs/glfw/lib/linux/libglfw3.a ../../../libs/kiss/lib/linux/libkiss.a ../../../libs/poco/lib/linux/libPocoDataSQLite.a ../../../libs/poco/lib/linux/libPocoCrypto.a ../../../libs/poco/lib/linux/libPocoFoundation.a ../../../libs/poco/lib/linux/libPocoData.a ../../../libs/poco/lib/linux/libPocoNetSSL.a ../../../libs/poco/lib/linux/libPocoNet.a ../../../libs/poco/lib/linux/libPocoZip.a ../../../libs/poco/lib/linux/libPocoUtil.a ../../../libs/poco/lib/linux/libPocoDataMySQL.a ../../../libs/poco/lib/linux/libPocoXML.a ../../../libs/poco/lib/linux/libPocoDataODBC.a ../../../libs/rtAudio/lib/linux/libRtAudio.a ../../../libs/tess2/lib/linux/libtess2.a  ../../../libs/poco/lib/linux/libPocoNetSSL.a ../../../libs/poco/lib/linux/libPocoNet.a ../../../libs/poco/lib/linux/libPocoCrypto.a ../../../libs/poco/lib/linux/libPocoUtil.a ../../../libs/poco/lib/linux/libPocoXML.a ../../../libs/poco/lib/linux/libPocoFoundation.a  -lz -lgstapp-1.0 -lgstvideo-1.0 -lgstbase-1.0 -lgstreamer-1.0 -ludev -lfontconfig -lfreetype -lsndfile -lopenal -lssl -lcrypto -lpulse-simple -lpulse -lasound -lGLEW -lGLU -lGL -lgtk-3 -lgdk-3 -latk-1.0 -lgio-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lgobject-2.0 -lglib-2.0 -lmpg123   -lglut -lX11 -lXrandr -lXxf86vm -lXi -lXcursor -ldl -lpthread -lfreeimage 
../../../addons/ofxBullet/libs/necessaryLib/lib/linux/static_necessaryLib2.a: file not recognized: File truncated
collect2: error: ld returned 1 exit status
make[1]: *** [bin/myFirstBullet] Error 1
make[1]: Leaving directory `/home/sajjad/Downloads/openFrameworks/master/openFrameworks-master/apps/myApps/myFirstBullet'
make: *** [Release] Error 2

I am not even referring to it. Any hint to get rid of it ? By the way, i have the following contents of the addon_config.mk:

meta:
	ADDON_NAME = ofxBullet
	ADDON_DESCRIPTION = A wrapper for Bullet for openFrameworks
	ADDON_AUTHOR =
	ADDON_TAGS = "ofxBullet"
common:
linux:
	ADDON_LIBS =
	ADDON_CFLAGS = -I/usr/include/bullet
	ADDON_LDFLAGS = -lLinearMath -lBulletDynamics -lBulletCollision -lBulletFileLoader -lBulletSoftBody -lBulletWorldImporter -lBulletXmlWorldImporter

Thanks

#9

My guess is that you still have a leftover file from the addon template:

check this directory:

ofxBullet/libs/necessaryLib/lib/linux/static_necessaryLib2.a

and remove the file … I think that will take care of it.

1 Like
#10

Thanks @bakercp,

I removed all the contents inside the path you mentioned. In my case it was static_necessaryLib1.a and static_necessaryLib2.a, i removed them all and it worked fine.

Thanks

1 Like
#11

Nice work! Post a link to the addon if you share it.

#12

I’m looking to create my first addon.
I’ve gone thru addons.com and the readme files in the template. Thats all fine. I’ve copied the addon template and renames it etc…
What I am unclear on is the recommended method of developing the addon and examples.
Maybe its obvious and I am missing something but ‘myaddon’ folder is not a project.
So am I best to create a new project that includes ‘myaddon’ (skeleton at this point), and work on the addon and perhaps my first example file in this project. Then port these files over to the addon folder once working?
Or is there a more direct way of working directly from ‘myaddon’ folder?

#13

you can use the addon examples to develop the addon. I find that it is the most straight forwards way. Usually the IDE will show you the source and includes of the addon which you can code there directly. Remember to update the examples with the project generator so all the addon elements are available when you compile the addon.

#14

thanks for the reply.
So, would I then create a new proxy project that includes my addon, and then work on the Addon thru this proxy project?
I can see how that would be a workable solution.

I appreciate the feedback, I am just looking for the most effective workflow. I don’t want the addon to get littered with IDE files (i’m on windows) etc… I want to keep it clean as I work, so that version control is easy.

#15

Hi,

Right.

I think that it is the most effective solution. The project you create is not simply a proxy but on one hand an example and on the other is where you will test your addon with openFrameworks.
The addon will not get littered with any IDE file, on top of which, the addon template has a .gitignore file so git will automatically ignore any unneeded file.
hope this helps

1 Like
#16

Then the final step would be to manually move the ‘proxy’ projects src files to the example project folders I guess.

thanks a ton.

#17

nope. just create the addon’s source, either by hand or from the IDE itself, and edit these directly in the IDE, without need of moving any file.
So, these screenshots are from an addon I am working right now, it is Xcode but the same would apply for any IDE.

At least in xcode I can create the files directly in it, which will get properly compiled without need of anything else. I am not sure but in Visual Studio you might need to update the project with project generator if you add more files to the addons src folder

#18

Appreciated,
this is what I thought.

Its the Examples inside the Addons folder, that I meant I would have to move (from a project, to the addons example folder) since I don’t see the Examples folder under addons in Visual Studio (as they are included in the addon template).
That part I can work out later… I’ll reference some other addons to get it worked out.
For now I am setup and working.
So thank-you.

#19

Hi,
the example is actually the project that you open and use. So it’s files will not be inside of the addons folder in VS project explorer but will be the project´s src.
The example is just any regular OF project, which is inside the addons folder instead of the apps folder. So if you already have a project working with your addon just move the whole project folder into your addon’s folder and maybe rename it (just to add example to its name). Make sure you update it with project generator.

#20

Gotcha… that’s what I wasn’t getting.
I knew you could usually just open examples as a project, but I didn’t see how to create them in place.
Thanks.