abdes/cryptopp-cmake

Windows ARM detection

Closed this issue · 3 comments

GIGte commented

Since CMake now suggests setting the Visual Studio generator without a target architecture, this line turns to be incorrect:

if(${CMAKE_GENERATOR} MATCHES ".*ARM")

abdes commented

How do you suggest we detect ARM build on Windows with Visual Studio? @GIGte

GIGte commented

This should do:

if(MSVC_CXX_ARCHITECTURE_ID MATCHES "ARM")

Or it is possible to use the dump machine output:

if(NOT (CRYPTOPP_I386 OR CRYPTOPP_AMD64 OR CRYPTOPP_MINGW32 OR CRYPTOPP_MINGW64))

Note: using x86/x64 variables, because it seems that ARM is not detected.

I think checking x86/x64 is even better.

abdes commented

The ASM source code is written specifically for MASM, which basically means it won't work with the ARM assemblers (I tried it, cause I wanted to see if I can enable this by customizing the assembler for cmake on ARM), but it will work as long as the compiler is MSVC/MASM and the platform is not ARM64 or ARM. Therefore, I would rather stick with a test that checks for MSVC and eliminates ARM as the generator platform.

I would however go with something a bit more top-level for the ARM check, like:

if(CMAKE_GENERATOR_PLATFORM MATCHES "ARM")

The CMAKE_GENERATOR_PLATFORM comes from the command line option -A that must be passed to cmake to set the target architecture (ARM or ARM64).

Thanks a lot for your suggestions.