Yak Mac Intel and Mac M chip distribution


I am distributing OpenNest via Yak.

The c++ code needs to be built on a) intel chip computer, b) m chip computer. How can I distribute libraries for mac with different architectures like that via yak? What key tag I need to use?

For now I used mac and win tags. But now I see there is are sub-mac tags needed…

Instead of distributing different libraries you should look into creating universal build of your libraries, that is create a .dylib that contains both the arm64 and x86_64 architectures.

For instance the C/C++ dylib for the Cycles integration inspected with the command file gives this information on the command-line:

╭─jesterking [100%] at jesterM2 in ~/dev/lbp/rhino8/big_libs/RhinoCycles/ccycles/osx/release on rhino-8.x✔ 24-06-11 - 19:37:44
╰─⠠⠵ file libccycles.dylib                                                                                                   on rhino-8.x|✔
libccycles.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [arm64]
libccycles.dylib (for architecture x86_64):	Mach-O 64-bit dynamically linked shared library x86_64
libccycles.dylib (for architecture arm64):	Mach-O 64-bit dynamically linked shared library arm64

This one library works on both Intel and Apple silicon Macs. My RhinoCycles plug-in consumes this single library.

Of course any and all unmanaged dependencies need to be also universal libraries with both architectures in.

You can do that either with your build tools, or manually after building using otool. If you use CMake to do the building you can define -DCMAKE_OSX_ARCHITECTURES=arm64;x86_64 on the command-ine to cmake.

1 Like

Thank you:) I only have header only libraries, it should work. I will try with the cmake tag.

What tool do you use to inspect the dylib files?

1 Like

I use otool and file, and indeed lipo from the guide linked by @dale. otool for checking structure etc, lipo to mash together two different architectures manually.