From bf1d50ff7a2e015376bf0cb091c0ea9c06f3b20b Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Wed, 31 May 2023 05:43:30 +0400 Subject: [PATCH] [opencl] fixed linkage when libOpenCL is static (#31637) * [opencl]: replaced hardcoded BUILD_SHARED_LIBS (user context) with VCPKG_LIBRARY_LINKAGE (library build context) * Updated version registries --- ports/opencl/portfile.cmake | 2 +- ports/opencl/vcpkg-cmake-wrapper.cmake | 11 ++++++----- ports/opencl/vcpkg.json | 2 +- versions/baseline.json | 2 +- versions/o-/opencl.json | 5 +++++ 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/ports/opencl/portfile.cmake b/ports/opencl/portfile.cmake index ead33b72a8..318cd8631e 100644 --- a/ports/opencl/portfile.cmake +++ b/ports/opencl/portfile.cmake @@ -80,4 +80,4 @@ vcpkg_copy_pdbs() file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) -file(COPY ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) +configure_file(${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake ${CURRENT_PACKAGES_DIR}/share/${PORT} @ONLY) diff --git a/ports/opencl/vcpkg-cmake-wrapper.cmake b/ports/opencl/vcpkg-cmake-wrapper.cmake index 0893710ff5..4010eb40dc 100644 --- a/ports/opencl/vcpkg-cmake-wrapper.cmake +++ b/ports/opencl/vcpkg-cmake-wrapper.cmake @@ -1,12 +1,12 @@ _find_package(${ARGS}) -if(NOT BUILD_SHARED_LIBS AND (NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")) +if("@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static" AND (NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")) find_package(Threads REQUIRED) set(OpenCL_Extra_Libs ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT}) if(CMAKE_SYSTEM_NAME MATCHES "Windows") list(APPEND OpenCL_Extra_Libs cfgmgr32) - if($ENV{WindowsSDKVersion} MATCHES "^10") - list(APPEND OpenCL_Extra_Libs OneCoreUAP) - endif() + if($ENV{WindowsSDKVersion} MATCHES "^10") + list(APPEND OpenCL_Extra_Libs OneCoreUAP) + endif() endif(CMAKE_SYSTEM_NAME MATCHES "Windows") if(TARGET OpenCL::OpenCL) @@ -15,4 +15,5 @@ if(NOT BUILD_SHARED_LIBS AND (NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")) if(OpenCL_LIBRARIES) list(APPEND OpenCL_LIBRARIES ${OpenCL_Extra_Libs}) endif() -endif() \ No newline at end of file + unset(OpenCL_Extra_Libs) +endif() diff --git a/ports/opencl/vcpkg.json b/ports/opencl/vcpkg.json index 33b43e394f..454210a30c 100644 --- a/ports/opencl/vcpkg.json +++ b/ports/opencl/vcpkg.json @@ -1,7 +1,7 @@ { "name": "opencl", "version-string": "v2023.02.06", - "port-version": 1, + "port-version": 2, "description": "C/C++ headers and ICD loader (Installable Client Driver) for OpenCL", "homepage": "https://github.com/KhronosGroup/OpenCL-Headers", "license": "Apache-2.0", diff --git a/versions/baseline.json b/versions/baseline.json index d5f2383f50..56087e5607 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -5878,7 +5878,7 @@ }, "opencl": { "baseline": "v2023.02.06", - "port-version": 1 + "port-version": 2 }, "opencolorio": { "baseline": "2.1.2", diff --git a/versions/o-/opencl.json b/versions/o-/opencl.json index 747c0e128c..73222e54e4 100644 --- a/versions/o-/opencl.json +++ b/versions/o-/opencl.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "c55e82e4ec70906ec28b692d2625584025de4725", + "version-string": "v2023.02.06", + "port-version": 2 + }, { "git-tree": "d206a1716a411eb9862c98d65ab3552def0c6492", "version-string": "v2023.02.06",