Skip to content

Commit 999f75e

Browse files
[SYCL][CMake] Disable win_proxy_loader build and link on non-Windows (#8520)
Currently the win_proxy_loader is built and linked to the SYCL runtime on all platforms, but only carries meaning on Windows. Currently this causes issues as the corresponding library is not installed on non-Windows targets. Instead of installing it on non-Windows targets, this commit makes it only build and link to the SYCL runtime library when building on Windows. Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
1 parent 9958509 commit 999f75e

File tree

3 files changed

+23
-17
lines changed

3 files changed

+23
-17
lines changed

sycl/CMakeLists.txt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,11 +314,14 @@ add_custom_target( sycl-toolchain
314314
DEPENDS sycl-runtime-libraries
315315
sycl-compiler
316316
sycl-ls
317-
win_proxy_loader
318317
${XPTIFW_LIBS}
319318
COMMENT "Building SYCL compiler toolchain..."
320319
)
321320

321+
if (WIN32)
322+
add_dependencies(sycl-toolchain win_proxy_loader)
323+
endif()
324+
322325
# Enable new IN_LIST operator.
323326
cmake_policy(SET CMP0057 NEW)
324327

@@ -351,7 +354,9 @@ add_subdirectory( plugins )
351354

352355
add_subdirectory(tools)
353356

354-
add_subdirectory(win_proxy_loader)
357+
if (WIN32)
358+
add_subdirectory(win_proxy_loader)
359+
endif()
355360

356361
if(SYCL_INCLUDE_TESTS)
357362
if(NOT LLVM_INCLUDE_TESTS)
@@ -395,11 +400,14 @@ set( SYCL_TOOLCHAIN_DEPLOY_COMPONENTS
395400
sycl
396401
libsycldevice
397402
level-zero-sycl-dev
398-
win_proxy_loader
399403
${XPTIFW_LIBS}
400404
${SYCL_TOOLCHAIN_DEPS}
401405
)
402406

407+
if (WIN32)
408+
list(APPEND SYCL_TOOLCHAIN_DEPLOY_COMPONENTS win_proxy_loader)
409+
endif()
410+
403411
if (TARGET sycl-prof)
404412
list(APPEND SYCL_TOOLCHAIN_DEPLOY_COMPONENTS sycl-prof)
405413
endif()

sycl/source/CMakeLists.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,13 @@ function(add_sycl_rt_library LIB_NAME LIB_OBJ_NAME)
7171
endif()
7272

7373
# win_proxy_loader
74-
include_directories(${LLVM_EXTERNAL_SYCL_SOURCE_DIR}/win_proxy_loader)
75-
if(WIN_DUPE)
76-
target_link_libraries(${LIB_NAME} PUBLIC win_proxy_loaderd)
77-
else()
78-
target_link_libraries(${LIB_NAME} PUBLIC win_proxy_loader)
74+
if (WIN32)
75+
include_directories(${LLVM_EXTERNAL_SYCL_SOURCE_DIR}/win_proxy_loader)
76+
if(WIN_DUPE)
77+
target_link_libraries(${LIB_NAME} PUBLIC win_proxy_loaderd)
78+
else()
79+
target_link_libraries(${LIB_NAME} PUBLIC win_proxy_loader)
80+
endif()
7981
endif()
8082

8183
target_compile_definitions(${LIB_OBJ_NAME} PRIVATE __SYCL_INTERNAL_API )

sycl/win_proxy_loader/CMakeLists.txt

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
project(win_proxy_loader)
22
add_library(win_proxy_loader SHARED win_proxy_loader.cpp)
3-
if (WIN32)
4-
install(TARGETS win_proxy_loader
5-
RUNTIME DESTINATION "bin" COMPONENT win_proxy_loader
6-
)
7-
endif()
3+
install(TARGETS win_proxy_loader
4+
RUNTIME DESTINATION "bin" COMPONENT win_proxy_loader
5+
)
86

97
if (MSVC)
108
# MSVC provides two incompatible build variants for its CRT: release and debug
@@ -48,10 +46,8 @@ if (MSVC)
4846
target_compile_options(win_proxy_loader PRIVATE ${WINUNLOAD_CXX_FLAGS_RELEASE})
4947
target_link_libraries(win_proxy_loaderd PRIVATE shlwapi)
5048
target_link_libraries(win_proxy_loader PRIVATE shlwapi)
51-
if (WIN32)
52-
install(TARGETS win_proxy_loaderd
53-
RUNTIME DESTINATION "bin" COMPONENT win_proxy_loader)
54-
endif()
49+
install(TARGETS win_proxy_loaderd
50+
RUNTIME DESTINATION "bin" COMPONENT win_proxy_loader)
5551
endif()
5652

5753

0 commit comments

Comments
 (0)