This is an openFrameworks wrapper for cppsketch, which allows you to auto-recompile just your ofApp without recompiling the whole project. The point of this is so that you can more easily sketch small ideas without having to wait too long to see the results of tweaking numbers.
This only works on the mac for now, only tested with Xcode 11. Click the image below to see a video of how to set it up.
-
Use project generator to add ofxCppSketch or drag its folder into an empty project
-
Change your main.cpp to
#include "ofxCppSketch.h"
-
change the line
ofRunApp(new ofApp());
toofRunApp(new ofxCppSketch("ofApp", __FILE__));
-
Go into project build settings, find "Dead code stripping" - change it to NO
-
(Catalina only) if there is a section called "Hardened Runtime" under "Signing and Capabilities" and tick "Disable Library Validation"
Now, every time you save ofApp.h or ofApp.cpp whilst your app is running, it will recompile in the background - errors are displayed in the xcode console if compilation fails.
There are two examples, "simple" and "audio" - "simple" is the most basic setup, "audio" is an example of doing live coding with both graphics and audio.
Addons should work as long as they're listed in the addons.make file in the project folder. ofxCppSketch reads this to create header search paths for compilation.
WARNING: If you use the project generator to add addons, then every time you do that, it will re-enable "Dead code stripping", so you need to turn that back on.
If you want to put your project in a different location other than the standard openframeworks/apps/(myfolder)/(myproject) way, you need to tell ofxCppSketch where the OF folder root is. The easiest way to do this is paste
GCC_PREPROCESSOR_DEFINITIONS = OF_ROOT=\"$(OF_PATH)\"
at the end of your project's Project.xcconfig file.