Skip to content

Commit 72da5a7

Browse files
authored
Merge pull request #82134 from etcwilde/ewilde/cache-platform-info
SwiftCore: Cache computed platform info
2 parents 2549627 + d343478 commit 72da5a7

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,4 @@ Runtimes/**/*.inc
9797
Runtimes/**/*.json
9898
Runtimes/**/*.modulemap
9999
Runtimes/**/*.in
100+
!Runtimes/**/*.cmake.in
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
set(SwiftCore_SIZEOF_POINTER @SwiftCore_SIZEOF_POINTER@)
2+
set(SwiftCore_MODULE_TRIPLE @SwiftCore_MODULE_TRIPLE@)
3+
set(SwiftCore_PLATFORM_SUBIDR @SwiftCore_PLATFORM_SUBIDR@)
4+
set(SwiftCore_ARCH_SUBDIR @SwiftCore_ARCH_SUBDIR@)
5+
6+
set(SwiftCore_SWIFT_AVAILABILITY_PLATFORM @SwiftCore_SWIFT_AVAILABILITY_PLATFORM@)
7+
8+
set(SwiftCore_PLATFORM_INFO_SET 1)

Runtimes/Core/cmake/modules/PlatformInfo.cmake

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
include("${PROJECT_BINARY_DIR}/build/DetectedPlatformInfo.cmake" OPTIONAL)
2+
3+
if(SwiftCore_PLATFORM_INFO_SET)
4+
return()
5+
endif()
6+
17
if(NOT SwiftCore_SIZEOF_POINTER)
28
set(SwiftCore_SIZEOF_POINTER "${CMAKE_SIZEOF_VOID_P}" CACHE STRING "Size of a pointer in bytes")
39
message(CONFIGURE_LOG "Stdlib Pointer size: ${CMAKE_SIZEOF_VOID_P}")
@@ -80,3 +86,7 @@ if(SwiftCore_VARIANT_MODULE_TRIPLE)
8086
message(WARNING "Unknown platform ${platform} for variant availability")
8187
endif()
8288
endif()
89+
90+
configure_file("${CMAKE_CURRENT_LIST_DIR}/DetectedPlatformInfo.cmake.in"
91+
"${PROJECT_BINARY_DIR}/build/DetectedPlatformInfo.cmake"
92+
@ONLY)

0 commit comments

Comments
 (0)