Skip to content

Addon and project after compile scripts (picks up #217) - #658

Merged
danoli3 merged 2 commits into
openframeworks:masterfrom
danoli3:addon-after-compile-script
Oct 10, 2026
Merged

danoli3 merged 2 commits into
openframeworks:masterfrom
danoli3:addon-after-compile-script

Conversation

@danoli3

@danoli3 danoli3 commented Oct 8, 2026

Copy link
Copy Markdown
Member

Picks up #217 by @roymacdonald - his commit is ported as-is (authored by him, paths moved from ofxProjectGenerator/src to commandLine/src), with a follow-up commit on top. Supersedes #217.

Summary

  • ADDON_AFTER_COMPILE_SCRIPT in addon_config.mk (from Feature post compile script xcode #217): a script that runs after the project compiles, per platform section like the other addon keys. += adds lines
    osx:
    	ADDON_AFTER_COMPILE_SCRIPT = cp "$OF_PATH/addons/ofxNDI/libs/NDI/lib/osx/x64/libndi.3.dylib" "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/MacOS/"
    	ADDON_AFTER_COMPILE_SCRIPT += install_name_tool -change @rpath/libndi.3.dylib @executable_path/libndi.3.dylib "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/MacOS/$PRODUCT_NAME"
    vs:
    	ADDON_AFTER_COMPILE_SCRIPT = xcopy /Y "$(ProjectDir)..\..\..\addons\ofxNDI\libs\NDI\bin\x64\*.dll" "$(TargetDir)"
    
  • Follow-up changes:
    • lines are kept as a list and joined with newlines, not "; " - works for both a shell run script and a cmd post-build event
    • Xcode: each script gets its own PBXShellScriptBuildPhase ("Run Script - After Compile"). Before, every script reused one fixed phase id, so a second addon overwrote the first and the id was added to buildPhases twice
    • Visual Studio: addAfterRule was a no-op - scripts are now appended to the existing per-platform PostBuildEvent Command (after the dll xcopy), so x64 / ARM64 / ARM64EC, Debug and Release all run them
    • Project-level: -P / --postbuild "<script>" on the CLI, and an Advanced Post-build script field in the GUI next to Custom defines (9 locales)
    • PROJECT_AFTER_OSX in config.make now keeps everything after the first = - it split on every =, so echo A=B became echo A

Notes

  • Next step after this: generate CMakeLists.txt too, where the same scripts map to add_custom_command(TARGET ... POST_BUILD ...)

Test plan

  • Built commandLine and generated against a real OF checkout with a local test addon (osx: two-line script incl. FOO=1, vs: one line) plus -P 'echo project-level':
    • osx: two separate named Run Script phases, addon lines joined by newline, no duplicate phase ids; xcodebuild -list opens the project
    • vs: echo vs-after + echo project-level appended after the xcopy in all three platform PostBuildEvents; the osx: script isn't used
    • PROJECT_AFTER_OSX = echo A=B C=D -> run script echo A=B C=D

roymacdonald and others added 2 commits October 10, 2026 19:58
…project has been compiled. Only for xcode so far.

Ported from openframeworks#217 to commandLine/src.
@danoli3
danoli3 force-pushed the addon-after-compile-script branch from 15804ec to a762fb9 Compare October 10, 2026 07:07
@danoli3
danoli3 merged commit 7361721 into openframeworks:master Oct 10, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants