Skip to content

Platform: make stdint module implicit on Windows #67756

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 27 additions & 17 deletions stdlib/cmake/modules/AddSwiftStdlib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,10 @@ function(_add_target_variant_link_flags)
# options. This causes conflicts.
list(APPEND result "-nostdlib")
endif()
swift_windows_lib_for_arch(${LFLAGS_ARCH} ${LFLAGS_ARCH}_LIB)
list(APPEND library_search_directories ${${LFLAGS_ARCH}_LIB})
if(NOT CMAKE_HOST_SYSTEM MATCHES Windows)
swift_windows_lib_for_arch(${LFLAGS_ARCH} ${LFLAGS_ARCH}_LIB)
list(APPEND library_search_directories ${${LFLAGS_ARCH}_LIB})
endif()

# NOTE(compnerd) workaround incorrectly extensioned import libraries from
# the Windows SDK on case sensitive file systems.
Expand Down Expand Up @@ -905,10 +907,12 @@ function(add_swift_target_library_single target name)
endif()
list(APPEND SWIFTLIB_SINGLE_SWIFT_COMPILE_FLAGS
-vfsoverlay;"${SWIFT_WINDOWS_VFS_OVERLAY}")
swift_windows_include_for_arch(${SWIFTLIB_SINGLE_ARCHITECTURE} SWIFTLIB_INCLUDE)
foreach(directory ${SWIFTLIB_INCLUDE})
list(APPEND SWIFTLIB_SINGLE_SWIFT_COMPILE_FLAGS -Xcc;-isystem;-Xcc;${directory})
endforeach()
if(NOT CMAKE_HOST_SYSTEM MATCHES Windows)
swift_windows_include_for_arch(${SWIFTLIB_SINGLE_ARCHITECTURE} SWIFTLIB_INCLUDE)
foreach(directory ${SWIFTLIB_INCLUDE})
list(APPEND SWIFTLIB_SINGLE_SWIFT_COMPILE_FLAGS -Xcc;-isystem;-Xcc;${directory})
endforeach()
endif()
if("${SWIFTLIB_SINGLE_ARCHITECTURE}" MATCHES arm)
list(APPEND SWIFTLIB_SINGLE_SWIFT_COMPILE_FLAGS -Xcc;-D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE)
endif()
Expand Down Expand Up @@ -1071,9 +1075,11 @@ function(add_swift_target_library_single target name)
SWIFT_INLINE_NAMESPACE=__runtime)

if("${SWIFTLIB_SINGLE_SDK}" STREQUAL "WINDOWS")
swift_windows_include_for_arch(${SWIFTLIB_SINGLE_ARCHITECTURE} SWIFTLIB_INCLUDE)
target_include_directories("${target}" SYSTEM PRIVATE
${SWIFTLIB_INCLUDE})
if(NOT CMAKE_HOST_SYSTEM MATCHES Windows)
swift_windows_include_for_arch(${SWIFTLIB_SINGLE_ARCHITECTURE} SWIFTLIB_INCLUDE)
target_include_directories("${target}" SYSTEM PRIVATE
${SWIFTLIB_INCLUDE})
endif()
endif()

if("${SWIFTLIB_SINGLE_SDK}" STREQUAL "WINDOWS" AND NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
Expand Down Expand Up @@ -1382,10 +1388,12 @@ function(add_swift_target_library_single target name)

# Set compilation and link flags.
if(SWIFTLIB_SINGLE_SDK STREQUAL "WINDOWS")
swift_windows_include_for_arch(${SWIFTLIB_SINGLE_ARCHITECTURE}
${SWIFTLIB_SINGLE_ARCHITECTURE}_INCLUDE)
target_include_directories(${target} SYSTEM PRIVATE
${${SWIFTLIB_SINGLE_ARCHITECTURE}_INCLUDE})
if(NOT CMAKE_HOST_SYSTEM MATCHES Windows)
swift_windows_include_for_arch(${SWIFTLIB_SINGLE_ARCHITECTURE}
${SWIFTLIB_SINGLE_ARCHITECTURE}_INCLUDE)
target_include_directories(${target} SYSTEM PRIVATE
${${SWIFTLIB_SINGLE_ARCHITECTURE}_INCLUDE})
endif()

if(NOT CMAKE_C_COMPILER_ID STREQUAL "MSVC")
swift_windows_get_sdk_vfs_overlay(SWIFTLIB_SINGLE_VFS_OVERLAY)
Expand Down Expand Up @@ -2626,10 +2634,12 @@ function(_add_swift_target_executable_single name)
llvm_update_compile_flags("${name}")

if(SWIFTEXE_SINGLE_SDK STREQUAL "WINDOWS")
swift_windows_include_for_arch(${SWIFTEXE_SINGLE_ARCHITECTURE}
${SWIFTEXE_SINGLE_ARCHITECTURE}_INCLUDE)
target_include_directories(${name} SYSTEM PRIVATE
${${SWIFTEXE_SINGLE_ARCHITECTURE}_INCLUDE})
if(NOT CMAKE_HOST_SYSTEM MATCHES Windows)
swift_windows_include_for_arch(${SWIFTEXE_SINGLE_ARCHITECTURE}
${SWIFTEXE_SINGLE_ARCHITECTURE}_INCLUDE)
target_include_directories(${name} SYSTEM PRIVATE
${${SWIFTEXE_SINGLE_ARCHITECTURE}_INCLUDE})
endif()
if(NOT CMAKE_C_COMPILER_ID STREQUAL "MSVC")
# MSVC doesn't support -Xclang. We don't need to manually specify
# the dependent libraries as `cl` does so.
Expand Down
2 changes: 1 addition & 1 deletion stdlib/public/Platform/vcruntime.modulemap
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ module vcruntime [system] {
export *
}

explicit module stdint {
module stdint {
header "stdint.h"
export *
}
Expand Down