diff --git a/projects/clr/hipamd/CMakeLists.txt b/projects/clr/hipamd/CMakeLists.txt index 9cf5d73f5c..7da51f1f2b 100755 --- a/projects/clr/hipamd/CMakeLists.txt +++ b/projects/clr/hipamd/CMakeLists.txt @@ -44,7 +44,6 @@ list(APPEND CMAKE_MODULE_PATH ${HIP_COMMON_DIR}/cmake) ############################# option(__HIP_ENABLE_PCH "Enable/Disable pre-compiled hip headers" ON) option(HIP_OFFICIAL_BUILD "Enable/Disable for mainline/staging builds" OFF) -option(FILE_REORG_BACKWARD_COMPATIBILITY "Enable File Reorg with backward compatibility" OFF) option(BUILD_SHARED_LIBS "Build the shared library" ON) if(MSVC) @@ -483,26 +482,3 @@ if(HIP_HIPCC_EXECUTABLE) add_dependencies(analyze cppcheck) endif() endif() - -#File reorg Backward compatibility function -if(NOT WIN32) - if(FILE_REORG_BACKWARD_COMPATIBILITY) - # To enabe/disable #error in wrapper header files - if(NOT DEFINED ROCM_HEADER_WRAPPER_WERROR) - if(DEFINED ENV{ROCM_HEADER_WRAPPER_WERROR}) - set(ROCM_HEADER_WRAPPER_WERROR "$ENV{ROCM_HEADER_WRAPPER_WERROR}" - CACHE STRING "Header wrapper warnings as errors.") - else() - set(ROCM_HEADER_WRAPPER_WERROR "OFF" CACHE STRING "Header wrapper warnings as errors.") - endif() - endif() - - if(ROCM_HEADER_WRAPPER_WERROR) - set(deprecated_error 1) - else() - set(deprecated_error 0) - endif() - - include(hip-backward-compat.cmake) - endif() #FILE_REORG_BACKWARD_COMPATIBILITY -endif() diff --git a/projects/clr/hipamd/header_template.hpp.in b/projects/clr/hipamd/header_template.hpp.in deleted file mode 100644 index 79a49a4959..0000000000 --- a/projects/clr/hipamd/header_template.hpp.in +++ /dev/null @@ -1,46 +0,0 @@ -/* - Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved. - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - */ -#ifndef @include_guard@ -#define @include_guard@ - -#ifndef ROCM_HEADER_WRAPPER_WERROR -#define ROCM_HEADER_WRAPPER_WERROR @deprecated_error@ -#endif -#if ROCM_HEADER_WRAPPER_WERROR /* ROCM_HEADER_WRAPPER_WERROR 1 */ -#error "@file_name@ has moved to @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@/@headerfile_dir@ and package include paths have changed. Provide include path as @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@ when using cmake packages." -#else /* ROCM_HEADER_WRAPPER_WERROR 0 */ -#if defined(__GNUC__) -#warning "@file_name@ has moved to @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@/@headerfile_dir@ and package include paths have changed. Provide include path as @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@ when using cmake packages." -#else -#pragma message ("@file_name@ has moved to @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@/@headerfile_dir@ and package include paths have changed. Provide include path as @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@ when using cmake packages.") -#endif -#endif /* ROCM_HEADER_WRAPPER_WERROR */ - -@include_statements@ - -@hashzero_check@ - -@file_contents@ - -@hash_endif@ - -#endif diff --git a/projects/clr/hipamd/hip-backward-compat.cmake b/projects/clr/hipamd/hip-backward-compat.cmake deleted file mode 100644 index a0ef58b4ea..0000000000 --- a/projects/clr/hipamd/hip-backward-compat.cmake +++ /dev/null @@ -1,256 +0,0 @@ -# Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved. -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -cmake_minimum_required(VERSION 3.16.8) - -set(HIP_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}) -set(HIP_WRAPPER_DIR ${HIP_BUILD_DIR}/wrapper_dir) -set(HIP_WRAPPER_INC_DIR ${HIP_WRAPPER_DIR}/include/hip) -set(HIP_WRAPPER_BIN_DIR ${HIP_WRAPPER_DIR}/bin) -set(HIP_WRAPPER_DATA_DIR ${HIP_WRAPPER_DIR}/share) -set(HIP_WRAPPER_LIB_DIR ${HIP_WRAPPER_DIR}/lib) -set(HIP_WRAPPER_CMAKE_DIR ${HIP_WRAPPER_DIR}/cmake) -set(HIP_WRAPPER_FINDHIP_DIR ${HIP_WRAPPER_DIR}/FindHIP) -set(HIP_SRC_INC_DIR ${HIP_SRC_PATH}/include/hip) -set(HIP_SRC_BIN_DIR ${HIP_SRC_PATH}/bin) -set(HIP_INFO_FILE ".hipInfo") -set(HIP_AMD_DETAIL_DIR "amd_detail") -set(HIP_NVIDIA_DETAIL_DIR "nvidia_detail") - -#Function to set actual file contents in wrapper files -#Some components grep for the contents in the file -function(set_file_contents input_file) - set(hashzero_check "#if 0 -/* The following is a copy of the original file for the benefit of build systems which grep for values - * in this file rather than preprocess it. This is just for backward compatibility */") - - file(READ ${input_file} file_contents) - set(hash_endif "#endif") - get_filename_component(file_name ${input_file} NAME) - configure_file(${HIP_SRC_PATH}/header_template.hpp.in ${HIP_WRAPPER_INC_DIR}/${file_name}) -endfunction() - -#use header template file and generate wrapper header files -function(generate_wrapper_header) -#create respecitve folder in /opt/rocm/hip - file(MAKE_DIRECTORY ${HIP_WRAPPER_INC_DIR}/${HIP_AMD_DETAIL_DIR}) - file(MAKE_DIRECTORY ${HIP_WRAPPER_INC_DIR}/${HIP_NVIDIA_DETAIL_DIR}) - - #find all header files from include/hip - file(GLOB include_files ${HIP_BUILD_DIR}/include/hip/*.h) - #Convert the list of files into #includes - foreach(header_file ${include_files}) - # set include guard - get_filename_component(INC_GAURD_NAME ${header_file} NAME_WE) - string(TOUPPER ${INC_GAURD_NAME} INC_GAURD_NAME) - set(include_guard "HIP_WRAPPER_INCLUDE_HIP_${INC_GAURD_NAME}_H") - #set #include statement - get_filename_component(file_name ${header_file} NAME) - set(headerfile_dir "hip") - set(include_statements "#include \"../../../${CMAKE_INSTALL_INCLUDEDIR}/${headerfile_dir}/${file_name}\"\n") - if(${file_name} STREQUAL "hip_version.h") - set_file_contents(${header_file}) - else() - configure_file(${HIP_SRC_PATH}/header_template.hpp.in ${HIP_WRAPPER_INC_DIR}/${file_name}) - endif() - endforeach() - - #find all header files from include/hip/amd_detail - file(GLOB include_files ${HIP_SRC_INC_DIR}/${HIP_AMD_DETAIL_DIR}/*) - #Convert the list of files into #includes - foreach(header_file ${include_files}) - # set include guard - get_filename_component(INC_GAURD_NAME ${header_file} NAME_WE) - string(TOUPPER ${INC_GAURD_NAME} INC_GAURD_NAME) - set(include_guard "HIP_WRAPPER_INCLUDE_HIP_AMD_DETAIL_${INC_GAURD_NAME}_H") - #set #include statement - get_filename_component(file_name ${header_file} NAME) - set(headerfile_dir "hip/${HIP_AMD_DETAIL_DIR}") - set(include_statements "#include \"../../../../${CMAKE_INSTALL_INCLUDEDIR}/${headerfile_dir}/${file_name}\"\n") - - configure_file(${HIP_SRC_PATH}/header_template.hpp.in ${HIP_WRAPPER_INC_DIR}/${HIP_AMD_DETAIL_DIR}/${file_name}) - endforeach() - - #find all header files from include/hip/nvidia_detail - file(GLOB include_files ${HIPNV_DIR}/include/hip/${HIP_NVIDIA_DETAIL_DIR}/*) - #Convert the list of files into #includes - foreach(header_file ${include_files}) - # set include guard - get_filename_component(INC_GAURD_NAME ${header_file} NAME_WE) - string(TOUPPER ${INC_GAURD_NAME} INC_GAURD_NAME) - set(include_guard "HIP_WRAPPER_INCLUDE_HIP_NVIDIA_DETAIL_${INC_GAURD_NAME}_H") - #set #include statement - get_filename_component(file_name ${header_file} NAME) - set(headerfile_dir "hip/${HIP_NVIDIA_DETAIL_DIR}") - set(include_statements "#include \"../../../../${CMAKE_INSTALL_INCLUDEDIR}/${headerfile_dir}/${file_name}\"\n") - - configure_file(${HIP_SRC_PATH}/header_template.hpp.in ${HIP_WRAPPER_INC_DIR}/${HIP_NVIDIA_DETAIL_DIR}/${file_name}) - endforeach() - -endfunction() - -#function to create symlink to binaries -function(create_binary_symlink) - file(MAKE_DIRECTORY ${HIP_WRAPPER_BIN_DIR}) - #get all binaries - file(GLOB binary_files ${HIP_SRC_BIN_DIR}/*) - foreach(binary_file ${binary_files}) - get_filename_component(file_name ${binary_file} NAME) - add_custom_target(link_${file_name} ALL - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND ${CMAKE_COMMAND} -E create_symlink - ../../${CMAKE_INSTALL_BINDIR}/${file_name} ${HIP_WRAPPER_BIN_DIR}/${file_name}) - endforeach() -endfunction() - -#function to create symlink to libraries -function(create_library_symlink) - file(MAKE_DIRECTORY ${HIP_WRAPPER_LIB_DIR}) - if(BUILD_SHARED_LIBS) - set(LIB_AMDHIP "libamdhip64.so") - set(MAJ_VERSION "${HIP_LIB_VERSION_MAJOR}") - set(SO_VERSION "${HIP_LIB_VERSION_STRING}") - set(library_files "${LIB_AMDHIP}" "${LIB_AMDHIP}.${MAJ_VERSION}" "${LIB_AMDHIP}.${SO_VERSION}") - set(LIB_HIPRTC "libhiprtc-builtins.so") - set(library_files "${library_files}" "${LIB_HIPRTC}" "${LIB_HIPRTC}.${MAJ_VERSION}" "${LIB_HIPRTC}.${SO_VERSION}" ) - set(LIB_RTC "libhiprtc.so") - set(library_files "${library_files}" "${LIB_RTC}" "${LIB_RTC}.${MAJ_VERSION}" "${LIB_RTC}.${SO_VERSION}" ) - else() - set(library_files "libamdhip64.a") - endif() - - foreach(file_name ${library_files}) - add_custom_target(link_${file_name} ALL - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND ${CMAKE_COMMAND} -E create_symlink - ../../${CMAKE_INSTALL_LIBDIR}/${file_name} ${HIP_WRAPPER_LIB_DIR}/${file_name}) - endforeach() - #Add symlink for .hipInfo - set(file_name ${HIP_INFO_FILE}) - add_custom_target(link_${file_name} ALL - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND ${CMAKE_COMMAND} -E create_symlink - ../../${CMAKE_INSTALL_LIBDIR}/${file_name} ${HIP_WRAPPER_LIB_DIR}/${file_name}) -endfunction() - -function(create_cmake_symlink) - file(MAKE_DIRECTORY ${HIP_WRAPPER_CMAKE_DIR}/hip) - - #create symlink to all hip config files - file(GLOB config_files ${HIP_BUILD_DIR}/hip-config*) - foreach(config_name ${config_files}) - get_filename_component(file_name ${config_name} NAME) - add_custom_target(link_${file_name} ALL - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND ${CMAKE_COMMAND} -E create_symlink - ../../../../${CMAKE_INSTALL_LIBDIR}/cmake/hip/${file_name} ${HIP_WRAPPER_CMAKE_DIR}/hip/${file_name}) - endforeach() - unset(config_files) - - #create symlink to hip-lang - file(MAKE_DIRECTORY ${HIP_WRAPPER_CMAKE_DIR}/hip-lang) - file(GLOB config_files ${HIP_BUILD_DIR}/src/hip-lang-config*) - foreach(config_name ${config_files}) - get_filename_component(file_name ${config_name} NAME) - add_custom_target(link_${file_name} ALL - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND ${CMAKE_COMMAND} -E create_symlink - ../../../../${CMAKE_INSTALL_LIBDIR}/cmake/hip-lang/${file_name} ${HIP_WRAPPER_CMAKE_DIR}/hip-lang/${file_name}) - endforeach() - unset(config_files) - - #create symlink to hiprtc config files - file(MAKE_DIRECTORY ${HIP_WRAPPER_CMAKE_DIR}/hiprtc) - file(GLOB config_files ${HIP_BUILD_DIR}/hiprtc-config*) - foreach(config_name ${config_files}) - get_filename_component(file_name ${config_name} NAME) - add_custom_target(link_${file_name} ALL - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND ${CMAKE_COMMAND} -E create_symlink - ../../../../${CMAKE_INSTALL_LIBDIR}/cmake/hiprtc/${file_name} ${HIP_WRAPPER_CMAKE_DIR}/hiprtc/${file_name}) - endforeach() - unset(config_files) - - #create symlink to FindHIP - file(MAKE_DIRECTORY ${HIP_WRAPPER_FINDHIP_DIR}/FindHIP) - file(GLOB config_files ${HIP_BUILD_DIR}/cmake/FindHIP/*.cmake) - foreach(config_name ${config_files}) - get_filename_component(file_name ${config_name} NAME) - add_custom_target(link_${file_name} ALL - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND ${CMAKE_COMMAND} -E create_symlink - ../../../${CMAKE_INSTALL_LIBDIR}/cmake/hip/FindHIP/${file_name} ${HIP_WRAPPER_FINDHIP_DIR}/FindHIP/${file_name}) - endforeach() - unset(config_files) - - file(GLOB config_files ${HIP_BUILD_DIR}/cmake/*.cmake) - foreach(config_name ${config_files}) - get_filename_component(file_name ${config_name} NAME) - add_custom_target(link_${file_name} ALL - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND ${CMAKE_COMMAND} -E create_symlink - ../../${CMAKE_INSTALL_LIBDIR}/cmake/hip/${file_name} ${HIP_WRAPPER_FINDHIP_DIR}/${file_name}) - endforeach() - unset(config_files) - -endfunction() - -#Use template header file and generater wrapper header files -generate_wrapper_header() -install(DIRECTORY ${HIP_WRAPPER_INC_DIR} DESTINATION hip/include COMPONENT dev) -# Create symlink to binaries -create_binary_symlink() - -# version file -file(MAKE_DIRECTORY ${HIP_WRAPPER_DATA_DIR} ${HIP_WRAPPER_DATA_DIR}/hip) -add_custom_target(link_version ALL - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND ${CMAKE_COMMAND} -E create_symlink - ../../../share/hip/version ${HIP_WRAPPER_DATA_DIR}/hip/version) - -install(DIRECTORY ${HIP_WRAPPER_DATA_DIR} DESTINATION hip COMPONENT dev) -install(DIRECTORY ${HIP_WRAPPER_BIN_DIR} DESTINATION hip COMPONENT dev) - -option(BUILD_SHARED_LIBS "Build the shared library" ON) -# Create symlink to library files -create_library_symlink() -if(HIP_PLATFORM STREQUAL "amd" ) - if(BUILD_SHARED_LIBS) - install(FILES ${HIP_WRAPPER_LIB_DIR}/libamdhip64.so DESTINATION hip/lib COMPONENT binary) - install(FILES ${HIP_WRAPPER_LIB_DIR}/libamdhip64.so.${HIP_LIB_VERSION_MAJOR} DESTINATION hip/lib COMPONENT binary) - install(FILES ${HIP_WRAPPER_LIB_DIR}/libamdhip64.so.${HIP_LIB_VERSION_STRING} DESTINATION hip/lib COMPONENT binary) - install(FILES ${HIP_WRAPPER_LIB_DIR}/libhiprtc-builtins.so DESTINATION hip/lib COMPONENT binary) - install(FILES ${HIP_WRAPPER_LIB_DIR}/libhiprtc-builtins.so.${HIP_LIB_VERSION_MAJOR} DESTINATION hip/lib COMPONENT binary) - install(FILES ${HIP_WRAPPER_LIB_DIR}/libhiprtc-builtins.so.${HIP_LIB_VERSION_STRING} DESTINATION hip/lib COMPONENT binary) - install(FILES ${HIP_WRAPPER_LIB_DIR}/libhiprtc.so DESTINATION hip/lib COMPONENT binary) - install(FILES ${HIP_WRAPPER_LIB_DIR}/libhiprtc.so.${HIP_LIB_VERSION_MAJOR} DESTINATION hip/lib COMPONENT binary) - install(FILES ${HIP_WRAPPER_LIB_DIR}/libhiprtc.so.${HIP_LIB_VERSION_STRING} DESTINATION hip/lib COMPONENT binary) - - else() - install(FILES ${HIP_WRAPPER_LIB_DIR}/libamdhip64.a DESTINATION hip/lib COMPONENT binary) - endif()#End BUILD_SHARED_LIBS -endif()#End HIP_PLATFORM AMD -#install hipInfo -install(FILES ${HIP_WRAPPER_LIB_DIR}/${HIP_INFO_FILE} DESTINATION hip/lib COMPONENT binary) -#create symlink to cmake files -create_cmake_symlink() -install(DIRECTORY ${HIP_WRAPPER_CMAKE_DIR}/hip-lang DESTINATION hip/lib/cmake COMPONENT binary) -install(DIRECTORY ${HIP_WRAPPER_CMAKE_DIR}/hiprtc DESTINATION hip/lib/cmake COMPONENT binary) -install(DIRECTORY ${HIP_WRAPPER_CMAKE_DIR}/hip DESTINATION hip/lib/cmake COMPONENT dev) -install(DIRECTORY ${HIP_WRAPPER_FINDHIP_DIR}/ DESTINATION hip/cmake COMPONENT dev) diff --git a/projects/clr/hipamd/packaging/CMakeLists.txt b/projects/clr/hipamd/packaging/CMakeLists.txt index f0f5e041e6..759f09355f 100644 --- a/projects/clr/hipamd/packaging/CMakeLists.txt +++ b/projects/clr/hipamd/packaging/CMakeLists.txt @@ -185,12 +185,6 @@ set(CPACK_DEBIAN_BINARY_PACKAGE_NAME "hip-runtime-amd") set(CPACK_RPM_BINARY_PACKAGE_NAME "hip-runtime-amd") set(CPACK_COMPONENT_BINARY_DESCRIPTION "HIP:Heterogenous-computing Interface for Portability [RUNTIME - AMD]") -if(FILE_REORG_BACKWARD_COMPATIBILITY) -#This is used for softlinking hip-target files - configure_file(hip-runtime-amd.postinst ${CMAKE_CURRENT_BINARY_DIR}/binary/postinst @ONLY) - configure_file(hip-runtime-amd.prerm ${CMAKE_CURRENT_BINARY_DIR}/binary/prerm @ONLY) - set(CPACK_DEBIAN_BINARY_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_BINARY_DIR}/binary/postinst;${CMAKE_CURRENT_BINARY_DIR}/binary/prerm") -endif() # Set Runtime Package dependencies set(HIP_RUNTIME_ROCM_PKG_DEPENDENCIES "hsa-rocr, rocminfo, comgr, rocm-core") # Add rocprofiler-register dependencies @@ -213,10 +207,6 @@ set(CPACK_DEBIAN_BINARY_PACKAGE_PROVIDES "hip-rocclr (= ${CPACK_PACKAGE_VERSION} set(CPACK_DEBIAN_BINARY_PACKAGE_REPLACES "hip-rocclr (= ${CPACK_PACKAGE_VERSION})") set(CPACK_RPM_BINARY_PACKAGE_ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}") -if(FILE_REORG_BACKWARD_COMPATIBILITY) - set(CPACK_RPM_BINARY_POST_INSTALL_SCRIPT_FILE "${CMAKE_CURRENT_BINARY_DIR}/binary/postinst") - set(CPACK_RPM_BINARY_PRE_UNINSTALL_SCRIPT_FILE "${CMAKE_CURRENT_BINARY_DIR}/binary/prerm") -endif() string(REPLACE "-" "_" HIP_BASE_VERSION ${CPACK_PACKAGE_VERSION}) if(EL7_DISTRO) diff --git a/projects/clr/opencl/CMakeLists.txt b/projects/clr/opencl/CMakeLists.txt index 407964d7a7..3fe9eeb75b 100644 --- a/projects/clr/opencl/CMakeLists.txt +++ b/projects/clr/opencl/CMakeLists.txt @@ -10,7 +10,6 @@ include(GNUInstallDirs) option(BUILD_TESTS "Enable building OpenCL tests" OFF) option(BUILD_ICD "Enable building OpenCL ICD Loader" OFF) option(EMU_ENV "Enable building for emulation environment" OFF) -option(FILE_REORG_BACKWARD_COMPATIBILITY "Enable File Reorganization backward compatibility" OFF) option(ENABLE_ADDRESS_SANITIZER "Option to enable ASAN build" OFF) # Add flags to generate PDB files with full symbolic information @@ -120,25 +119,4 @@ if(BUILD_ICD) endif() add_subdirectory(packaging) - -#File reorg Backward compatibility function -if(FILE_REORG_BACKWARD_COMPATIBILITY) -# To enable/disable #error in wrapper header files - if(NOT DEFINED ROCM_HEADER_WRAPPER_WERROR) - if(DEFINED ENV{ROCM_HEADER_WRAPPER_WERROR}) - set(ROCM_HEADER_WRAPPER_WERROR "$ENV{ROCM_HEADER_WRAPPER_WERROR}" - CACHE STRING "Header wrapper warnings as errors.") - else() - set(ROCM_HEADER_WRAPPER_WERROR "OFF" CACHE STRING "Header wrapper warnings as errors.") - endif() - endif() - if(ROCM_HEADER_WRAPPER_WERROR) - set(deprecated_error 1) - else() - set(deprecated_error 0) - endif() - - include(opencl-backward-compat.cmake) -endif() - endif() diff --git a/projects/clr/opencl/opencl-backward-compat.cmake b/projects/clr/opencl/opencl-backward-compat.cmake deleted file mode 100644 index fa914bae64..0000000000 --- a/projects/clr/opencl/opencl-backward-compat.cmake +++ /dev/null @@ -1,156 +0,0 @@ -# Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved. -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -cmake_minimum_required(VERSION 3.16.8) - -set(OPENCL ${PROJECT_NAME}) -set(OPENCL_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}) -set(OPENCL_WRAPPER_DIR ${OPENCL_BUILD_DIR}/wrapper_dir) -set(OPENCL_WRAPPER_INC_DIR ${OPENCL_WRAPPER_DIR}/include/CL) -set(OPENCL_WRAPPER_BIN_DIR ${OPENCL_WRAPPER_DIR}/bin) -set(OPENCL_WRAPPER_LIB_DIR ${OPENCL_WRAPPER_DIR}/lib) - -#Function to generate header template file -function(create_header_template) - file(WRITE ${OPENCL_WRAPPER_DIR}/header.hpp.in "/* - Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved. - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the \"Software\"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - */ - -#ifndef @include_guard@ -#define @include_guard@ - -#ifndef ROCM_HEADER_WRAPPER_WERROR -#define ROCM_HEADER_WRAPPER_WERROR @deprecated_error@ -#endif -#if ROCM_HEADER_WRAPPER_WERROR /* ROCM_HEADER_WRAPPER_WERROR 1 */ -#error \"This file is deprecated. Use file from include path /opt/rocm-ver/include/ and prefix with CL\" -#else /* ROCM_HEADER_WRAPPER_WERROR 0 */ -#if defined(__GNUC__) -#warning \"This file is deprecated. Use file from include path /opt/rocm-ver/include/ and prefix with CL\" -#else -#pragma message(\"This file is deprecated. Use file from include path /opt/rocm-ver/include/ and prefix with CL\") -#endif -#endif /* ROCM_HEADER_WRAPPER_WERROR */ - -@include_statements@ - -#endif") -endfunction() - - -#use header template file and generate wrapper header files -function(generate_wrapper_header) - file(MAKE_DIRECTORY ${OPENCL_WRAPPER_INC_DIR}) - set(HEADER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/khronos/headers/opencl2.2/CL ) - #find all header files from CL folder - file(GLOB include_files ${CMAKE_CURRENT_SOURCE_DIR}/khronos/headers/opencl2.2/CL/*) - #remove files that are not required in package - list(REMOVE_ITEM include_files ${HEADER_DIR}/cl_egl.h ${HEADER_DIR}/cl_dx9_media_sharing.h ${HEADER_DIR}/cl_d3d11.h ${HEADER_DIR}/cl_d3d10.h) - #Generate wrapper header files - foreach(header_file ${include_files}) - # set include guard - get_filename_component(INC_GAURD_NAME ${header_file} NAME_WE) - string(TOUPPER ${INC_GAURD_NAME} INC_GAURD_NAME) - set(include_guard "${include_guard}OPENCL_WRAPPER_INCLUDE_${INC_GAURD_NAME}_H") - #set #include statement - get_filename_component(file_name ${header_file} NAME) - set(include_statements "${include_statements}#include \"../../../${CMAKE_INSTALL_INCLUDEDIR}/CL/${file_name}\"\n") - configure_file(${OPENCL_WRAPPER_DIR}/header.hpp.in ${OPENCL_WRAPPER_INC_DIR}/${file_name}) - unset(include_guard) - unset(include_statements) - endforeach() - -endfunction() - -#function to create symlink to binaries -function(create_binary_symlink) - file(MAKE_DIRECTORY ${OPENCL_WRAPPER_BIN_DIR}) - set(file_name "clinfo") - add_custom_target(link_${file_name} ALL - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND ${CMAKE_COMMAND} -E create_symlink - ../../${CMAKE_INSTALL_BINDIR}/${file_name} ${OPENCL_WRAPPER_BIN_DIR}/${file_name}) -endfunction() - -#function to create symlink to libraries -function(create_library_symlink) - if(BUILD_ICD) - file(MAKE_DIRECTORY ${OPENCL_WRAPPER_LIB_DIR}) - set(LIB_OPENCL "libOpenCL.so") - set(MAJ_VERSION "${OPENCL_LIB_VERSION_MAJOR}") - set(SO_VERSION "${OPENCL_LIB_VERSION_STRING}") - set(library_files "${LIB_OPENCL}" "${LIB_OPENCL}.${MAJ_VERSION}" "${LIB_OPENCL}.${SO_VERSION}") - - foreach(file_name ${library_files}) - add_custom_target(link_${file_name} ALL - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND ${CMAKE_COMMAND} -E create_symlink - ../../${CMAKE_INSTALL_LIBDIR}/${file_name} ${OPENCL_WRAPPER_LIB_DIR}/${file_name}) - endforeach() - endif() - if(BUILD_SHARED_LIBS) - set(LIB_AMDDOC "libamdocl64.so") - else() - set(LIB_AMDDOC "libamdocl64.a") - endif() - set(file_name "${LIB_AMDDOC}") - add_custom_target(link_${file_name} ALL - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND ${CMAKE_COMMAND} -E create_symlink - ../../${CMAKE_INSTALL_LIBDIR}/${file_name} ${OPENCL_WRAPPER_DIR}/${file_name}) -endfunction() - -#Creater a template for header file -create_header_template() -#Use template header file and generater wrapper header files -generate_wrapper_header() -install(DIRECTORY ${OPENCL_WRAPPER_INC_DIR} DESTINATION ${OPENCL}/include COMPONENT dev) -# Create symlink to binaries -create_binary_symlink() -install(DIRECTORY ${OPENCL_WRAPPER_BIN_DIR} DESTINATION ${OPENCL} COMPONENT binary) - -option(BUILD_SHARED_LIBS "Build the shared library" ON) -# Create symlink to libraries -create_library_symlink() -if(BUILD_ICD) - install(DIRECTORY ${OPENCL_WRAPPER_LIB_DIR} DESTINATION ${OPENCL} COMPONENT icd) -endif() -if(BUILD_SHARED_LIBS) - install(FILES ${OPENCL_WRAPPER_DIR}/libamdocl64.so DESTINATION ${OPENCL}/lib COMPONENT binary) -else() - install(FILES ${OPENCL_WRAPPER_DIR}/libamdocl64.a DESTINATION ${OPENCL}/lib COMPONENT binary) -endif()