build: Make swift-crypto build on Windows (#385)

Make swift-crypto build on Windows

- [X] I've run tests to see all new and existing tests pass
- [X] I've followed the code style of the rest of the project
- [X] I've read the [Contribution Guidelines](CONTRIBUTING.md)
- [X] I've updated the documentation if necessary

- [N/A] I've run `.script/generate_boilerplate_files_with_gyb` and
included updated generated files in a commit of this pull request

Currently, swift-crypto on the main branch does not build on Windows.

* Add the Windows Arm64 assembly files to the CMake build.
* Add appropriate CMake options for swift-crypto to build on Windows.

swift-crypto can be built on Windows from main

Fixes #369

---------

Co-authored-by: Cory Benfield <lukasa@apple.com>

(cherry picked from commit 993467897d)
(#370)

Co-authored-by: Fabrice de Gans <Steelskin@users.noreply.github.com>
This commit is contained in:
Evan WildeandFabrice de Gans authored and GitHub committed 2025-07-22 19:41:47 +01:00
1 parent 785709bdaf
commit ebcbfc61ba
2 files changed
+37

No files matched your search

+21
View File
@@ -334,6 +334,27 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|Android|FreeBSD" AND CMAKE_SYSTEM_PROCES
gen/bcm/vpaes-armv8-linux.S
gen/crypto/chacha-armv8-linux.S
gen/crypto/chacha20_poly1305_armv8-linux.S)
elseif(CMAKE_SYSTEM_NAME MATCHES "Windows" AND CMAKE_SYSTEM_PROCESSOR MATCHES "AMD64|amd64|x86_64")
target_sources(CCryptoBoringSSL PRIVATE
)
elseif(CMAKE_SYSTEM_NAME MATCHES "Windows" AND CMAKE_SYSTEM_PROCESSOR MATCHES "ARM64|arm64|aarch64")
target_sources(CCryptoBoringSSL PRIVATE
gen/bcm/aesv8-armv8-win.S
gen/bcm/aesv8-gcm-armv8-win.S
gen/bcm/armv8-mont-win.S
gen/bcm/bn-armv8-win.S
gen/bcm/ghash-neon-armv8-win.S
gen/bcm/ghashv8-armv8-win.S
gen/bcm/p256-armv8-asm-win.S
gen/bcm/p256_beeu-armv8-asm-win.S
gen/bcm/sha1-armv8-win.S
gen/bcm/sha256-armv8-win.S
gen/bcm/sha512-armv8-win.S
gen/bcm/vpaes-armv8-win.S
gen/crypto/chacha-armv8-win.S
gen/crypto/chacha20_poly1305_armv8-win.S)
else()
message(FATAL_ERROR "platform sources are not defined here for ${CMAKE_SYSTEM_NAME} on ${CMAKE_SYSTEM_PROCESSOR}")
endif()
target_include_directories(CCryptoBoringSSL PUBLIC