-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
M1 support #1620
M1 support #1620
Conversation
CMake has basic framework generation support: https://cmake.org/cmake/help/v3.5/prop_tgt/FRAMEWORK.html#prop_tgt:FRAMEWORK. But I'm not sure, whether it could be useful for multi-arch builds. |
That's not our option for tdlib unfortunately, we still unable to link and pack it in one framework. Here's note in CMake Gitlab thread which suggests to move on xcframeworks as well. |
I assume that I've reached this PR goal. This PR does not optimize arm code, library packaging, linking, headers and so on. |
Currently, with this patch applied we have problems with ordinary build on macOS without the example usage, because brew-installed OpenSSL supports only one architecture. |
Probably, CMAKE_OSX_ARCHITECTURES shouldn't be changed in the main CMakeLists.txt, only passed in build.sh as another argument to cmake on "macOS" platform. |
Moved @levlam Upon accepting this MR, add docs to main readme please. |
P.S. I've faced same issue in short investigation with brew-installed openssl. Will dive a bit more deeply. |
Universal pre-built OpenSSL binary installation can be achieved with MacPorts sudo port install openssl
...
---> Attempting to fetch openssl-1.1.1k_0.darwin_20.x86_64.tbz2 from https://packages.macports.org/openssl
file /opt/local/bin/openssl
/opt/local/bin/openssl: Mach-O 64-bit executable x86_64 using sudo port install openssl
...
---> Attempting to fetch openssl-1.1.1k_0+universal.darwin_20.arm64-x86_64.tbz2 from https://packages.macports.org/openssl
file /opt/local/bin/openssl
/opt/local/bin/openssl: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64:Mach-O 64-bit executable arm64]
/opt/local/bin/openssl (for architecture x86_64): Mach-O 64-bit executable x86_64
/opt/local/bin/openssl (for architecture arm64): Mach-O 64-bit executable arm64 Make sure to install OpenSSL P.S. I also prefer |
Thanks @Kylmakalle for these awesome changes! Sorry that merging this took so long. |
Adapted Changes in tdlib tdlib/td#1620
@levlam Would you mind adding this page and changing this to Swiftgram in README, since this wrapper is not updated anymore. It could have saved me about 2 hours if I knew it was there. I had to manually find it through issues. Thank you! @Kylmakalle Thanks for the update! I was able to build the TDLib with your instructions on M1. Is there any difference between using your wrapper for M1 and using the TDLib? |
@sapoepsilon TDLibKit is a Swift wrapper with pre-generated classes, types and a little "sugar". TDLibFramework is just a pre-built fat xcframework binary. Both now based on recent TDLib commits with M1 support as well. More info in each project READMEs. |
@sapoepsilon This is a merged pull request, so all changes are present in the master branch. Swiftgram/TDLibKit has just been added to the list of examples as you suggested. |
While tdlib can be built for arm64 devices, it still lacks support of arm64 simulators and macOS targets. That means we're required to use
EXCLUDED_ARCHS = arm64
in XCode development and even use Apple Rosetta on M1 macs which makes some people struggle (#1555, tdlight-team/tdlight-java#28) building tdlib.This PR introduces arm64 support for macOS & simulator targets
lipo
can't merge multiple platforms with same arch).Results in DOUBLED time to build openSSL for non macOS platforms 😞
Any optimizations possible only for OpenSSL 1.1.1 which is another TODO
iOS.cmake
destinations for simulatorsbuild.sh
for cmake macOS targetsdylib
's to .xcframework-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"
for macOS build in main readme.md(Optional) Provide test project that will cover initial framework implementation