diff --git a/opencl/CMakeLists.txt b/opencl/CMakeLists.txt index 619973ee04..b2833f10e9 100644 --- a/opencl/CMakeLists.txt +++ b/opencl/CMakeLists.txt @@ -79,6 +79,12 @@ install(PROGRAMS $ ############################# set(CPACK_PACKAGING_INSTALL_PREFIX "/opt/rocm/opencl" CACHE PATH "Package Installation path for OpenCL") +#ROCM_PATH is needed to create symlink of libraries +if (NOT DEFINED ROCM_PATH ) + string(REPLACE "/opencl" "" ROCM_PATH ${CPACK_PACKAGING_INSTALL_PREFIX}) +endif () +message (STATUS "ROCM Installation path(ROCM_PATH): ${ROCM_PATH}") + # Package: rocm-opencl set(BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/packages/rocm-opencl) configure_file(packaging/rocm-opencl.txt ${BUILD_DIR}/CMakeLists.txt @ONLY) diff --git a/opencl/packaging/rocm-opencl-dev.txt b/opencl/packaging/rocm-opencl-dev.txt index 6f047f0bea..37b7955d8c 100644 --- a/opencl/packaging/rocm-opencl-dev.txt +++ b/opencl/packaging/rocm-opencl-dev.txt @@ -8,7 +8,6 @@ install(DIRECTORY @opencl_SOURCE_DIR@/khronos/headers/opencl2.2/CL PATTERN cl_d3d11.h EXCLUDE PATTERN cl_dx9_media_sharing.h EXCLUDE PATTERN cl_egl.h EXCLUDE) -install(FILES @PROJECT_BINARY_DIR@/khronos/icd/libOpenCL.so DESTINATION lib) ############################# # Packaging steps diff --git a/opencl/packaging/rocm-opencl.postinst b/opencl/packaging/rocm-opencl.postinst index 1026cfadac..b41c6450ea 100644 --- a/opencl/packaging/rocm-opencl.postinst +++ b/opencl/packaging/rocm-opencl.postinst @@ -9,11 +9,18 @@ do_ldconfig() { mkdir -p /etc/OpenCL/vendors && (echo libamdocl64.so > /etc/OpenCL/vendors/amdocl64.icd) } +INSTALL_PATH=@CPACK_PACKAGING_INSTALL_PREFIX@ +ROCM_LIBPATH=@ROCM_PATH@/lib + case "$1" in abort-deconfigure|abort-remove|abort-upgrade) echo "$1" ;; configure) + mkdir -p ${ROCM_LIBPATH} + ln -s -f -r ${INSTALL_PATH}/lib/libOpenCL.so ${ROCM_LIBPATH}/libOpenCL.so + ln -s -f -r ${INSTALL_PATH}/lib/libOpenCL.so.@OPENCL_LIB_VERSION_MAJOR@ ${ROCM_LIBPATH}/libOpenCL.so.@OPENCL_LIB_VERSION_MAJOR@ + ln -s -f -r ${INSTALL_PATH}/lib/libOpenCL.so.@OPENCL_LIB_VERSION_STRING@ ${ROCM_LIBPATH}/libOpenCL.so.@OPENCL_LIB_VERSION_STRING@ do_ldconfig ;; *) diff --git a/opencl/packaging/rocm-opencl.prerm b/opencl/packaging/rocm-opencl.prerm index fe887671db..3e85a50fe8 100644 --- a/opencl/packaging/rocm-opencl.prerm +++ b/opencl/packaging/rocm-opencl.prerm @@ -11,6 +11,11 @@ case "$1" in purge) ;; remove) + rm -f @ROCM_PATH@/lib/libOpenCL.so + rm -f @ROCM_PATH@/lib/libOpenCL.so.@OPENCL_LIB_VERSION_MAJOR@ + rm -f @ROCM_PATH@/lib/libOpenCL.so.@OPENCL_LIB_VERSION_STRING@ + rmdir --ignore-fail-on-non-empty @ROCM_PATH@/lib + rmdir --ignore-fail-on-non-empty @ROCM_PATH@ rm_ldconfig ;; *) diff --git a/opencl/packaging/rocm-opencl.rpm_post b/opencl/packaging/rocm-opencl.rpm_post index 3ef90e8d0c..5da6501e1b 100644 --- a/opencl/packaging/rocm-opencl.rpm_post +++ b/opencl/packaging/rocm-opencl.rpm_post @@ -2,3 +2,10 @@ if [ -e "/opt/rocm/opencl" ] ; then echo /opt/rocm/opencl/lib > /etc/ld.so.conf.d/x86_64-rocm-opencl.conf && ldconfig fi mkdir -p /etc/OpenCL/vendors && (echo libamdocl64.so > /etc/OpenCL/vendors/amdocl64.icd) +INSTALL_PATH=@CPACK_PACKAGING_INSTALL_PREFIX@ +ROCM_LIBPATH=@ROCM_PATH@/lib + +mkdir -p ${ROCM_LIBPATH} +ln -s -f -r ${INSTALL_PATH}/lib/libOpenCL.so ${ROCM_LIBPATH}/libOpenCL.so +ln -s -f -r ${INSTALL_PATH}/lib/libOpenCL.so.@OPENCL_LIB_VERSION_MAJOR@ ${ROCM_LIBPATH}/libOpenCL.so.@OPENCL_LIB_VERSION_MAJOR@ +ln -s -f -r ${INSTALL_PATH}/lib/libOpenCL.so.@OPENCL_LIB_VERSION_STRING@ ${ROCM_LIBPATH}/libOpenCL.so.@OPENCL_LIB_VERSION_STRING@ diff --git a/opencl/packaging/rocm-opencl.rpm_postun b/opencl/packaging/rocm-opencl.rpm_postun index cd20887bf9..7a595f7878 100644 --- a/opencl/packaging/rocm-opencl.rpm_postun +++ b/opencl/packaging/rocm-opencl.rpm_postun @@ -1,4 +1,11 @@ if [ $1 -eq 0 ]; then rm -f /etc/ld.so.conf.d/x86_64-rocm-opencl.conf && ldconfig rm -f /etc/OpenCL/vendors/amdocl64.icd + rm -f @ROCM_PATH@/lib/libOpenCL.so + rm -f @ROCM_PATH@/lib/libOpenCL.so.@OPENCL_LIB_VERSION_MAJOR@ + rm -f @ROCM_PATH@/lib/libOpenCL.so.@OPENCL_LIB_VERSION_STRING@ + rmdir --ignore-fail-on-non-empty @ROCM_PATH@/lib + rmdir --ignore-fail-on-non-empty @ROCM_PATH@ fi + + diff --git a/opencl/packaging/rocm-opencl.txt b/opencl/packaging/rocm-opencl.txt index 3047e719c1..aeb9c9e5ad 100644 --- a/opencl/packaging/rocm-opencl.txt +++ b/opencl/packaging/rocm-opencl.txt @@ -3,6 +3,7 @@ project(rocm-opencl) install(DIRECTORY @PROJECT_BINARY_DIR@/bin DESTINATION . USE_SOURCE_PERMISSIONS) install(FILES @PROJECT_BINARY_DIR@/lib/libamdocl64.so DESTINATION lib) +install(FILES @PROJECT_BINARY_DIR@/khronos/icd/libOpenCL.so DESTINATION lib) install(FILES @PROJECT_BINARY_DIR@/khronos/icd/libOpenCL.so.@OPENCL_LIB_VERSION_MAJOR@ DESTINATION lib) install(FILES @PROJECT_BINARY_DIR@/khronos/icd/libOpenCL.so.@OPENCL_LIB_VERSION_STRING@ DESTINATION lib)