openframeworks / apothecary

This is the OpenFrameworks library apothecary. It mixes formulas and potions to build and update the C/C++ lib dependencies.
Other
56 stars 51 forks source link

macOS All platforms - Super Mega XCFramework #348

Closed danoli3 closed 5 months ago

danoli3 commented 6 months ago

An idea now with the XCFrameworks is to fix a further problem where we have multi platform libs being included without isolation to target, this problem is solved by XCFrameworks... however requires them all to be merged within.

Due to the complexities and computational limitations we require all the library runners to run separately for performance, isolation of problems for platform specific issues etc.

Merging all these binaries together can be done here on Apothecary via a concept known as workflow runners.

Example GitHub Action Workflow runner wait until types completed then run merge

name: Merge Frameworks After Builds
on:
  workflow_run:
    workflows: ["iOS Build", "tvOS Build", "OSX Build", "WatchOS Build", "MacCatOS Build", "VisionOS-XROS Build"]
    types: [completed]
jobs:
  merge:
    runs-on: ubuntu-latest
    steps:
      - name: Download Artifacts
        run: echo "This download will wait until all workflow runs by name above are completed. name is the trigger and must be exact"
      # Merge all targets into Super Mega XCFramework
       - name: Download Artifacts
        run: echo "Super Mega XCFramework"

This way we will have all platforms merged into one location: macOS

We can use the re-write to all platforms to distinguish osx/tvos/ios/catos/xros/watchos into libraries all targetting one specific location: macos.

This solves many problems with one stone. All binaries are still isolated within the xcframework separately for each target platform.

Requirements: Artifacts of each post build deposited zip to the artifact cache system. Clean up of artifacts after merge.

This process will not run if any listed names do not complete

For openFrameworks core this would require minimal adjustements inline with our switch out osx lib to macos, however now will be for all macOS platforms.

This would mean also a larger payload for release binaries for macOS as this would include all potential targets for the developer. Probably best anyways as lets foster an environment for macOS developers to think they can and do whatever target they want within that architecture. Most oF developers I know always have iOS and macOS downloaded anyways.

danoli3 commented 6 months ago

@ofTheo @dimitre This solves some issues I was noticing when having all binaries downloaded at once with project generator including them all, and then I got thinking deeper with the problem and really what XCFrameworks are trying to achieve from Apples spec. So I watched the lecture and this is really what they want us to do. They also want us to include binary information for versions and commands which can be copied into the xcframework manually/

ofTheo commented 6 months ago

I definitely get the upside and logic to this but a few things make me nervous:

1 - if something fails with iOS/tvOS/watchOS then macOS nightly also breaks.

2 - the size of the download will be 3-4 bigger than it is now which is quite big already.

I wonder if we could have a slim macOS only version and the a full macOS plus everything else? Or would that be difficult to maintain?

danoli3 commented 6 months ago

Yeah good idea just a Mac deploy package for site without it.

This can be done as a pre-pass to the mega xcframework or by removing sub directories of the xcframework when packaging releases and modifying the json file automatically.

I'll see which one is more optimal, will design with this in mind

ofTheo commented 6 months ago

Awesome - sounds good @danoli3

Probably the simplest would be to just do it as part of the apothecary releases packaging.
So there is always a macOS lite and macOS(iOS, etc) full zip on the releases page.

Then the main OF packaging scripts just pulls one of those two zips

danoli3 commented 5 months ago

Will squish all bleeding changes of late testing getting this actions artefacts / fixes and reset bleeding to squish

danoli3 commented 5 months ago
Screenshot 2024-03-13 at 7 57 09 pm

Okay this is looking sweet!

So finally upload size is 345mb! for all platforms!!! Wicked! This once uncompressed is 1.2gb on disk.

danoli3 commented 5 months ago

Completed!

Some more changes to include headers with every library will be added in next PR to allow no includes in configs required