Add custom preprocessor defines and a macOS/iOS renderer selector - #651
Merged
Merged
Conversation
danoli3
force-pushed
the
macos-renderer-defines
branch
from
September 14, 2026 07:41
f2784e5 to
1661486
Compare
New -D/--defines CLI flag (comma-separated KEY[=VALUE] list) applies
project-level preprocessor defines via a new public addProjectDefine()
wrapper around the existing (protected) addDefine(). GUI: a "Custom
defines" text field on all platforms, plus a Renderer dropdown shown
for the Xcode-based osx/ios/macos targets that writes OF_USE_ANGLE=1
or OF_USE_DAWN=1 alongside any manually-entered defines.
Found and fixed a real pre-existing bug while wiring this up:
xcodeProject::saveProjectFile()'s "fixing XCode one item array" logic
used `auto v { j[p] }` (brace-init) instead of `auto v = j[p]`
(copy-init). nlohmann::json's initializer_list constructor wraps a
single json value in an array, so on a freshly-created key (j[p] ==
null) this made v == [null] instead of null, and that got pushed into
the array instead of being correctly skipped - corrupting the first
element of *every* freshly-created array-valued Xcode build setting
with a leading [null], including GCC_PREPROCESSOR_DEFINITIONS for any
addon using ADDON_DEFINES, not just this new feature.
Verified with a real build: generated an osx project with -D and
confirmed GCC_PREPROCESSOR_DEFINITIONS ends up correct and duplicate-
free for both Debug and Release; regression-tested against an addon
using ADDON_DEFINES to confirm the existing addon-defines path also
now works correctly (it was silently broken by the same bug before).
danoli3
force-pushed
the
macos-renderer-defines
branch
from
September 14, 2026 14:11
1661486 to
11279ed
Compare
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds CLI/GUI support for custom preprocessor defines, plus an Xcode-only Renderer selector for OpenGL, ANGLE, and Dawn.
Also fixes a pre-existing Xcode JSON bug that corrupted array-valued build settings, verified across CLI, addons, Debug/Release, and Electron GUI.