Skip to content

Commit 960779f

Browse files
committed
Fold individual file copies into copy_files
Use the new copy_files to copy specific files into the appropriate places without needing to duplicate as much code.
1 parent 29de93d commit 960779f

File tree

1 file changed

+24
-82
lines changed

1 file changed

+24
-82
lines changed

Runtimes/Resync.cmake

Lines changed: 24 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function(copy_files from_prefix to_prefix)
2828
ONLY_IF_DIFFERENT)
2929
if(_output)
3030
message(SEND_ERROR
31-
"Copy ${from_prefix}/${file} -> ${full_to_prefix}/${file} Failed: ${_output}")
31+
"Copy ${ARG_ROOT}/${from_prefix}/${file} -> ${full_to_prefix}/${file} Failed: ${_output}")
3232
endif()
3333
endforeach()
3434
endfunction()
@@ -77,63 +77,6 @@ copy_library_sources(include "" "Core")
7777
# Copy magic linker symbols
7878
copy_library_sources("linker-support" "" "Core")
7979

80-
# Copy Plist
81-
message(STATUS "plist[${StdlibSources}/Info.plist.in] -> Core/Info.plist.in")
82-
file(COPY_FILE
83-
"${StdlibSources}/Info.plist.in" # From
84-
"${CMAKE_CURRENT_LIST_DIR}/Core/Info.plist.in" # To
85-
RESULT _output
86-
ONLY_IF_DIFFERENT)
87-
if(_output)
88-
message(SEND_ERROR
89-
"Copy ${StdlibSources}/Info.plist.in] -> Core/Info.plist.in Failed: ${_output}")
90-
endif()
91-
92-
# Copy Windows clang overlays
93-
message(STATUS "modulemap[${StdlibSources}/Windows/ucrt.modulemap] -> Overlay/Windows/clang")
94-
file(COPY_FILE
95-
"${StdlibSources}/public/Platform/ucrt.modulemap" # From
96-
"${CMAKE_CURRENT_LIST_DIR}/Overlay/Windows/clang/ucrt.modulemap" # To
97-
RESULT _output
98-
ONLY_IF_DIFFERENT)
99-
if(_output)
100-
message(SEND_ERROR
101-
"Copy ${StdlibSources}/public/Platform/ucrt.modulemap -> Overlay/Windows/clang/ucrt.modulemap Failed: ${_output}")
102-
endif()
103-
104-
message(STATUS "modulemap[${StdlibSources}/Windows/winsdk.modulemap] -> Overlay/Windows/clang")
105-
file(COPY_FILE
106-
"${StdlibSources}/public/Platform/winsdk.modulemap" # From
107-
"${CMAKE_CURRENT_LIST_DIR}/Overlay/Windows/clang/winsdk.modulemap" # To
108-
RESULT _output
109-
ONLY_IF_DIFFERENT)
110-
if(_output)
111-
message(SEND_ERROR
112-
"Copy ${StdlibSources}/public/Platform/winsdk.modulemap -> Overlay/Windows/clang/winsdk.modulemap Failed: ${_output}")
113-
endif()
114-
115-
message(STATUS "modulemap[${StdlibSources}/Windows/vcruntime.modulemap] -> Overlay/Windows/clang")
116-
file(COPY_FILE
117-
"${StdlibSources}/public/Platform/vcruntime.modulemap" # From
118-
"${CMAKE_CURRENT_LIST_DIR}/Overlay/Windows/clang/vcruntime.modulemap" # To
119-
RESULT _output
120-
ONLY_IF_DIFFERENT)
121-
if(_output)
122-
message(SEND_ERROR
123-
"Copy ${StdlibSources}/public/Platform/vcruntime.modulemap -> Overlay/Windows/clang/vcruntime.modulemap Failed: ${_output}")
124-
endif()
125-
126-
message(STATUS "APINotes[${StdlibSources}/Windows/vcruntime.apinotes] -> Overlay/Windows/clang")
127-
file(COPY_FILE
128-
"${StdlibSources}/public/Platform/vcruntime.apinotes" # From
129-
"${CMAKE_CURRENT_LIST_DIR}/Overlay/Windows/clang/vcruntime.apinotes" # To
130-
RESULT _output
131-
ONLY_IF_DIFFERENT)
132-
if(_output)
133-
message(SEND_ERROR
134-
"Copy ${StdlibSources}/public/Platform/vcruntime.apinotes -> Overlay/Windows/clang/vcruntime.modulemap Failed: ${_output}")
135-
endif()
136-
13780
set(CoreLibs
13881
LLVMSupport
13982
SwiftShims
@@ -146,36 +89,35 @@ set(CoreLibs
14689
Concurrency
14790
Concurrency/InternalShims)
14891

149-
# Add these as we get them building
150-
# Demangling
151-
15292
foreach(library ${CoreLibs})
15393
copy_library_sources(${library} "public" "Core")
15494
endforeach()
15595

156-
message(STATUS "CRT[${StdlibSources}/public/Platform] -> ${CMAKE_CURRENT_LIST_DIR}/Overlay/Windows/CRT")
157-
foreach(file ucrt.swift Platform.swift POSIXError.swift TiocConstants.swift tgmath.swift.gyb)
158-
file(COPY_FILE
159-
"${StdlibSources}/public/Platform/${file}"
160-
"${CMAKE_CURRENT_LIST_DIR}/Overlay/Windows/CRT/${file}"
161-
RESULT _output
162-
ONLY_IF_DIFFERENT)
163-
if(_output)
164-
message(SEND_ERROR
165-
"Copy Platform/${file} -> ${CMAKE_CURRENT_LIST_DIR}/Overlay/Windows/CRT/${file} Failed: ${_output}")
166-
endif()
167-
endforeach()
96+
message(STATUS "plist[${StdlibSources}/Info.plist.in] -> Core/Info.plist.in")
97+
copy_files("" "Core" FILES "Info.plist.in")
98+
99+
# Platform Overlays
168100

101+
# Windows Overlay
169102
message(STATUS "WinSDK[${StdlibSources}/public/Windows] -> ${CMAKE_CURRENT_LIST_DIR}/Overlay/Windows/WinSDK")
170-
file(COPY_FILE
171-
"${StdlibSources}/public/Windows/WinSDK.swift"
172-
"${CMAKE_CURRENT_LIST_DIR}/Overlay/Windows/WinSDK/WinSDK.swift"
173-
RESULT _output
174-
ONLY_IF_DIFFERENT)
175-
if(_output)
176-
message(SEND_ERROR
177-
"Copy Windows/WinSDK.swift -> ${CMAKE_CURRENT_LIST_DIR}/Overlay/Windows/WinSDK/WinSDK.swift Failed: ${_output}")
178-
endif()
103+
copy_files(public/Windows Overlay/Windows/WinSDK FILES WinSDK.swift)
104+
105+
message(STATUS "Windows Modulemaps[${StdlibSources}/Platform] -> ${CMAKE_CURRENT_LIST_DIR}/Overlay/Windows/clang")
106+
copy_files(public/Platform Overlay/Windows/clang
107+
FILES
108+
ucrt.modulemap
109+
winsdk.modulemap
110+
vcruntime.modulemap
111+
vcruntime.apinotes)
112+
113+
message(STATUS "CRT[${StdlibSources}/public/Platform] -> ${CMAKE_CURRENT_LIST_DIR}/Overlay/Windows/CRT")
114+
copy_files(public/Platform Overlay/Windows/CRT
115+
FILES
116+
ucrt.swift
117+
Platform.swift
118+
POSIXError.swift
119+
TiocConstants.swift
120+
tgmath.swift.gyb)
179121

180122
# TODO: Add source directories for the platform overlays, supplemental
181123
# libraries, and test support libraries.

0 commit comments

Comments
 (0)