[cmake] Fix win x64 and arm64 detection in cmake#675
Merged
opdenkamp merged 2 commits intoPulse-Eight:masterfrom Mar 5, 2025
Merged
[cmake] Fix win x64 and arm64 detection in cmake#675opdenkamp merged 2 commits intoPulse-Eight:masterfrom
opdenkamp merged 2 commits intoPulse-Eight:masterfrom
Conversation
added 2 commits
March 1, 2025 17:22
Windows SDK's dont look like they have _X64_ defined in Windows.h. I checked back until win 7 sdk's. They all do have _AMD64_ that says it is x86_64. Remove the unnecessary symbol check for _X64_ and rename the output of _AMD64_ to WIN64. Kodi was patching _USE_32BIT_TIME_T to avoid the following errors when building for x86_64. Time to properly fix the root cause 14:06:19 C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt.h(634,1): error C1189: #error: You cannot use 32-bit time_t (_USE_32BIT_TIME_T) with _WIN64 [C:\jenkws\workspace\WIN-64\kodi-build.x64\build\cec\src\cec-build\src\libcec\cec.vcxproj] [C:\jenkws\workspace\WIN-64\kodi-build.x64\cec.vcxproj] 14:06:19 (compiling source file '../../../cec/src/libcec/CECProcessor.cpp') 14:06:19 14:06:19 C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt.h(634,1): error C1189: #error: You cannot use 32-bit time_t (_USE_32BIT_TIME_T) with _WIN64 [C:\jenkws\workspace\WIN-64\kodi-build.x64\build\cec\src\cec-build\src\libcec\cec.vcxproj] [C:\jenkws\workspace\WIN-64\kodi-build.x64\cec.vcxproj] 14:06:19 (compiling source file '../../../cec/src/libcec/CECClient.cpp')
_M_ARM64 is a compile definition used by VS. Its not known to cmake, therefore it isnt suitable to be used as a check. Use a check_symbol_exists just like x86_64 and use an ARM64 variable to appropriately define arm64 platform in cmake
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Kodi has been patching the use of _USE_32BIT_TIME_T for long before i started getting involved in the project.
As im wanting to reduce the patching we do, i wanted to work out what the root cause of the following errors we get when building libcec for x86_64
The root cause is check_symbol_exists for the symbol X64 is not valid (since at least win7 sdk as far as i could tell) in Windows.h. Checks libcec use then rely on WIN64 being set, but it is not.
Change to use AMD64, that is used to define an x86_64 symbol in Windows.h for the WIN64 variable, and then dont use the value of it for the tests.
the ARM64 changes recently also dont work correctly in cmake.
_M_ARM64 is a compile definition that VS sets/uses for arm64 platform, however this does not mean anything to cmake, and therefore is always false.
Introduce a check_symbol_exists call for ARM64 for it to be used to properly show libcec is building for arm64 target.
cec-client and cecc-client dont explicitly use CheckPlatformSupport.cmake, so ive added their check_symbol_exists explicitly.