-
Notifications
You must be signed in to change notification settings - Fork 10.6k
build: adjust the build to support non-Apple environments #68258
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
Conversation
162718e to
649b744
Compare
60afbb7 to
ee3273c
Compare
cmake/modules/AddSwift.cmake
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
elseif(CMAKE_SYSTEM_NAME MATCHES Windows)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CMAKE_SYSTEM_NAME MATCHES Windows/SWIFT_HOST_VARIANT_SDK MATCHES WINDOWS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as in lib/CMakeLists.txt, ie.
target_link_directories(${target} PRIVATE
${SWIFT_PATH_TO_SWIFT_SDK}/usr/lib/swift/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block was only added for SWIFT_SWIFT_PARSER. BOOTSTRAPPING= is handled above, it was copy pasted so the comments don't really make much sense. TLDR: no else here please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I needed the else case otherwise it didn't build IIRC
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where? The block below only runs on Darwin and needs to keep running without the else. Is the set(RPATH_LIST ${RPATH_LIST} PARENT_SCOPE) the issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FAILED: bin/sourcekitdInProc.dll lib/sourcekitdInProc.lib
cmd.exe /C "cd . && "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E vs_link_dll --intdir=tools\swift\tools\SourceKit\tools\sourcekitd\bin\InProc\CMakeFiles\sourcekitdInProc.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests -- C:\PROGRA~2\MICROS~2\2022\BUILDT~1\VC\Tools\MSVC\1437~1.328\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\sourcekitdInProc.rsp /out:bin\sourcekitdInProc.dll /implib:lib\sourcekitdInProc.lib /pdb:bin\sourcekitdInProc.pdb /dll /version:0.0 /machine:x64 /INCREMENTAL:NO /DEF:"S:/b/1/tools/swift/tools/SourceKit/tools/sourcekitd/bin/InProc/sourcekitdInProc.def" --target=x86_64-unknown-windows-msvc && cd ."
LINK: command "C:\PROGRA~2\MICROS~2\2022\BUILDT~1\VC\Tools\MSVC\1437~1.328\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\sourcekitdInProc.rsp /out:bin\sourcekitdInProc.dll /implib:lib\sourcekitdInProc.lib /pdb:bin\sourcekitdInProc.pdb /dll /version:0.0 /machine:x64 /INCREMENTAL:NO /DEF:S:/b/1/tools/swift/tools/SourceKit/tools/sourcekitd/bin/InProc/sourcekitdInProc.def --target=x86_64-unknown-windows-msvc /MANIFEST /MANIFESTFILE:bin\sourcekitdInProc.dll.manifest" failed (exit code 1104) with the following output:
LINK : warning LNK4044: unrecognized option '/-target=x86_64-unknown-windows-msvc'; ignored
LINK : fatal error LNK1104: cannot open file 'swift_Concurrency.lib'
tools/driver/CMakeLists.txt
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, I've missed this function in the past.
target_link_libraries(${target}
PRIVATE swiftCore)
I have no idea how all the other tools are working, but we should fix this later (don't worry about it for this PR/Windows, we'll fix up on main after). This should be being added by _add_swift_runtime_link_flags from add_swift_host_tool but apparently isn't. Maybe autolinking is kicking in on Darwin?
Anyway, TLDR: target_link_directories is already done in _add_swift_runtime_link_flags, so this change shouldn't be needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was needed as otherwise I ended up with references to libraries that are not available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see how that could be, are you sure that wasn't before updating _add_swift_runtime_link_flags? add_swift_host_tool has:
# Once the new Swift parser is linked in, every host tool has Swift modules.
if (SWIFT_SWIFT_PARSER AND NOT ASHT_DOES_NOT_USE_SWIFT)
set(ASHT_HAS_SWIFT_MODULES ON)
endif()
if (ASHT_HAS_SWIFT_MODULES)
_add_swift_runtime_link_flags(${executable} "../lib" "${ASHT_BOOTSTRAPPING}")
endif()
And you've added target_link_libraries there.
45f1d78 to
47c56bd
Compare
|
@swift-ci please test |
Account for import libraries and the associated layout difference on platforms (e.g. DLLs are placed in `bin`). This is required to enable building the macro path on Windows.
47c56bd to
00d4879
Compare
|
@swift-ci please test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could still clean up a bit, but we can do that with all the other cleanup we need to do for Linux anyway :).
|
Going to merge this for now to unblock macros on main at the very least. |
Account for import libraries and the associated layout difference on
platforms (e.g. DLLs are placed in
bin). This is required to enablebuilding the macro path on Windows.