-
Notifications
You must be signed in to change notification settings - Fork 128
Detect NEON support more reliably in environment.cmake
#136
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
base: master
Are you sure you want to change the base?
Conversation
Running tests. |
Will this work when cross-compiling? |
@louwers Reading the documentation you referenced, I see...
I don't think that folks run cmake builds on iOS typically. When you write 'We are building for iOS', I take it that you are cross-compiling. Can you share your CMAKE_TOOLCHAIN_FILE? |
@lemire This came up building iOS/arm64 from MacOS/arm64, but I don't think we specify that value. These are the platform-related values I get:
|
Building for iOS on modern hardware does not require cross-compiling. |
So you are building directly under iOS? You are running cmake on the iOS system? Do you have a reference for how this is done? I have never heard of cmake running under iOS although I suppose that's possible. I have built software for iOS and I did it from macOS. Is this not your case? If you are building under macOS (e.g., with Xcode) for iOS using cmake, then you are cross-compiling. And you need a toolchain file. I understand that you have not set CMAKE_SYSTEM_PROCESSOR. But I submit to you that it might be a mistake. My belief is that when cross-compiling, one should do something like this...
And the toolchain file should contain the relevant information such as...
... among others... It may work if you omit the |
Sorry for the confusion, yes we develop on macOS for iOS. In this case both platforms are ARM64, is that cross-compiling? We're setting CMAKE_SYSTEM_NAME directly. |
Cross-compiling is the process of compiling code on one platform (the host) to generate executable code for a different platform (the target). The host and the target can different in different ways: processor architecture, operating system, and so forth. A typical cross-compiling scenario is when you are using a PC or a mac to build code for a mobile or embedded device. In this instance, macOS and iOS are different operating systems, even if the processor architecture is the same. Thus I recommend you build a toolchain file. It should resolve the issue you have encountered and make your build more robust in general. I recommend checking in your toolchain file in your version control system. |
Seems like there is a good toolchain file available for iOS. https://github.com/leetal/ios-cmake/blob/2d171c3585082c9be0c5311fa3930b7fe7c479e2/ios.toolchain.cmake#L846 I will look into it, would be convenient if we could merge this though. I think it's a good solution. |
I am concerned that this PR only masks the real issue. |
OK that is fair enough, @TimSylvester and I can add a proper toolchain file to our project. 👍 |
We are building for iOS and
CMAKE_GENERATOR_PLATFORM
is an empty string. So we ran into an issue thatSUPPORT_NEON
was not set correctly. The CMake documentation also mentions:This is the solution DeepSeek came up with to more reliably detect NEON support. It looks legit? Seems to work as well.