Add OpenCL SDK and clMath ports (#2837)

* initial clFFT porting

* OpenCL SDK half baked

* Tried fixing Debug/Release

* Remove DLL deployment

* OpenCL SDK installs

* clFFT installs

* clFFT properly depends on OpenCL

* OpenCL SDK fixes and clFFT patches

* [clfft][opencl] Simplification, use patches instead of full files.
This commit is contained in:
Nagy-Egri Máté Ferenc 2018-03-01 17:08:53 +01:00 committed by Robert Schumacher
parent 1fb3785bee
commit b21c895ca5
6 changed files with 169 additions and 0 deletions

4
ports/clfft/CONTROL Normal file
View File

@ -0,0 +1,4 @@
Source: clfft
Version: 2.12.2
Build-Depends: opencl
Description: clFFT is an OpenCL 1.2 accelerated Fast Fourier Transform library.

View File

@ -0,0 +1,37 @@
include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO clMathLibraries/clFFT
REF v2.12.2
SHA512 19e9a4e06f76ae7c7808d1188677d5553c43598886a75328b7801ab2ca68e35206839a58fe2f958a44a6f7c83284dc9461cd0e21c37d1042bf82e24aad066be8
HEAD_REF master
)
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES ${CMAKE_CURRENT_LIST_DIR}/tweak-install.patch
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}/src
PREFER_NINJA
OPTIONS
-DBUILD_LOADLIBRARIES=OFF
-DBUILD_EXAMPLES=OFF
-DSUFFIX_LIB=
)
vcpkg_install_cmake()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(INSTALL
"${SOURCE_PATH}/LICENSE"
DESTINATION
${CURRENT_PACKAGES_DIR}/share/clfft/copyright
)
vcpkg_fixup_cmake_targets(CONFIG_PATH "CMake")
vcpkg_copy_pdbs()

View File

@ -0,0 +1,28 @@
diff --git a/src/clFFTConfig.cmake.in b/src/clFFTConfig.cmake.in
index 5b58c35..ee749a2 100644
--- a/src/clFFTConfig.cmake.in
+++ b/src/clFFTConfig.cmake.in
@@ -1,3 +1,3 @@
include(${CMAKE_CURRENT_LIST_DIR}/clFFTTargets.cmake)
-get_filename_component(CLFFT_INCLUDE_DIRS ${CMAKE_CURRENT_LIST_DIR}/@reldir@/include ABSOLUTE)
+get_filename_component(CLFFT_INCLUDE_DIRS ${CMAKE_CURRENT_LIST_DIR}/@reldir@/../include ABSOLUTE)
set(CLFFT_LIBRARIES clFFT)
diff --git a/src/library/CMakeLists.txt b/src/library/CMakeLists.txt
index 132ef86..12ba905 100644
--- a/src/library/CMakeLists.txt
+++ b/src/library/CMakeLists.txt
@@ -90,6 +90,7 @@ target_link_libraries( clFFT ${OPENCL_LIBRARIES} ${CMAKE_DL_LIBS} )
set_target_properties( clFFT PROPERTIES VERSION ${CLFFT_VERSION} )
set_target_properties( clFFT PROPERTIES SOVERSION ${CLFFT_SOVERSION} )
set_target_properties( clFFT PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/staging" )
+set_target_properties( clFFT PROPERTIES INTERFACE_INCLUDE_DIRECTORIES $<INSTALL_INTERFACE:include> )
if( CMAKE_COMPILER_IS_GNUCC )
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/clFFT.pc.in
@@ -104,5 +105,5 @@ install( TARGETS clFFT
EXPORT Library
RUNTIME DESTINATION bin${SUFFIX_BIN}
LIBRARY DESTINATION lib${SUFFIX_LIB}
- ARCHIVE DESTINATION lib${SUFFIX_LIB}/import
+ ARCHIVE DESTINATION lib${SUFFIX_LIB}
)

3
ports/opencl/CONTROL Normal file
View File

@ -0,0 +1,3 @@
Source: opencl
Version: 2.2 (2017.07.18)
Description: C/C++ headers and ICD loader (Installable Client Driver) for OpenCL

View File

@ -0,0 +1,90 @@
include(vcpkg_common_functions)
# OpenCL C headers
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO KhronosGroup/OpenCL-Headers
REF f039db6764d52388658ef15c30b2237bbda49803
SHA512 5909a85f96477d731059528303435f06255e98ed8df9d4cd2b62c744b5fe41408c69c0d4068421a2813eb9ad9d70d7f1bace9ebf0db19cc09e71bb8066127c5f
HEAD_REF master
)
file(INSTALL
"${SOURCE_PATH}/opencl22/CL"
DESTINATION
${CURRENT_PACKAGES_DIR}/include
)
# OpenCL C++ headers
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO KhronosGroup/OpenCL-CLHPP
REF 5dd8bb9e32a8e2f72621566b296ac8143a554270
SHA512 2909fe2b979b52724ef8d285180d8bfd30bdd56cb79da4effc9e03b576ec7edb5497c99a9fa30541fe63037c84ddef21d4a73e7927f3813baab2a2afeecd55ab
HEAD_REF master
)
vcpkg_find_acquire_program(PYTHON3)
vcpkg_execute_required_process(
COMMAND "${PYTHON3}" "${SOURCE_PATH}/gen_cl_hpp.py"
-i ${SOURCE_PATH}/input_cl.hpp
-o ${CURRENT_PACKAGES_DIR}/include/CL/cl.hpp
WORKING_DIRECTORY ${SOURCE_PATH}
LOGNAME generate_clhpp-${TARGET_TRIPLET}
)
vcpkg_execute_required_process(
COMMAND "${PYTHON3}" "${SOURCE_PATH}/gen_cl_hpp.py"
-i ${SOURCE_PATH}/input_cl2.hpp
-o ${CURRENT_PACKAGES_DIR}/include/CL/cl2.hpp
WORKING_DIRECTORY ${SOURCE_PATH}
LOGNAME generate_cl2hpp-${TARGET_TRIPLET}
)
message(STATUS "Generating OpenCL C++ headers done")
# OpenCL ICD loader
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO KhronosGroup/OpenCL-ICD-Loader
REF 26a38983cbe5824fd5be03eab8d037758fc44360
SHA512 3029f758ff0c39b57aa10d881af68e73532fd179c54063ed1d4529b7d6e27a5219e3c24b7fb5598d790ebcdc2441e00001a963671dc90fef2fc377c76d724f54
HEAD_REF master
)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
message(STATUS "Building the ICD loader as a static library is not supported. Building as DLLs instead.")
set(VCPKG_LIBRARY_LINKAGE "dynamic")
endif()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DOPENCL_INCLUDE_DIRS=${CURRENT_PACKAGES_DIR}/include
)
vcpkg_build_cmake(TARGET OpenCL)
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
)
file(INSTALL
"${SOURCE_PATH}/LICENSE.txt"
DESTINATION
${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright
)
file(COPY
${CMAKE_CURRENT_LIST_DIR}/usage
DESTINATION
${CURRENT_PACKAGES_DIR}/share/${PORT}
)

7
ports/opencl/usage Normal file
View File

@ -0,0 +1,7 @@
The package opencl is compatible with built-in CMake targets:
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.