mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
build: workaround incorrectly cased import libraries in WinSDK
The Windows SDK proides kernel32.Lib which on case sensitive file systems will fail (due to the capital L in the extension). Workaround that by creating symbolic links to handle this. This mirrors the technique used in LLVM.
This commit is contained in:
@@ -282,6 +282,26 @@ macro(configure_sdk_windows name environment architectures)
|
||||
# to the driver -- rely on the `INCLUDE` AND `LIB` environment variables
|
||||
# instead.
|
||||
set(SWIFT_SDK_${prefix}_ARCH_${arch}_PATH "/")
|
||||
|
||||
# NOTE(compnerd) workaround incorrectly extensioned import libraries from
|
||||
# the Windows SDK on case sensitive file systems.
|
||||
swift_windows_arch_spelling(${arch} WinSDKArchitecture)
|
||||
set(WinSDK${arch}UMDir "$ENV{UniversalCRTSdkDir}/Lib/$ENV{UCRTVersion}/um/${WinSDKArchitecture}")
|
||||
set(OverlayDirectory "${CMAKE_BINARY_DIR}/winsdk_lib_${arch}_symlinks")
|
||||
|
||||
file(MAKE_DIRECTORY ${OverlayDirectory})
|
||||
|
||||
file(GLOB libraries RELATIVE "${WinSDK${arch}UMDir}" "${WinSDK${arch}UMDir}/*")
|
||||
foreach(library ${libraries})
|
||||
get_filename_component(name_we "${library}" NAME_WE)
|
||||
get_filename_component(ext "${library}" EXT)
|
||||
string(TOLOWER "${ext}" lowercase_ext)
|
||||
set(lowercase_ext_symlink_name "${name_we}${lowercase_ext}")
|
||||
if(NOT library STREQUAL lowercase_ext_symlink_name)
|
||||
execute_process(COMMAND
|
||||
"${CMAKE_COMMAND}" -E create_symlink "${WinSDK${arch}UMDir}/${library}" "${OverlayDirectory}/${lowercase_ext_symlink_name}")
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
# Add this to the list of known SDKs.
|
||||
|
||||
Reference in New Issue
Block a user