How to add/write local_addons and pin dependencies/OF versions?

I recently started with CPP and OF but I have problems understanding how to manage dependencies in OF/CPP. Is there no package manager or did I miss something? It seems the hardest part of CPP are not pointers or interfaces but how to actually build and manage external code?

I have written functionality for OF that I want to develop outside of an OF application in order to have a better separation, resulting in better re-usability.

I therefore copied the two necessary files ofxGdef.hpp and ofxGdef.cpp into a folder structure ofxGdef/src/ [where ofxGdef is not the root of my git repo but a folder within my git repo].

I therefore added a git submodule to my of app via

git submodule add https://github.com/my-git-name/gdef.git local_addons

and added the path

./local_addons/gdef/ofxGdef

to ./addons.make, but Xcode fails to find the Gdef class defined in ofxGdef.h.

Adding variations such as ./local_addons/gdef/ofxGdef/src or copying in such a way that ./local_addons/ofxGdef makes sense still results in a compiler error. Restarting Xcode did not help either.

Also adding

PROJECT_EXTERNAL_SOURCE_PATHS = ./local_addons/gdef/ofxGdef/src

to config.make did not resolve the issue.

What is the best way to make this work?

Also I have some other questions regarding pinpointing dependencies

  • The project generator creates files that are relative/absolute to my “OF sdk download folder” which may work on my local machine but seems error-prone when transferring it to a different machine or upgrading OF - what is the best way to resolve this for git archiving purposes, such as adding OF as a a git submodule to my project in order to stick to specific versions of OF?
  • If I rely on other dependencies such as ofxOSC in my project or plugin - how do I add them in a good, reproducible manner? As a git submodule? But how do I avoid version clashes if it is already imported in anther part of the app, but maybe in another version?
  • How do you develop plugins? Even bigger plugin repos do not reveal on how to setup the OF dependencies for plugin development.

Some information about my system:

macOS 12.3.1
Xcode 13.2.1
OF: of_v0.11.2_osx_release

Hi @capital-G , I’m super ignorant on how to use git, especially with a github repository. So I hope the following is helpful.

I think a copy of the addon needs to reside in the /addons folder. There are some threads in the forum about issues with external file storage (iCloud for example). If a copy of the addon is in the /addons folder, the addon should appear as an option in the project generator, and should be found by the linker when compiling on macOS. Addons can be header-only, or have dynamic libs included. Each addon should have an addon.make file that describes it, including the dependencies on other addons (ofxCv depends on ofxOpenCv for example) or other libraries (the headers and compiled TBB libs in ofxTtb for example).

With linux there is an install script that installs OF dependencies from the distro-specific repository. With macOS, the dependencies come with the release and can be found in the /lib folder.

Thanks for the reply :slight_smile:

This works but is IMO not the clean solution I long for as the addon is now in a global folder, therefore the build process is not stateless anymore as the project relies on files outside its own directory (as well as the of-files - how do you pin these?). This means I also can not pin a version/commit of the used plugins within the app/git repo.

I meant something more (cpp) general, like Nodes npm, Javas gradle or Pythons pip which takes care of all (sub-)dependencies. It seems most dependency management is done by copying files (manually) and/or according to a README? :confused:

Yeah it would be great to have something platformio alike, which you could point to addons git url including specific commits or tags and it could check it out accordingly.

Today you manage your addons folder in your of installation. to use between different machines I’ve just decided to stick to the relative path …/…/…

it is problematic sometimes when we have different addons with the same name, ex: ofxNDI

hello,
I was working on a package manager. I will have some travel time over the next couple of weeks, planning to push an update with a proper GUI.

it works with (gitignored) local_addons inside your project and stores git url and commit hash as a comment in the addons.make file.

i got too busy with projects, so i lost a bit track of the current status, but i will post an update soon.

t

I uploaded a new version with a simplified gui.
i just build it on osx, but in theory it should compile for windows and linux as well, at least we had it working on the past (ci is not yet set up).
if you download it and move it inside your oF directory it should pick up paths correctly, e.g. move it to oF/apps/myApp/ofPackageManager

here are a couple of screenshots

edit: updating once again: Release 0.2.1 · thomasgeissl/ofPackageManager · GitHub