@@ -37,46 +37,46 @@ if(NOT SwiftCore_ARCH_SUBDIR)
3737 message (CONFIGURE_LOG "Swift Arch: ${arch} " )
3838endif ()
3939
40- if (APPLE )
40+ # Note: *moduleTriple* doesn't have an "x" on the end of "macos"; just to be
41+ # safe, we support both cases here.
42+ set (availability_platform_macos "macOS" )
43+ set (availaiblity_platform_macosx "macOS" )
44+ set (availability_platform_ios "iOS" )
45+ set (availability_platform_watchos "watchOS" )
46+ set (availability_platform_tvos "tvOS" )
47+ set (availability_platform_xros "visionOS" )
48+ set (availability_platform_bridgeos "bridgeOS" )
4149
42- # Note: *moduleTriple* doesn't have an "x" on the end of "macos"; just to be
43- # safe, we support both cases here.
44- set (availability_platform_macos "macOS" )
45- set (availaiblity_platform_macosx "macOS" )
46- set (availability_platform_ios "iOS" )
47- set (availability_platform_watchos "watchOS" )
48- set (availability_platform_tvos "tvOS" )
49- set (availability_platform_xros "visionOS" )
50- set (availability_platform_bridgeos "bridgeOS" )
51-
52- if (NOT SwiftCore_SWIFT_AVAILABILITY_PLATFORM)
53- if (SwiftCore_MODULE_TRIPLE MATCHES ".*-([^-]+)-simulator$" )
54- set (platform "${CMAKE_MATCH_1} " )
55- elseif (SwiftCore_MODULE_TRIPLE MATCHES ".*-([^-]+)$" )
56- set (platform "${CMAKE_MATCH_1} " )
57- else ()
58- message (FATAL_ERROR "Unable to extract platform name from triple ${SwiftCore_MODULE_TRIPLE} " )
59- endif ()
60-
61- if (availability_platform_${platform} )
62- set (SwiftCore_SWIFT_AVAILABILITY_PLATFORM "${availability_platform_${platform} }" )
63- else ()
64- message (FATAL_ERROR "Unknown platform ${platform} for availability" )
65- endif ()
50+ if (NOT SwiftCore_SWIFT_AVAILABILITY_PLATFORM)
51+ if (SwiftCore_MODULE_TRIPLE MATCHES ".*-([^-]+)-simulator$" )
52+ set (platform "${CMAKE_MATCH_1} " )
53+ elseif (SwiftCore_MODULE_TRIPLE MATCHES ".*-([^-]+)-msvc$" )
54+ set (platform "${CMAKE_MATCH_1} " )
55+ elseif (SwiftCore_MODULE_TRIPLE MATCHES ".*-([^-]+)$" )
56+ set (platform "${CMAKE_MATCH_1} " )
57+ else ()
58+ message (WARNING "Unable to extract platform name from triple ${SwiftCore_MODULE_TRIPLE} " )
6659 endif ()
6760
68- if (SwiftCore_VARIANT_MODULE_TRIPLE)
69- if (SwiftCore_VARIANT_MODULE_TRIPLE MATCHES ".*-([^-]+)$" )
70- set (platform "${CMAKE_MATCH_1} " )
71- else ()
72- message (FATAL_ERROR "Unable to extract platform name from triple ${SwiftCore_VARIANT_MODULE_TRIPLE} " )
73- endif ()
61+ if (availability_platform_${platform} )
62+ set (SwiftCore_SWIFT_AVAILABILITY_PLATFORM "${availability_platform_${platform} }" )
63+ else ()
64+ set (SwiftCore_SWIFT_AVAILABILITY_PLATFORM "unknown" )
65+ message (WARNING "Unknown platform ${platform} for availability" )
66+ endif ()
67+ endif ()
7468
75- if (availability_platform_${platform} )
76- set (SwiftCore_VARIANT_AVAILABILITY_PLATFORM "${availability_platform_${platform} }" )
77- else ()
78- message (FATAL_ERROR "Unknown platform ${platform} for variant availability" )
79- endif ()
69+ set (SwiftCore_VARIANT_AVAILABILITY_PLATFORM "none" )
70+ if (SwiftCore_VARIANT_MODULE_TRIPLE)
71+ if (SwiftCore_VARIANT_MODULE_TRIPLE MATCHES ".*-([^-]+)$" )
72+ set (platform "${CMAKE_MATCH_1} " )
73+ else ()
74+ message (FATAL_ERROR "Unable to extract platform name from triple ${SwiftCore_VARIANT_MODULE_TRIPLE} " )
8075 endif ()
8176
82- endif (APPLE )
77+ if (availability_platform_${platform} )
78+ set (SwiftCore_VARIANT_AVAILABILITY_PLATFORM "${availability_platform_${platform} }" )
79+ else ()
80+ message (WARNING "Unknown platform ${platform} for variant availability" )
81+ endif ()
82+ endif ()
0 commit comments