Test and build wheels for Windows ARM

This commit is contained in:
Helder Eijs 2025-04-27 09:40:37 +02:00
parent 64506f73e9
commit 876573ec60
3 changed files with 31 additions and 13 deletions

View file

@ -20,6 +20,12 @@ jobs:
- python-version: "3.13" - python-version: "3.13"
cffi: yes cffi: yes
os: windows-latest os: windows-latest
- python-version: "3.13"
cffi: no
os: windows-11-arm
- python-version: "3.13"
cffi: yes
os: windows-11-arm
- python-version: pypy2.7 - python-version: pypy2.7
cffi: no cffi: no
os: ubuntu-latest os: ubuntu-latest
@ -123,6 +129,7 @@ jobs:
else else
python -m Crypto.SelfTest python -m Crypto.SelfTest
fi fi
mypy: mypy:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -160,12 +167,16 @@ jobs:
make -C build all test make -C build all test
test_c_windows: test_c_windows:
runs-on: windows-latest runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
arch: include:
- x64 - os: windows-latest
- win32 arch: x64
- os: windows-latest
arch: win32
- os: windows-11-arm
arch: arm64
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Set up Python "3.13" - name: Set up Python "3.13"

View file

@ -32,7 +32,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
os: [ubuntu-22.04, windows-2019, macos-13, ubuntu-22.04-arm] os: [ubuntu-22.04, windows-2019, macos-13, ubuntu-22.04-arm, windows-11-arm]
if: github.actor == 'Legrandin' if: github.actor == 'Legrandin'

View file

@ -3,14 +3,14 @@ project(test_crypto LANGUAGES C)
include(CMakePrintHelpers) include(CMakePrintHelpers)
enable_testing() enable_testing()
cmake_print_variables(CMAKE_CXX_COMPILER_ID CMAKE_CXX_COMPILER_VERSION CMAKE_SIZEOF_VOID_P CMAKE_SYSTEM_PROCESSOR SSE) cmake_print_variables(CMAKE_CXX_COMPILER_ID CMAKE_CXX_COMPILER_VERSION CMAKE_SIZEOF_VOID_P SSE CMAKE_C_COMPILER_ARCHITECTURE_ID)
# https://stackoverflow.com/questions/70475665/what-are-the-possible-values-of-cmake-system-processor if (CMAKE_C_COMPILER_ARCHITECTURE_ID MATCHES "x86_64|AMD64|i686|X86|x64")
if (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64|i686")
set(X86 TRUE) set(X86 TRUE)
endif() endif()
if (X86) if (X86)
message(STATUS "Enabling SSE and AESNI")
option(SSE "Enable SSE instructions on Intel targets" ON) option(SSE "Enable SSE instructions on Intel targets" ON)
option(AESNI "Enable AESNI instructions on Intel targets" ON) option(AESNI "Enable AESNI instructions on Intel targets" ON)
endif() endif()
@ -22,6 +22,7 @@ else()
endif() endif()
include_directories("${CMAKE_SOURCE_DIR}/..") include_directories("${CMAKE_SOURCE_DIR}/..")
INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
# Disable any code related to CPython modules # Disable any code related to CPython modules
# This is only required for MSVC, and it avoids a dependency on the CPython libraries # This is only required for MSVC, and it avoids a dependency on the CPython libraries
@ -33,12 +34,16 @@ add_compile_definitions(STATIC=)
# TODO: add check for big endianess too # TODO: add check for big endianess too
add_compile_definitions(PYCRYPTO_LITTLE_ENDIAN) add_compile_definitions(PYCRYPTO_LITTLE_ENDIAN)
CHECK_INCLUDE_FILE("stdint.h" CMAKE_HAVE_STDINT_H)
if (CMAKE_HAVE_STDINT_H)
add_compile_definitions(HAVE_STDINT_H)
endif()
if (MSVC) if (MSVC)
add_compile_options(/Wall /sdl) add_compile_options(/Wall /sdl)
# Disable certain warnings # Disable certain warnings
add_compile_options(/wd4100 /wd4820 /wd5045) add_compile_options(/wd4100 /wd4820 /wd5045)
else() else()
add_compile_definitions(HAVE_STDINT_H)
add_compile_definitions(HAVE_POSIX_MEMALIGN) add_compile_definitions(HAVE_POSIX_MEMALIGN)
add_compile_options(-O2 -g -fstrict-aliasing -Wall -Werror) add_compile_options(-O2 -g -fstrict-aliasing -Wall -Werror)
if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
@ -65,10 +70,12 @@ else()
endif() endif()
if (MSVC) if (MSVC)
add_compile_definitions(HAVE_INTRIN_H) if (SSE)
add_compile_definitions(USE_SSE2) add_compile_definitions(HAVE_INTRIN_H)
add_compile_definitions(HAVE_WMMINTRIN_H) add_compile_definitions(USE_SSE2)
add_compile_definitions(HAVE_TMMINTRIN_H) add_compile_definitions(HAVE_WMMINTRIN_H)
add_compile_definitions(HAVE_TMMINTRIN_H)
endif()
else() else()
if (SSE) if (SSE)
message(STATUS "Using SSE instructions") message(STATUS "Using SSE instructions")