BinaryBuilder: Support splitting output into multiple .cpp files to fix MSVC compilation limits#1647
Open
dylanruddy wants to merge 1 commit intojuce-framework:masterfrom
Open
Conversation
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.
Problem
When embedding large numbers of binary resources (e.g. 87 audio samples), BinaryData.cpp
can exceed Visual Studio's translation unit limits, causing:
fatal error C1128: number of sections exceeded object file format limit: compile with /bigobj
This makes cross-platform builds that work on macOS fail to compile on Windows with MSVC.
Solution
Add an optional --split flag to BinaryBuilder that generates one BinaryData_N.cpp file
per resource instead of a single monolithic .cpp file. A single shared BinaryData.h is
still generated as before, so consuming code requires no changes.
Usage
Default (unchanged behavior):
BinaryBuilder /path/to/DATA /path/to/OUTPUT BinaryData
Split mode:
BinaryBuilder /path/to/DATA /path/to/OUTPUT BinaryData --split
Output files: BinaryData.h, BinaryData_0.cpp, BinaryData_1.cpp, ...
Notes
--split is fully opt-in; existing usage is unaffected.
Each split .cpp includes BinaryData.h.
Users must add all generated .cpp files to their project manually.