[opencl] Update, add Utility lib (#40122)

This commit is contained in:
Kai Pastor 2024-07-31 02:39:19 +02:00 committed by GitHub
parent 9757cf5586
commit 752799690b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 79 additions and 89 deletions

View File

@ -1,27 +0,0 @@
From 0f783f1a8eac7a78bc92198e140d4a5c745382ca Mon Sep 17 00:00:00 2001
From: Nicole Mazzuca <mazzucan@outlook.com>
Date: Wed, 23 Sep 2020 11:50:21 -0700
Subject: [PATCH] include unistd for gete?[ug]id
---
loader/linux/icd_linux_envvars.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/loader/linux/icd_linux_envvars.c b/loader/linux/icd_linux_envvars.c
index 4af5a08..92b0698 100644
--- a/loader/linux/icd_linux_envvars.c
+++ b/loader/linux/icd_linux_envvars.c
@@ -25,6 +25,10 @@
#include <stdlib.h>
+#if defined(__APPLE__)
+#include <unistd.h>
+#endif
+
char *khrIcd_getenv(const char *name) {
// No allocation of memory necessary for Linux.
return getenv(name);
--
2.24.3 (Apple Git-128)

View File

@ -1,77 +1,88 @@
# OpenCL headers
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO KhronosGroup/OpenCL-SDK
REF "${VERSION}"
SHA512 995ed5cff95fec7ffd8470f04eb4d00325f9acb20cc1f0d78442890d0636554c2526c015351f4b19bc673dcadd531bb62d9d3c8c526dd921f236cb5035e906e0
HEAD_REF main
)
vcpkg_from_github(
OUT_SOURCE_PATH OPENCL_HEADERS
REPO KhronosGroup/OpenCL-Headers
REF "${VERSION}"
SHA512 41730e80b267de45db9d7a3bcf9e0f29bfc86b25475a86d50180a7258e1240fc8c8f2ad3e222b03b3ef50c10ef63fb5b1647c056fec615e87965aa3196e8ac60
SHA512 2f1a46d58a5a9329470bab4c3662f17e81aab9558bfd9e1aafa14d3e1ab129513ab9493eeeb3cc48f0f91f0bc6b61bd54e28d7083eed58af9f34cd973cc93de1
HEAD_REF main
)
if(NOT EXISTS "${SOURCE_PATH}/external/OpenCL-Headers/CMakeLists.txt")
file(REMOVE_RECURSE "${SOURCE_PATH}/external/OpenCL-Headers")
file(RENAME "${OPENCL_HEADERS}" "${SOURCE_PATH}/external/OpenCL-Headers")
endif()
# OpenCL C++ headers
vcpkg_from_github(
OUT_SOURCE_PATH OPENCL_CLHPP
REPO KhronosGroup/OpenCL-CLHPP
REF "${VERSION}"
SHA512 30252a832287375d550a5e184779881d5b22207a636298c7f52f277c219d3a1ae6983259cfea7bf4f90f0840fec114ee0e7a8c1e6a6fe48c24fd3b5119e7a7f8
SHA512 6396cd67a2edef6a76695857e3e45f7eeb8cdaa8c729197357c6374ac58b41caa37bbe8c3b7a1724d43d3805f8cd5edd53a8ed833d6415bf072745800b744572
HEAD_REF main
)
if(NOT EXISTS "${SOURCE_PATH}/external/OpenCL-CLHPP/CMakeLists.txt")
file(REMOVE_RECURSE "${SOURCE_PATH}/external/OpenCL-CLHPP")
file(RENAME "${OPENCL_CLHPP}" "${SOURCE_PATH}/external/OpenCL-CLHPP")
endif()
# OpenCL ICD loader
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
OUT_SOURCE_PATH OPENCL_ICD_LOADER
REPO KhronosGroup/OpenCL-ICD-Loader
REF "${VERSION}"
SHA512 e418b8f3cccb4716ed44acd0677afb96705f8b40a7714d483f1efe1a9b835f4a823c5a80f8457e72c8004f76d8a07c45d9cca55b699dd2fdaa6fe9f8cc863cbd
SHA512 12d62183e49c5a1f813807291744d816008afca55b09f5acf2eef1bce50a453bf35a8dfbeb5f433022b0c5517f0a210d7123a3bac7a15ea63cc10f3bc71510f0
HEAD_REF main
)
if(NOT EXISTS "${SOURCE_PATH}/external/OpenCL-ICD-Loader/CMakeLists.txt")
file(REMOVE_RECURSE "${SOURCE_PATH}/external/OpenCL-ICD-Loader")
file(RENAME "${OPENCL_ICD_LOADER}" "${SOURCE_PATH}/external/OpenCL-ICD-Loader")
endif()
block(SCOPE_FOR VARIABLES)
set(VCPKG_BUILD_TYPE release) # header-only SDK components
vcpkg_from_github(
OUT_SOURCE_PATH WHEREAMI
REPO gpakosz/whereami
REF f5e3eac441acbb4ec1fe3e2c32646248ae463398 # 2024-06-09
SHA512 d6fa8b6788cabdbb185a6ffba79c994762924a1c60595b769a7d3bb4a3ddf0f80cdeac7bd915cffa720f9123a720a1b7f0023fd7f2cf58906d15758529a99e2d
HEAD_REF master
)
vcpkg_replace_string("${SOURCE_PATH}/cmake/Dependencies/whereami/whereami.cmake" [[${CMAKE_CURRENT_BINARY_DIR}/_deps/whereami-external-src]] [[${whereami-external_SOURCE_DIR}]])
message(STATUS "OpenCL headers (${OPENCL_HEADERS})")
vcpkg_cmake_configure(
SOURCE_PATH "${OPENCL_HEADERS}"
OPTIONS
-DOPENCL_HEADERS_BUILD_CXX_TESTS=OFF
-DBUILD_TESTING=OFF
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH "share/cmake/OpenCLHeaders" PACKAGE_NAME "openclheaders")
file(RENAME "${CURRENT_PACKAGES_DIR}/lib/pkgconfig" "${CURRENT_PACKAGES_DIR}/share/pkgconfig")
unset(Z_VCPKG_CMAKE_GENERATOR CACHE) # suppress warning
message(STATUS "OpenCL C++ headers (${OPENCL_CLHPP})")
vcpkg_cmake_configure(
SOURCE_PATH "${OPENCL_CLHPP}"
OPTIONS
-DBUILD_DOCS=OFF
-DBUILD_EXAMPLES=OFF
-DBUILD_TESTING=OFF
"-DOpenCLHeaders_DIR=${CURRENT_PACKAGES_DIR}/share/openclheaders"
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH "share/cmake/OpenCLHeadersCpp" PACKAGE_NAME "openclheaderscpp")
unset(Z_VCPKG_CMAKE_GENERATOR CACHE) # suppress warning
endblock()
message(STATUS "OpenCL ICD loader (${SOURCE_PATH})")
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
"-DOPENCL_ICD_LOADER_HEADERS_DIR=${CURRENT_PACKAGES_DIR}/include"
-DENABLE_OPENCL_LAYERINFO=OFF
"-DFETCHCONTENT_SOURCE_DIR_WHEREAMI-EXTERNAL=${WHEREAMI}"
-DBUILD_DOCS=OFF
-DBUILD_EXAMPLES=OFF
-DBUILD_TESTING=OFF
-DOPENCL_HEADERS_BUILD_CXX_TESTS=OFF
-DOPENCL_SDK_BUILD_SAMPLES=OFF
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH "share/cmake/OpenCLICDLoader" PACKAGE_NAME "openclicdloader")
vcpkg_cmake_config_fixup(CONFIG_PATH "share/cmake/OpenCLHeaders" PACKAGE_NAME "OpenCLHeaders" DO_NOT_DELETE_PARENT_CONFIG_PATH)
vcpkg_cmake_config_fixup(CONFIG_PATH "share/cmake/OpenCLICDLoader" PACKAGE_NAME "OpenCLICDLoader" DO_NOT_DELETE_PARENT_CONFIG_PATH)
vcpkg_cmake_config_fixup(CONFIG_PATH "share/cmake/OpenCLHeadersCpp" PACKAGE_NAME "OpenCLHeadersCpp" DO_NOT_DELETE_PARENT_CONFIG_PATH)
vcpkg_cmake_config_fixup(CONFIG_PATH "share/cmake/OpenCLUtils" PACKAGE_NAME "OpenCLUtils" DO_NOT_DELETE_PARENT_CONFIG_PATH)
vcpkg_cmake_config_fixup(CONFIG_PATH "share/cmake/OpenCLUtilsCpp" PACKAGE_NAME "OpenCLUtilsCpp" DO_NOT_DELETE_PARENT_CONFIG_PATH)
vcpkg_cmake_config_fixup(CONFIG_PATH "share/cmake/OpenCL" PACKAGE_NAME "opencl")
vcpkg_fixup_pkgconfig()
vcpkg_copy_pdbs()
vcpkg_copy_tools(TOOL_NAMES cllayerinfo AUTO_CLEAN)
file(GLOB files_in_bin "${CURRENT_PACKAGES_DIR}/bin/*")
if(files_in_bin STREQUAL "")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
)
configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY)
file(COPY "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE" "${WHEREAMI}/LICENSE.MIT"
COMMENT [[
The OpenCL SDK is licensed under the terms of the Apache-2.0 license.
The OpenCL Utility Library uses code from https://github.com/gpakosz/whereami
which is dual licensed under both the WTFPLv2 and MIT licenses.
]])

View File

@ -1,25 +1,27 @@
opencl provides CMake targets:
# Khronos OpenCL Headers
find_package(OpenCLHeaders CONFIG REQUIRED)
target_link_libraries(main PRIVATE OpenCL::Headers)
# Khronos OpenCL C++ Headers
find_package(OpenCLHeadersCpp CONFIG REQUIRED)
target_link_libraries(main PRIVATE OpenCL::HeadersCpp)
find_package(OpenCL CONFIG REQUIRED)
# Khronos OpenCL ICD Loader
find_package(OpenCLICDLoader CONFIG REQUIRED)
target_link_libraries(main PRIVATE OpenCL::OpenCL)
# Khronos OpenCL Headers and C++ bindings
target_link_libraries(main PRIVATE OpenCL::Headers)
target_link_libraries(main PRIVATE OpenCL::HeadersCpp)
# OpenCL Utility Library and C++ bindings
target_link_libraries(main PRIVATE OpenCL::Utils)
target_link_libraries(main PRIVATE OpenCL::UtilsCpp)
opencl provides pkg-config modules:
# Khronos OpenCL Headers
OpenCL-Headers
# Khronos OpenCL ICD Loader
OpenCL
# Khronos OpenCL Headers and C++ bindings
OpenCL-Headers
OpenCL-CLHPP
This package is only an OpenCL SDK. To actually run OpenCL code you also need to install an implementation.
Windows: Implementations typically ship with the drivers of you CPU/GPU vendors.

View File

@ -1,10 +1,9 @@
{
"name": "opencl",
"version-string": "v2023.02.06",
"port-version": 3,
"description": "C/C++ headers and ICD loader (Installable Client Driver) for OpenCL",
"homepage": "https://github.com/KhronosGroup/OpenCL-Headers",
"license": "Apache-2.0",
"version-string": "v2024.05.08",
"description": "OpenCL SDK",
"homepage": "https://github.com/KhronosGroup/OpenCL-SDK",
"license": "Apache-2.0 AND (MIT OR WTFPL)",
"supports": "!uwp",
"dependencies": [
{

View File

@ -6497,8 +6497,8 @@
"port-version": 2
},
"opencl": {
"baseline": "v2023.02.06",
"port-version": 3
"baseline": "v2024.05.08",
"port-version": 0
},
"opencolorio": {
"baseline": "2.2.1",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "37ee1974a90da69c3cf4536bab58bf7b5a208a47",
"version-string": "v2024.05.08",
"port-version": 0
},
{
"git-tree": "4e224177099db3e6f391e33fc250d7a8699d60b9",
"version-string": "v2023.02.06",