-
Notifications
You must be signed in to change notification settings - Fork 993
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
Feature: set CMAKE_SYSTEM_PROCESSOR #8026
Conversation
144137f
to
ef1fd34
Compare
Some extra data points. I did some tests on Visual Studio 2019 using a little cmake script:
The following command was executed:
|
Thanks @madebr for the hints! @SSE4 I think that for moving this forward we need to:
Windows
Linux: |
For arm support of my mpg123 cci recipe, As long as |
Signed-off-by: SSE4 <tomskside@gmail.com>
ef1fd34
to
f17f2a6
Compare
@memsharded updated:
testing on real recipes and cross-building on real platforms is welcomed |
|
||
@staticmethod | ||
def _cmake_system_processor(os_, arch): | ||
if os_ in ["Windows", "WindowsStore", "WindowsCE"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these names are valid for Visual Studio, not for Windows systems.
mingw expects the gnu names instead of Microsoft tainted ones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you have a reference? the doc says:
On Windows, this variable is set to the value of the environment variable PROCESSOR_ARCHITECTURE
it doesn't mention compilers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no other reference.
But the cmake documentation mentions GNU, and mingw is a GNU compiler.
Otoh, I searched for CMAKE_SYSTEM_PROCESSOR arm
and CMAKE_SYSTEM_PROCESSOR aarch
on github and it looks like there is no universal standard.
I think we have to face the reality that there is no universally-agreed-to-standard to use as CMAKE_SYSTEM_PROCESSOR
variable.
Like everything in the c/c++ world (except for the stl standaard), there is no standard. CMake allows everything. CMAKE_SYSTEM_PROCESSOR is just a hint.
In reality, some project will either use one kind CMAKE_SYSTEM_PROCESSOR
mapping from processor to cmake variable and not switch between a Microsoft convention or GNU convention. Or will not switch between Windows convention or Linux convention.
It's like the arch
argument of MsBuild.build
: there will always be a project having a different mapping (uppercase/lowercase/64 suffix).
Making this variable too hidden will make it harder for people wanting to modify it.
I'm just saying it would be nice to have an api that allows this:
self._cmake.cmake_host_processor = tools.cmake_host_processor(self.settings.arch, "gnu").tolower()
So people can hook it.
Cci recipe writers will thank you.
And conan providing a proper default: the Microsoft one if MSVC else GNU.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I think it's correct. CMake itself doesn't care much about CMAKE_SYSTEM_PROCESSOR
and lists it as optional.
the main source of headache is libraries checking for CMAKE_SYSTEM_PROCESSOR
, for instance, to include proper assembler sources, such as libjpeg-turbo case.
although CMake specifies CMAKE_SYSTEM_PROCESSOR
to have values either of uname
or PROCESSOR_ARCHITECTURE
, I've seen in reality libraries checking for different values, e.g. for armv8
they may check for armv8
, arm64
and aarch64
.
examples:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On 1.33.0 we needed this patch to make the libjpeg-turbo cross compile for "ARM64/aarch64/armv8 etc." (not saying its not libjpeg turbos fault)
Looking at this, I think it's fine to set these variables, when cross building. |
I tested in linux x86_64 targeting armv8 and the fix works for me. |
|
Closing this PR as outdated, it was targeting the legacy integrations, not the new CMakeToolchain |
@KristianJerpetjon could you test this POC for your case, especially for libpng, libjpeg-turbo and others?
closes: #8025
Changelog: Feature: set CMAKE_SYSTEM_PROCESSOR
Docs: https://github.com/conan-io/docs/pull/XXXX
develop
branch, documenting this one.Note: By default this PR will skip the slower tests and will use a limited set of python versions. Check here how to increase the testing level by writing some tags in the current PR body text.