PowerShell / PowerShell-Native

MIT License
50 stars 33 forks source link

Enable building universal (x64,arm64) binaries for MacOS #64

Closed SteveL-MSFT closed 3 years ago

SteveL-MSFT commented 3 years ago

Created cmakefile specifying both x64 and arm64 architectures. Tested locally on M1 MacBookPro using file to verify the resulting dylib is universal.

PS> file /Users/steve/repos/PowerShell-Native/src/powershell-unix/libpsl-native.dylib
/Users/steve/repos/PowerShell-Native/src/powershell-unix/libpsl-native.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [arm64:Mach-O 64-bit dynamically linked shared library arm64]
/Users/steve/repos/PowerShell-Native/src/powershell-unix/libpsl-native.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
/Users/steve/repos/PowerShell-Native/src/powershell-unix/libpsl-native.dylib (for architecture arm64):  Mach-O 64-bit dynamically linked shared library arm64

Needed to switch to vmimage for MacOS 10.15+ which has XCode12 to support building universal binary for M1 and x64.

adityapatwardhan commented 3 years ago

@SteveL-MSFT - can you verify that the release build succeeds?

SteveL-MSFT commented 3 years ago

@adityapatwardhan verified release build succeeds and library is universal