@@ -37,6 +37,10 @@ set(BORINGSSL_ROOT ../third_party/boringssl/)
37
37
# - crypto_sources_linux_ppc64le
38
38
# - crypto_sources_linux_x86
39
39
# - crypto_sources_linux_x86_64
40
+ # - crypto_sources_mac_x86
41
+ # - crypto_sources_mac_x86_64
42
+ # - crypto_sources_win_x86
43
+ # - crypto_sources_win_x86_64
40
44
include (
41
45
../third_party/boringssl/sources .cmake
42
46
)
@@ -47,40 +51,49 @@ add_definitions(-DOPENSSL_SMALL)
47
51
48
52
# Logic from CMakeLists.txt in BoringSSL
49
53
if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64" )
50
- set (crypto_sources_ARCH ${crypto_sources_linux_x86_64} )
54
+ set (ARCH "x86_64" )
51
55
elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "amd64" )
52
- set (crypto_sources_ARCH ${crypto_sources_linux_x86_64} )
56
+ set (ARCH "x86_64" )
53
57
elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64" )
54
- # cmake reports AMD64 on Windows, but we might be building for 32-bit.
55
58
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
56
- set (crypto_sources_ARCH ${crypto_sources_linux_x86_64} )
59
+ set (ARCH "x86_64" )
57
60
else ()
58
- set (crypto_sources_ARCH ${crypto_sources_linux_x86} )
61
+ set (ARCH "x86" )
59
62
endif ()
60
63
elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86" )
61
- set (crypto_sources_ARCH ${crypto_sources_linux_x86} )
64
+ set (ARCH "x86" )
62
65
elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i386" )
63
- set (crypto_sources_ARCH ${crypto_sources_linux_x86} )
66
+ set (ARCH "x86" )
64
67
elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i686" )
65
- set (crypto_sources_ARCH ${crypto_sources_linux_x86} )
68
+ set (ARCH "x86" )
66
69
elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64" )
67
- set (crypto_sources_ARCH ${crypto_sources_linux_aarch64} )
70
+ set (ARCH "aarch64" )
68
71
elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm64" )
69
- set (crypto_sources_ARCH ${crypto_sources_linux_aarch64} )
70
- # Apple A12 Bionic chipset which is added in iPhone XS/XS Max/XR uses arm64e architecture.
72
+ set (ARCH "aarch64" )
71
73
elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm64e" )
72
- set (crypto_sources_ARCH ${crypto_sources_linux_aarch64} )
74
+ set (ARCH "aarch64" )
73
75
elseif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "^arm*" )
74
- set (crypto_sources_ARCH ${crypto_sources_linux_arm} )
75
- elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "mips" )
76
- # Just to avoid the “unknown processor” error.
77
- set (crypto_sources_ARCH ${crypto_sources_linux_generic} )
76
+ set (ARCH "arm" )
78
77
elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "ppc64le" )
79
- set (crypto_sources_ARCH ${crypto_sources_linux_ppc64le} )
78
+ set (ARCH "ppc64le" )
80
79
else ()
81
- # If we can't match an architecture, we just disable assembler optimizations
82
- set (crypto_sources_ARCH)
80
+ set (ARCH "generic" )
81
+ endif ()
82
+
83
+ # https://cmake.org/cmake/help/latest/variable/CMAKE_SYSTEM_NAME.html
84
+ if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows" )
85
+ set (PLATFORM "win" )
86
+ elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" )
87
+ set (PLATFORM "mac" )
88
+ else ()
89
+ # Assume we're on linux or similar platform
90
+ set (PLATFORM "linux" )
91
+ endif ()
92
+
93
+ # If there is no assembly files disable ASM and set empty sources list
94
+ if (NOT DEFINED crypto_sources_${PLATFORM} _${ARCH} )
83
95
add_definitions (-DOPENSSL_NO_ASM)
96
+ set (crypto_sources_${PLATFORM} _${ARCH} )
84
97
endif ()
85
98
86
99
add_library (
@@ -93,7 +106,7 @@ add_library(
93
106
../src/webcrypto.c
94
107
../src/symbols.generated .c
95
108
${crypto_sources}
96
- ${crypto_sources_ARCH }
109
+ ${crypto_sources_ ${PLATFORM} _ ${ARCH} }
97
110
)
98
111
99
112
target_include_directories (
0 commit comments