Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 9, 2021

Conversation

SteveL-MSFT
Copy link
Member

@SteveL-MSFT SteveL-MSFT commented Feb 28, 2021

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.

Copy link
Contributor

@PaulHigin PaulHigin left a comment

Choose a reason for hiding this comment

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

LGTM

@adityapatwardhan adityapatwardhan changed the title enable building universal (x64,arm64) binaries for MacOS Enable building universal (x64,arm64) binaries for MacOS Mar 8, 2021
@adityapatwardhan
Copy link
Member

adityapatwardhan commented Mar 8, 2021

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

@SteveL-MSFT
Copy link
Member Author

@adityapatwardhan verified release build succeeds and library is universal

@adityapatwardhan adityapatwardhan merged commit 2ad0b58 into PowerShell:master Mar 9, 2021
@SteveL-MSFT SteveL-MSFT deleted the build-m1 branch March 10, 2021 22:51
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.

4 participants