Skip to content
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

Windows SYCL Build Fix, main branch (2023.09.25.) #237

Merged
merged 1 commit into from
Sep 25, 2023
Merged
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
22 changes: 18 additions & 4 deletions cmake/sycl/Platform/Windows-IntelLLVM-SYCL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ include( Platform/Windows-IntelLLVM )
# Set up the variables specifying the command line arguments of the compiler.
__windows_compiler_intel( SYCL )

# With CMake 3.27 by default CMake would try to add version information into
# the DLL file names. Confusing the linking process.
#
# I tried to disable this using the DLL_NAME_WITH_SOVERSION property, the thing
# that was introduced in CMake 3.27, but for some reason that did not work. :-/
# So when SYCL code is being used on Windows, I disable "versioned SONAMEs"
# completely. For all languages and targets.
set( CMAKE_PLATFORM_NO_VERSIONED_SONAME TRUE )

# Tweak the compiler command, to let the compiler explicitly know that it is
# receiving C++ source code with the provided .sycl file(s).
string( REPLACE "<SOURCE>" "/Tp <SOURCE>" CMAKE_SYCL_COMPILE_OBJECT
Expand All @@ -31,10 +40,15 @@ foreach( linker_command "CMAKE_SYCL_CREATE_SHARED_LIBRARY"

# Prefix the linker-specific arguments with "/link", to let DPC++ know
# that these are to be given to the linker. "/out" just happens to be the
# first linker argument on the command line. (With CMake 3.21.) So this part
# may need to be tweaked in the future.
string( REPLACE "/out" "/link /out"
${linker_command} "${${linker_command}}" )
# first linker argument on the command line. (With CMake 3.21.)
#
# Later CMake versions fixed this out of the box, so this is only needed
# if "/link" is missing from the commands.
if( ( NOT "${${linker_command}}" MATCHES "/link" ) AND
( NOT "${${linker_command}}" MATCHES "-link" ) )
string( REPLACE "/out" "/link /out"
${linker_command} "${${linker_command}}" )
endif()

endforeach()

Expand Down
Loading