From bbd2edcca32e1e449cc933de44dac3295a878ea1 Mon Sep 17 00:00:00 2001 From: "Ramakrishnan, Ranjith" Date: Tue, 6 May 2025 08:43:03 -0700 Subject: [PATCH] Remove the backward compatibility code for file reorganization (#14) Remove the backward compatibilty code for file reorganization File reorg backward compatibility support is no longer required [ROCm/rocm-core commit: 33d87ba25dd2e85dedbf102eaa400ceffd0e5aa7] --- projects/rocm-core/CMakeLists.txt | 26 -------- projects/rocm-core/header_template.hpp.in | 48 -------------- .../rocm-core/rocm-core-backward-compat.cmake | 63 ------------------- 3 files changed, 137 deletions(-) delete mode 100644 projects/rocm-core/header_template.hpp.in delete mode 100644 projects/rocm-core/rocm-core-backward-compat.cmake diff --git a/projects/rocm-core/CMakeLists.txt b/projects/rocm-core/CMakeLists.txt index 699e8a719e..991170d88f 100644 --- a/projects/rocm-core/CMakeLists.txt +++ b/projects/rocm-core/CMakeLists.txt @@ -51,10 +51,6 @@ set( CPACK_GENERATOR "TGZ;DEB;RPM" CACHE STRING "package types to be produced " set( COPYRIGHT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/copyright" ) set( BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR} ) -if(NOT ENABLE_ASAN_PACKAGING) - option(FILE_REORG_BACKWARD_COMPATIBILITY "Enable File Reorg with backward compatibility" OFF) -endif() - ## Set variables set_variables() @@ -84,28 +80,6 @@ configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/rocm-core.prerm ${BUILD_DIR}/prerm #Generate BUILD_INFO configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/rocm_version.h.in ${BUILD_DIR}/rocm_version.h @ONLY ) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/rocm_getpath.h.in ${BUILD_DIR}/rocm_getpath.h @ONLY ) -#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(rocm-core-backward-compat.cmake) - endif() #FILE_REORG_BACKWARD_COMPATIBILITY -endif() #Make the rocmlib set( SRCS rocm_version.cpp rocm_getpath.cpp) diff --git a/projects/rocm-core/header_template.hpp.in b/projects/rocm-core/header_template.hpp.in deleted file mode 100644 index 0d8c481e90..0000000000 --- a/projects/rocm-core/header_template.hpp.in +++ /dev/null @@ -1,48 +0,0 @@ -/* - MIT License - - Copyright (c) 2017 - 2023 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 @CPACK_PACKAGING_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@/@headerfile_dir@ " -#else /* ROCM_HEADER_WRAPPER_WERROR 0 */ -#if defined(__GNUC__) -#warning "@file_name@ has moved to @CPACK_PACKAGING_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@/@headerfile_dir@ " -#else -#pragma message ("@file_name@ has moved to @CPACK_PACKAGING_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@/@headerfile_dir@ ") -#endif -#endif /* ROCM_HEADER_WRAPPER_WERROR */ - -@include_statements@ - -@hashzero_check@ - -@file_contents@ - -@hash_endif@ - -#endif diff --git a/projects/rocm-core/rocm-core-backward-compat.cmake b/projects/rocm-core/rocm-core-backward-compat.cmake deleted file mode 100644 index e96572e669..0000000000 --- a/projects/rocm-core/rocm-core-backward-compat.cmake +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright (c) 2023 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(ROCM_CORE_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}) -set(ROCM_CORE_WRAPPER_DIR ${ROCM_CORE_BUILD_DIR}/wrapper_dir) -set(ROCM_CORE_WRAPPER_INC_DIR ${ROCM_CORE_WRAPPER_DIR}/include) -set(headerfile_dir "rocm-core") - -#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(${CMAKE_CURRENT_SOURCE_DIR}/header_template.hpp.in ${ROCM_CORE_WRAPPER_INC_DIR}/${file_name}) -endfunction() - -#use header template file and generate wrapper header files -function(generate_wrapper_header) - file(MAKE_DIRECTORY ${ROCM_CORE_WRAPPER_INC_DIR}) - - #find all header files - file(GLOB include_files ${ROCM_CORE_BUILD_DIR}/*.h) - #Create wrapper 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 "ROCM_CORE_WRAPPER_INCLUDE_${INC_GAURD_NAME}_H") - #set #include statement - get_filename_component(file_name ${header_file} NAME) - set(include_statements "#include \"${headerfile_dir}/${file_name}\"\n") - set_file_contents(${header_file}) - endforeach() - -endfunction() - -#Use template header file and generater wrapper header files -generate_wrapper_header() -install(DIRECTORY ${ROCM_CORE_WRAPPER_INC_DIR} DESTINATION . COMPONENT runtime) -