Skip to content

BinaryBuilder: Support splitting output into multiple .cpp files to fix MSVC compilation limits#1646

Open
dylanruddy wants to merge 2 commits intojuce-framework:masterfrom
dylanruddy:master
Open

BinaryBuilder: Support splitting output into multiple .cpp files to fix MSVC compilation limits#1646
dylanruddy wants to merge 2 commits intojuce-framework:masterfrom
dylanruddy:master

Conversation

@dylanruddy
Copy link
Copy Markdown

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.

User can optimally split files per cpp file using BinaryBuilder command:
"PATH TO BINARY BUILDER" \
"PATH TO FILES" \
"PATH TO OUTPUT" \
"BinaryData" \
--split
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.

1 participant