mirror of
https://github.com/cemu-project/vcpkg.git
synced 2024-11-23 11:19:43 +00:00
Linux support for the OpenCL SDK package (#4204)
Enable building OpenCL libraries on Linux and macOS.
This commit is contained in:
parent
2b277b4ef6
commit
cdbaa03cdd
@ -44,15 +44,19 @@ file(INSTALL
|
||||
RENAME copyright
|
||||
)
|
||||
|
||||
file(REMOVE
|
||||
${CURRENT_PACKAGES_DIR}/debug/bin/clBLAS-tune.pdb
|
||||
${CURRENT_PACKAGES_DIR}/debug/bin/clBLAS-tune.exe
|
||||
${CURRENT_PACKAGES_DIR}/bin/clBLAS-tune.exe
|
||||
${CURRENT_PACKAGES_DIR}/debug/bin/concrt140d.dll
|
||||
${CURRENT_PACKAGES_DIR}/debug/bin/msvcp140d.dll
|
||||
${CURRENT_PACKAGES_DIR}/debug/bin/vcruntime140d.dll
|
||||
)
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
file(REMOVE
|
||||
${CURRENT_PACKAGES_DIR}/debug/bin/clBLAS-tune.pdb
|
||||
${CURRENT_PACKAGES_DIR}/debug/bin/clBLAS-tune.exe
|
||||
${CURRENT_PACKAGES_DIR}/bin/clBLAS-tune.exe
|
||||
${CURRENT_PACKAGES_DIR}/debug/bin/concrt140d.dll
|
||||
${CURRENT_PACKAGES_DIR}/debug/bin/msvcp140d.dll
|
||||
${CURRENT_PACKAGES_DIR}/debug/bin/vcruntime140d.dll
|
||||
)
|
||||
|
||||
vcpkg_fixup_cmake_targets(CONFIG_PATH CMake)
|
||||
vcpkg_fixup_cmake_targets(CONFIG_PATH CMake)
|
||||
elseif(VCPKG_TARGET_IS_LINUX)
|
||||
vcpkg_fixup_cmake_targets(CONFIG_PATH "lib/cmake/clBLAS")
|
||||
endif()
|
||||
|
||||
vcpkg_copy_pdbs()
|
||||
|
@ -32,6 +32,10 @@ file(INSTALL
|
||||
${CURRENT_PACKAGES_DIR}/share/clfft/copyright
|
||||
)
|
||||
|
||||
vcpkg_fixup_cmake_targets(CONFIG_PATH CMake)
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
vcpkg_fixup_cmake_targets(CONFIG_PATH "CMake")
|
||||
elseif(VCPKG_TARGET_IS_LINUX)
|
||||
vcpkg_fixup_cmake_targets(CONFIG_PATH "lib/cmake/clFFT")
|
||||
endif()
|
||||
|
||||
vcpkg_copy_pdbs()
|
||||
|
@ -1,4 +1,7 @@
|
||||
Source: opencl
|
||||
Version: 2.2 (2017.07.18)-1
|
||||
Homepage: https://github.com/KhronosGroup/OpenCL-Headers
|
||||
Description: C/C++ headers and ICD loader (Installable Client Driver) for OpenCL
|
||||
Source: opencl
|
||||
Version: 2.2 (2018.08.31)
|
||||
Homepage: https://github.com/KhronosGroup/OpenCL-Headers
|
||||
Description: C/C++ headers and ICD loader (Installable Client Driver) for OpenCL
|
||||
|
||||
Feature: wdk
|
||||
Description: Windows Driver Kit support
|
@ -1,18 +1,25 @@
|
||||
include(vcpkg_common_functions)
|
||||
|
||||
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)
|
||||
if("wdk" IN_LIST FEATURES)
|
||||
if(NOT VCPKG_TARGET_IS_WINDOWS)
|
||||
message(FATAL_ERROR "Windows Driver Kit support is only available builds targeting Windows")
|
||||
endif()
|
||||
set(WITH_WDK ON)
|
||||
else()
|
||||
set(WITH_WDK OFF)
|
||||
endif()
|
||||
|
||||
# OpenCL C headers
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO KhronosGroup/OpenCL-Headers
|
||||
REF f039db6764d52388658ef15c30b2237bbda49803
|
||||
SHA512 5909a85f96477d731059528303435f06255e98ed8df9d4cd2b62c744b5fe41408c69c0d4068421a2813eb9ad9d70d7f1bace9ebf0db19cc09e71bb8066127c5f
|
||||
REF 0d5f18c6e7196863bc1557a693f1509adfcee056
|
||||
SHA512 7e8fa6c8e73c660d8e9e31ddea3bfef887ed827fc21a1da559bde9dd4af6c52a91f609401bb718528b5c96d21e4c01aee7b8027bdf3dec4b0aa326270788a4b0
|
||||
HEAD_REF master
|
||||
)
|
||||
|
||||
file(INSTALL
|
||||
"${SOURCE_PATH}/opencl22/CL"
|
||||
"${SOURCE_PATH}/CL"
|
||||
DESTINATION
|
||||
${CURRENT_PACKAGES_DIR}/include
|
||||
)
|
||||
@ -21,8 +28,8 @@ file(INSTALL
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO KhronosGroup/OpenCL-CLHPP
|
||||
REF 5dd8bb9e32a8e2f72621566b296ac8143a554270
|
||||
SHA512 2909fe2b979b52724ef8d285180d8bfd30bdd56cb79da4effc9e03b576ec7edb5497c99a9fa30541fe63037c84ddef21d4a73e7927f3813baab2a2afeecd55ab
|
||||
REF d62a02090625655e5b2d791d6a58618b043c989c
|
||||
SHA512 837bbe914931d2f18a468f21634dbd4d088eda0a2f22eea23304c0323b9ee064c3ee76db7ebf28ba67fbe07c44129241f8dca62512d89bc7a6b35c2b4b316ed7
|
||||
HEAD_REF master
|
||||
)
|
||||
|
||||
@ -49,8 +56,8 @@ message(STATUS "Generating OpenCL C++ headers done")
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO KhronosGroup/OpenCL-ICD-Loader
|
||||
REF 26a38983cbe5824fd5be03eab8d037758fc44360
|
||||
SHA512 3029f758ff0c39b57aa10d881af68e73532fd179c54063ed1d4529b7d6e27a5219e3c24b7fb5598d790ebcdc2441e00001a963671dc90fef2fc377c76d724f54
|
||||
REF e6e30ab9c7a61c171cf68d2e7f5c0ce28e2a4eae
|
||||
SHA512 f3563c0a4c094d3795d8386ec0db41189d350ab8136d80ae5de611ee3db87fbb0ab851bad2b33e111eddf135add5dbfef77d96979473ca5a23c036608d443378
|
||||
HEAD_REF master
|
||||
)
|
||||
|
||||
@ -58,25 +65,41 @@ vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
OPTIONS
|
||||
-DOPENCL_INCLUDE_DIRS=${CURRENT_PACKAGES_DIR}/include
|
||||
-DOPENCL_ICD_LOADER_HEADERS_DIR=${CURRENT_PACKAGES_DIR}/include
|
||||
-DOPENCL_ICD_LOADER_REQUIRE_WDK=${WITH_WDK}
|
||||
)
|
||||
|
||||
vcpkg_build_cmake(TARGET OpenCL)
|
||||
|
||||
file(INSTALL
|
||||
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/OpenCL.lib"
|
||||
DESTINATION
|
||||
${CURRENT_PACKAGES_DIR}/lib
|
||||
)
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
file(INSTALL
|
||||
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/OpenCL.lib"
|
||||
DESTINATION
|
||||
${CURRENT_PACKAGES_DIR}/lib
|
||||
)
|
||||
|
||||
file(INSTALL
|
||||
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/OpenCL.lib"
|
||||
DESTINATION
|
||||
${CURRENT_PACKAGES_DIR}/debug/lib
|
||||
)
|
||||
endif(VCPKG_TARGET_IS_WINDOWS)
|
||||
if(VCPKG_TARGET_IS_LINUX)
|
||||
file(INSTALL
|
||||
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/libOpenCL.a"
|
||||
DESTINATION
|
||||
${CURRENT_PACKAGES_DIR}/lib
|
||||
)
|
||||
|
||||
file(INSTALL
|
||||
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/libOpenCL.a"
|
||||
DESTINATION
|
||||
${CURRENT_PACKAGES_DIR}/debug/lib
|
||||
)
|
||||
endif(VCPKG_TARGET_IS_LINUX)
|
||||
|
||||
file(INSTALL
|
||||
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/OpenCL.lib"
|
||||
DESTINATION
|
||||
${CURRENT_PACKAGES_DIR}/debug/lib
|
||||
)
|
||||
|
||||
file(INSTALL
|
||||
"${SOURCE_PATH}/LICENSE.txt"
|
||||
"${SOURCE_PATH}/LICENSE"
|
||||
DESTINATION
|
||||
${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright
|
||||
)
|
||||
@ -85,3 +108,9 @@ file(COPY
|
||||
DESTINATION
|
||||
${CURRENT_PACKAGES_DIR}/share/${PORT}
|
||||
)
|
||||
|
||||
file(COPY
|
||||
${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake
|
||||
DESTINATION
|
||||
${CURRENT_PACKAGES_DIR}/share/${PORT}
|
||||
)
|
||||
|
@ -1,7 +1,16 @@
|
||||
The package opencl is compatible with built-in CMake targets:
|
||||
The package opencl is compatible with built-in CMake targets via CMake v3.6 and prior syntax
|
||||
|
||||
find_package(OpenCL REQUIRED)
|
||||
target_link_libraries(main PRIVATE ${OpenCL_LIBRARIES})
|
||||
target_include_directories(main PRIVATE ${OpenCL_INCLUDE_DIRS})
|
||||
|
||||
You will also need to install an appropriate driver package from your CPU/GPU manufacturer.
|
||||
and the CMake v3.7 and beyond imported target syntax
|
||||
|
||||
find_package(OpenCL REQUIRED)
|
||||
target_link_libraries(main PRIVATE OpenCL::OpenCL)
|
||||
|
||||
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.
|
||||
LINUX: implementations may be installed from your distro's repo or manually. There are too many to count.
|
||||
APPLE: consult your distribution vendor on the state of OpenCL support: https://support.apple.com/en-us/HT202823
|
||||
|
15
ports/opencl/vcpkg-cmake-wrapper.cmake
Normal file
15
ports/opencl/vcpkg-cmake-wrapper.cmake
Normal file
@ -0,0 +1,15 @@
|
||||
_find_package(${ARGS})
|
||||
if(NOT BUILD_SHARED_LIBS 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)
|
||||
endif(CMAKE_SYSTEM_NAME MATCHES "Windows")
|
||||
|
||||
if(TARGET OpenCL::OpenCL)
|
||||
set_property(TARGET OpenCL::OpenCL APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${OpenCL_Extra_Libs})
|
||||
endif()
|
||||
if(OpenCL_LIBRARIES)
|
||||
list(APPEND OpenCL_LIBRARIES ${OpenCL_Extra_Libs})
|
||||
endif()
|
||||
endif()
|
24
ports/opengl/usage
Normal file
24
ports/opengl/usage
Normal file
@ -0,0 +1,24 @@
|
||||
The package opengl is compatible with built-in CMake targets via CMake v3.7 and prior syntax
|
||||
|
||||
find_package(OpenGL REQUIRED)
|
||||
target_link_libraries(main PRIVATE ${OPENGL_LIBRARIES})
|
||||
target_include_directories(main PRIVATE ${OPENGL_INCLUDE_DIR})
|
||||
|
||||
and the CMake v3.8 and beyond imported target syntax
|
||||
|
||||
find_package(OpenGL REQUIRED)
|
||||
target_link_libraries(main PRIVATE OpenGL::GL)
|
||||
|
||||
introduction of various components
|
||||
|
||||
find_package(OpenGL REQUIRED COMPONENTS GL # v3.8
|
||||
GLU # v3.8
|
||||
GLX # v3.10
|
||||
EGL # v3.10
|
||||
OpenGL) # v3.10
|
||||
|
||||
The OpenGL SDK is highly platform dependent and is usually an OS component. It's not realistic to build from source for every platform.
|
||||
|
||||
WINDOWS: is part of the Windows SDK which this package installs.
|
||||
LINUX: the SDK may be installed from your distro's repo or from 3rd parties manually. There are too many to count.
|
||||
APPLE: consult your distribution vendor on the state of OpenGL support: https://support.apple.com/en-us/HT202823
|
Loading…
Reference in New Issue
Block a user