Skip to content

Commit

Permalink
Add patch to create versioned DLL on Windows.
Browse files Browse the repository at this point in the history
Downstream packages newly built against this package will now search for
the versioned DLL at runtime, eliminating an issue where non-conda
OpenCL.dll (e.g. NVIDIA's own ICD loader) would interfere with the
conda-packaged DLL because it has a higher priority on the PATH.
  • Loading branch information
ryanvolz committed Apr 26, 2023
1 parent 833e14a commit 960936b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ryan Volz <[email protected]>
Date: Fri, 21 Apr 2023 11:52:29 -0400
Subject: [PATCH] Create versioned DLL on Windows, OpenCL-1.dll instead of
OpenCL.dll.

---
CMakeLists.txt | 2 ++
1 file changed, 2 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 567ceee..c834205 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -124,6 +124,8 @@ set_target_properties (OpenCL PROPERTIES VERSION "1.2" SOVERSION "1")
if (WIN32)
target_link_libraries (OpenCL PRIVATE cfgmgr32.lib runtimeobject.lib)

+ set_target_properties (OpenCL PROPERTIES RUNTIME_OUTPUT_NAME "OpenCL-${PROJECT_VERSION_MAJOR}")
+
# Generate a DLL without a "lib" prefix for mingw.
if (MINGW OR MSYS OR CYGWIN)
set_target_properties(OpenCL PROPERTIES PREFIX "")
--
2.40.0

4 changes: 3 additions & 1 deletion recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ source:
sha256: 53d33bf629f145e7fded56d7fd9dde3aa85f9e0573171d777464e092f04bbf31
patches:
- no_check_integrity_win.patch
- 0001-Create-versioned-DLL-on-Windows-OpenCL-1.dll-instead.patch

- url: https://github.com/KhronosGroup/OpenCL-Headers/archive/v{{ version }}.zip
sha256: 68dc80a943fdfc760abc15d36ff301e54ebb326e643169ec63c459827b4fbb4d
Expand Down Expand Up @@ -37,7 +38,8 @@ requirements:
test:
commands:
- if not exist %LIBRARY_INC%\\CL\\cl.h exit 1 # [win]
- if not exist %LIBRARY_BIN%\\OpenCL.dll exit 1 # [win]
- if not exist %LIBRARY_BIN%\\OpenCL-1.dll exit 1 # [win]
- if not exist %LIBRARY_LIB%\\OpenCL.lib exit 1 # [win]
- test -f $PREFIX/include/OpenCL/cl.h # [osx]
- test -f $PREFIX/include/CL/cl.h # [linux]
- test -f $PREFIX/lib/libOpenCL${SHLIB_EXT} # [unix]
Expand Down

0 comments on commit 960936b

Please sign in to comment.