Skip to content

Commit 2086035

Browse files
authored
[SYCL][Windows] Enable building lld by default on Windows (#6701)
The Windows-Clang CMake module uses `lld-link` by default, so having lld built on windows is helpful for people wanting to build SYCL applications using CMake. Related to: #6026
1 parent 404d281 commit 2086035

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

buildbot/configure.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ def do_configure(args):
4444
sycl_enable_xpti_tracing = 'ON'
4545
xpti_enable_werror = 'OFF'
4646

47+
# lld is needed on Windows or for the HIP plugin on AMD
48+
if platform.system() == 'Windows' or (args.hip and args.hip_platform == 'AMD'):
49+
llvm_enable_projects += ';lld'
50+
4751
# replace not append, so ARM ^ X86
4852
if args.arm:
4953
llvm_targets_to_build = 'ARM;AArch64'
@@ -65,8 +69,6 @@ def do_configure(args):
6569
llvm_targets_to_build += ';AMDGPU'
6670
libclc_targets_to_build += libclc_amd_target_names
6771

68-
# The HIP plugin for AMD uses lld for linking
69-
llvm_enable_projects += ';lld'
7072
elif args.hip_platform == 'NVIDIA' and not args.cuda:
7173
llvm_targets_to_build += ';NVPTX'
7274
libclc_targets_to_build += libclc_nvidia_target_names

sycl/CMakeLists.txt

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,12 @@ if(OpenCL_INSTALL_KHRONOS_ICD_LOADER AND TARGET OpenCL-ICD)
383383
list(APPEND SYCL_TOOLCHAIN_DEPLOY_COMPONENTS OpenCL-ICD)
384384
endif()
385385

386+
# Build and install lld as part of the sycl-toolchain if available
387+
if("lld" IN_LIST LLVM_ENABLE_PROJECTS)
388+
add_dependencies(sycl-toolchain lld)
389+
list(APPEND SYCL_TOOLCHAIN_DEPLOY_COMPONENTS lld)
390+
endif()
391+
386392
if("cuda" IN_LIST SYCL_ENABLE_PLUGINS)
387393
# Ensure that libclc is enabled.
388394
list(FIND LLVM_ENABLE_PROJECTS libclc LIBCLC_FOUND)
@@ -403,14 +409,13 @@ if("hip" IN_LIST SYCL_ENABLE_PLUGINS)
403409
"HIP support requires adding \"libclc\" to the CMake argument \"LLVM_ENABLE_PROJECTS\"")
404410
endif()
405411

412+
if(NOT TARGET lld AND "${SYCL_BUILD_PI_HIP_PLATFORM}" STREQUAL "AMD")
413+
message(FATAL_ERROR
414+
"HIP support requires adding \"lld\" to the CMake argument \"LLVM_ENABLE_PROJECTS\"")
415+
endif()
416+
406417
add_dependencies(sycl-toolchain libspirv-builtins pi_hip)
407418
list(APPEND SYCL_TOOLCHAIN_DEPLOY_COMPONENTS libspirv-builtins pi_hip)
408-
409-
# On AMD platform lld is also needed
410-
if("${SYCL_BUILD_PI_HIP_PLATFORM}" STREQUAL "AMD")
411-
add_dependencies(sycl-toolchain lld)
412-
list(APPEND SYCL_TOOLCHAIN_DEPLOY_COMPONENTS lld)
413-
endif()
414419
endif()
415420

416421
if("esimd_emulator" IN_LIST SYCL_ENABLE_PLUGINS)

0 commit comments

Comments
 (0)