diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 1c41e2866..769a95ace 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -20,7 +20,7 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-2025, windows-2022] + os: [windows-2025, windows-2022, windows-11-arm] runs-on: ${{ matrix.os }} steps: - name: Install dependencies @@ -41,4 +41,6 @@ jobs: # CB_CMAKE_BUILD_TYPE: Release CB_CMAKE_BUILD_TYPE: RelWithDebInfo CB_NUMBER_OF_JOBS: 2 + # No OpenSSL ASM exists for Window-11=arm. + CB_OPENSSL_NO_ASM: ${{ matrix.os == 'windows-11-arm' && '1' || '' }} run: ruby ./bin/build-tests.rb diff --git a/CMakeLists.txt b/CMakeLists.txt index 28535d653..95c7ac790 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,12 @@ if(WIN32) message(STATUS "Windows SDK: ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") endif() +# This disables Microsoft’s C++ overloads for _Interlocked* and fixes the ARM64 build. +if (WIN32 AND CMAKE_SIZEOF_VOID_P EQUAL 8 AND CMAKE_SYSTEM_PROCESSOR MATCHES "ARM64") + message(STATUS "Applying WinBase Interlocked macro for Windows ARM64") + add_compile_definitions(MICROSOFT_WINDOWS_WINBASE_H_DEFINE_INTERLOCKED_CPLUSPLUS_OVERLOADS=0) +endif() + include(cmake/TarballRelease.cmake OPTIONAL) include(cmake/PreventInSourceBuilds.cmake) diff --git a/bin/build-tests.rb b/bin/build-tests.rb index 4224aef92..6fc5260cb 100755 --- a/bin/build-tests.rb +++ b/bin/build-tests.rb @@ -88,6 +88,11 @@ def run(*args) CB_CMAKE_EXTRAS << "-DENABLE_SANITIZER_MEMORY=ON" end +# No OpenSSLASM exists for Window ARM64 +if ENV["CB_OPENSSL_NO_ASM"] == "1" + CB_CMAKE_EXTRAS << "-DOPENSSL_NO_ASM=1" +end + BUILD_DIR = if CB_SANITIZER.empty? File.join(PROJECT_ROOT, "cmake-build-tests") else diff --git a/core/platform/random.cc b/core/platform/random.cc index d3bf40215..9f27cb019 100644 --- a/core/platform/random.cc +++ b/core/platform/random.cc @@ -25,7 +25,7 @@ #include #include -#ifdef WIN32 +#ifdef _WIN32 // We need to include windows.h _before_ wincrypt.h #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN