Halide icon indicating copy to clipboard operation
Halide copied to clipboard

RFC: Output universal binary when CMAKE_OSX_ARCHITECTURES is defined.

Open popizdeh opened this issue 4 years ago • 7 comments

@alexreinking this is to start the conversation about supporting universal binaries. This patch allowed me to build Halide as a universal library and to generate filters as universal libraries from CMake.

I'm only vaguely familiar with CMake so please excuse my code :)

There's probably a better way to do this, I saw the is_crosscompiling argument but I also read somewhere that arguments to target= need to be the same architecture. I'm not sure where this requirement is coming from but this is the main reason I went with the approach of generating per architecture and fusing them together.

Basic idea is pretty simple, CMAKE_OSX_ARCHITECTURES is usually set to "arm64,x86_64" when compiling for Big Sur. Generator is invoked once per architecture and two object files are then merged into a fat file. Separate command is used to generate all the other outputs like header file, registration file, etc. Same thing is done for runtime library.

popizdeh avatar Aug 09 '21 08:08 popizdeh

I need access to an M1 Mac to test this. @steven-johnson - can I use the buildbot for a while?

alexreinking avatar Aug 16 '21 01:08 alexreinking

I need access to an M1 Mac to test this. @steven-johnson - can I use the buildbot for a while?

OK with me, but @abadams is the one to check with

steven-johnson avatar Aug 16 '21 15:08 steven-johnson

@abadams - cool to use the M1 mac for a while? Maybe over the weekend?

alexreinking avatar Aug 19 '21 21:08 alexreinking

Yeah, sure.

abadams avatar Aug 19 '21 22:08 abadams

Any updates on this PR?

steven-johnson avatar Oct 04 '21 19:10 steven-johnson

Is this PR still active? Should it be closed?

steven-johnson avatar Nov 15 '21 19:11 steven-johnson

I haven't found a time to sit down with an Apple Silicon machine to myself and test this yet. But I would like to!

alexreinking avatar Nov 15 '21 19:11 alexreinking