Skip to content

Fix macOS framework build to properly include headers#964

Merged
revmischa merged 3 commits into
masterfrom
feat/mac-framework
Feb 16, 2026
Merged

Fix macOS framework build to properly include headers#964
revmischa merged 3 commits into
masterfrom
feat/mac-framework

Conversation

@revmischa
Copy link
Copy Markdown
Member

@revmischa revmischa commented Feb 2, 2026

Fixes the empty framework issue from ef00cfc where headers weren't being copied into the frameworks.

Turns out CMake's FRAMEWORK property is pretty broken - it requires headers to be added as target sources and set as PUBLIC_HEADER, and even then it flattens everything into Headers/ losing the directory structure we need for the C++ interface subdirs (Audio/, Renderer/).

This PR ditches CMake's framework support and builds the .framework bundles manually with the correct structure.

What's new:

  • cmake/MacOSFramework.cmake - does the actual framework building
  • scripts/test-macos-framework.sh - CI script to validate the frameworks are correct

Tested locally:

  • Framework build works, headers are there, directory structure preserved
  • Non-framework build still works
  • Linkability test passes

Mischa added 2 commits February 2, 2026 08:55
The previous implementation using CMake's built-in FRAMEWORK property
had two issues:
1. Headers were not copied into the framework at all
2. PUBLIC_HEADER flattens directory structure, breaking C++ interface

This replaces the CMake FRAMEWORK support with a custom MacOSFramework
cmake module that:
- Builds proper framework bundles from scratch
- Preserves header directory hierarchy (Audio/, Renderer/ subdirs)
- Creates correct symlink structure (Versions/A, Current, etc.)
- Generates Info.plist with bundle metadata

Also adds CI test script (scripts/test-macos-framework.sh) that validates:
- Framework directory structure
- Header completeness
- Linkability (compile and link test program)

Fixes the empty framework issue reported after ef00cfc.
- Add missing Renderer/TextureTypes.hpp to C++ framework headers
- Skip pkg-config generation for playlist in framework mode
- Use stored framework path property for install instead of TARGET_FILE_DIR
- Show compiler errors on linkability test failure instead of suppressing
- Fix comment about framework output location
@revmischa revmischa marked this pull request as ready for review February 3, 2026 05:42
New CI job matrix (build-framework):
- Tests framework builds on both arm64 and x86_64
- Tests with and without C++ interface
- Runs strict validation after build AND after install
- Verifies installed frameworks match build output

Test script improvements:
- Exhaustive header lists (all C API + all C++ headers)
- Exact header count validation (catches stale/unexpected files)
- Strict mode (STRICT=1) where SKIPs become FAILs
- Info.plist CFBundleExecutable validation
- Symlink target verification (Current, Headers, Resources)
- Mach-O dylib binary type check
- dylib install name validation
- Flexible framework search across build tree and install prefix
- Test pass counter in summary
@revmischa revmischa requested a review from kblaschke February 3, 2026 06:41
Copy link
Copy Markdown
Member

@kblaschke kblaschke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhh, macOS bundles are so much fun! 😆

Still way less code than you need to package a Qt application with CMake, even when using macdeployqt.

That one should be merged and we hopefully don't need to think about it again ;)

@kblaschke kblaschke linked an issue Feb 16, 2026 that may be closed by this pull request
2 tasks
@revmischa revmischa merged commit f67dac9 into master Feb 16, 2026
41 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.

[FEATURE] Build ProjectM.framework for MacOS

2 participants