Skip to content

Commit

Permalink
Make /DEPENDENTLOADFLAG value configurable
Browse files Browse the repository at this point in the history
In Windows development environments the default value of `0x2000` is too
restrictive as it does not allow loading the `OpenCL.dll` built as part
of the project. This patch makes the value passed to the
`/DEPENDENTLOADFLAG` option configurable using the
`UR_DEPENDENTLOADFLAG` CMake option.
  • Loading branch information
kbenzie committed Oct 23, 2024
1 parent d8cc532 commit a08fc2a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ set(UR_ADAPTER_HIP_SOURCE_DIR "" CACHE PATH
"Path to external 'hip' adapter source dir")
set(UR_ADAPTER_NATIVE_CPU_SOURCE_DIR "" CACHE PATH
"Path to external 'native_cpu' adapter source dir")
if(CMAKE_SYSTEM_NAME STREQUAL Windows)
set(UR_DEPENDENTLOADFLAG "0x2000" CACHE STRING
"Value to use for Windows link.exe /DEPENDENTLOADFLAG option")
endif()

# There's little reason not to generate the compile_commands.json
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
Expand Down
4 changes: 2 additions & 2 deletions cmake/helpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ function(add_ur_library name)
add_library(${name} ${ARGN})
add_ur_target_compile_options(${name})
add_ur_target_link_options(${name})
if(MSVC)
if(CMAKE_LINKER MATCHES link.exe)
target_link_options(${name} PRIVATE
$<$<STREQUAL:$<TARGET_LINKER_FILE_NAME:${name}>,link.exe>:/DEPENDENTLOADFLAG:0x2000>
LINKER:/DEPENDENTLOADFLAG:${UR_DEPENDENTLOADFLAG}
)
endif()
endfunction()
Expand Down

0 comments on commit a08fc2a

Please sign in to comment.