So in order to help make my oF code a bit more portable, I’ve been digging into so-called “local addons” (mentioned, for example, at How do you use git for versioning an oF project?) which although not really documented much are incredibly useful. (For me at least, it means I can have a repo for the main project, with any third-party and/or forked addons included as git submodules in a child directory.)
After getting stuck in the beginning, @arturo was kind enough to give some guidance on how to use this mechanism in https://github.com/openframeworks/openFrameworks/issues/5932
The working approach seems to be:
- Create a subdirectory called
addons
(the name doesn’t really matter, but I’ll use it for clarity throughout the example) - Edit the project’s
addons.make
to use a relative path instead of just a name for the local addon, e.g.addons/ofxGstVideoSyncPlayer
instead ofofxGstVideoSyncPlayer
- Also edit the project’s
config.make
to exclude theaddons
directory (otherwise it gets compiled twice and other such nonsense):PROJECT_EXCLUSIONS = $(PROJECT_ROOT)/addons%
works for me - Use
make
as before
I have tested the above approach by moving a few standard/built-in addons to a local addons (e.g. ofxOsc
). I also tried a few third-party addons to be sure. No problem.
However, I have been using https://github.com/RandomStudio/ofxURG (which was forked from https://github.com/underdoeg/ofxURG) and when I apply the same methodology as above I always get make errors like:
make[1]: *** No rule to make target '/home/random/of_v0.9.8_linux64_release/apps/myApps/lidar-blob-tracker/obj/linux64/Release/addons/ofxURG/libs/urg/src/urg_ticks.o', needed by 'bin/lidar-blob-tracker'. Stop.
What could be going wrong? I suspect that the paths aren’t being resolved properly somewhere along the line, but it is important to note that this same addon compiles perfectly if located in the “root” addons folder. It’s only when moved that it gives the above error.
I’ll include the complete output at that stage of the build, for clarity:
Compiling /home/random/of_v0.9.8_linux64_release/apps/myApps/lidar-blob-tracker/addons/ofxURG/src/ofxURG.cpp
g++ -c -O3 -DNDEBUG -march=native -mtune=native -Wall -std=c++14 -DGCC_HAS_REGEX -DOF_USING_GTK -DOF_USING_GTK -DOF_USING_MPG123 -pthread -I/usr/include/gstreamer-1.0 -I/usr/lib/x86_64-linux-gnu/gstreamer-1.0/include -I/usr/include/AL -I/usr/include/libdrm -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/mirclient -I/usr/include/mircore -I/usr/include/mircookie -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/home/random/of_v0.9.8_linux64_release/libs/fmodex/include -I/home/random/of_v0.9.8_linux64_release/libs/glfw/include -I/home/random/of_v0.9.8_linux64_release/libs/glfw/include/GLFW -I/home/random/of_v0.9.8_linux64_release/libs/kiss/include -I/home/random/of_v0.9.8_linux64_release/libs/poco/include -I/home/random/of_v0.9.8_linux64_release/libs/tess2/include -I/home/random/of_v0.9.8_linux64_release/libs/utf8cpp/include -I/home/random/of_v0.9.8_linux64_release/libs/utf8cpp/include/utf8 -I/home/random/of_v0.9.8_linux64_release/libs/openFrameworks -I/home/random/of_v0.9.8_linux64_release/libs/openFrameworks/utils -I/home/random/of_v0.9.8_linux64_release/libs/openFrameworks/events -I/home/random/of_v0.9.8_linux64_release/libs/openFrameworks/math -I/home/random/of_v0.9.8_linux64_release/libs/openFrameworks/app -I/home/random/of_v0.9.8_linux64_release/libs/openFrameworks/sound -I/home/random/of_v0.9.8_linux64_release/libs/openFrameworks/gl -I/home/random/of_v0.9.8_linux64_release/libs/openFrameworks/video -I/home/random/of_v0.9.8_linux64_release/libs/openFrameworks/types -I/home/random/of_v0.9.8_linux64_release/libs/openFrameworks/3d -I/home/random/of_v0.9.8_linux64_release/libs/openFrameworks/graphics -I/home/random/of_v0.9.8_linux64_release/libs/openFrameworks/communication -I/home/random/of_v0.9.8_linux64_release/apps/myApps/lidar-blob-tracker/addons/ofxURG/src -I/home/random/of_v0.9.8_linux64_release/apps/myApps/lidar-blob-tracker/addons/ofxURG/libs -I/home/random/of_v0.9.8_linux64_release/apps/myApps/lidar-blob-tracker/addons/ofxURG/libs/urg -I/home/random/of_v0.9.8_linux64_release/apps/myApps/lidar-blob-tracker/addons/ofxURG/libs/urg/include -I/home/random/of_v0.9.8_linux64_release/apps/myApps/lidar-blob-tracker/addons/ofxURG/libs/urg/src -I/home/random/of_v0.9.8_linux64_release/apps/myApps/lidar-blob-tracker/addons/ofxURG/libs/urg/include -I/home/random/of_v0.9.8_linux64_release/addons/ofxGui/src -I/home/random/of_v0.9.8_linux64_release/addons/ofxOsc/src -I/home/random/of_v0.9.8_linux64_release/addons/ofxOsc/libs -I/home/random/of_v0.9.8_linux64_release/addons/ofxOsc/libs/oscpack -I/home/random/of_v0.9.8_linux64_release/addons/ofxOsc/libs/oscpack/src -I/home/random/of_v0.9.8_linux64_release/addons/ofxOsc/libs/oscpack/src/ip -I/home/random/of_v0.9.8_linux64_release/addons/ofxOsc/libs/oscpack/src/ip/posix -I/home/random/of_v0.9.8_linux64_release/addons/ofxOsc/libs/oscpack/src/ip/win32 -I/home/random/of_v0.9.8_linux64_release/addons/ofxOsc/libs/oscpack/src/osc -I/home/random/of_v0.9.8_linux64_release/addons/ofxXmlSettings/src -I/home/random/of_v0.9.8_linux64_release/addons/ofxXmlSettings/libs -I/home/random/of_v0.9.8_linux64_release/addons/ofxArgs/src -MMD -MP -MF /home/random/of_v0.9.8_linux64_release/apps/myApps/lidar-blob-tracker/obj/linux64/Release/addons/ofxURG/src/ofxURG.d -MT /home/random/of_v0.9.8_linux64_release/apps/myApps/lidar-blob-tracker/obj/linux64/Release/addons/ofxURG/src/ofxURG.o -o /home/random/of_v0.9.8_linux64_release/apps/myApps/lidar-blob-tracker/obj/linux64/Release/addons/ofxURG/src/ofxURG.o -c /home/random/of_v0.9.8_linux64_release/apps/myApps/lidar-blob-tracker/addons/ofxURG/src/ofxURG.cpp
Any help much appreciated!