From 7170dba09662efb3b7c1f12d33dd95c9f9d1be04 Mon Sep 17 00:00:00 2001 From: Benda Xu Date: Sat, 29 Jul 2023 14:33:19 +0800 Subject: [PATCH] Revert "cmake: use HIP CONFIG on Windows" This reverts commit 41491c9a70f808ed74690a538ca7bd25ff1ae1ca. By the cmake documentation, Do not write find modules for packages that themselves build with CMake. Instead provide a CMake package configuration file with the package itself. HIP uses cmake to build. It should not have shipped a FindHIP.cmake (a cmake MODULE). A hip-config.cmake (a cmake CONFIG) is enough. We should use CONFIG on both Windows and GNU/Linux. Thus the commit needs to be reverted. Reference: https://cmake.org/cmake/help/latest/command/find_package.html Signed-off-by: Benda Xu --- clients/rider/CMakeLists.txt | 7 +------ clients/samples/CMakeLists.txt | 6 +----- clients/tests/CMakeLists.txt | 6 +----- cmake/dependencies.cmake | 12 ++---------- 4 files changed, 5 insertions(+), 26 deletions(-) diff --git a/clients/rider/CMakeLists.txt b/clients/rider/CMakeLists.txt index ded844e..464e16b 100644 --- a/clients/rider/CMakeLists.txt +++ b/clients/rider/CMakeLists.txt @@ -46,12 +46,7 @@ target_include_directories( hipfft-rider if( NOT CMAKE_CXX_COMPILER MATCHES ".*/hipcc$" ) if( NOT BUILD_WITH_LIB STREQUAL "CUDA" ) - if( WIN32 ) - find_package( HIP CONFIG REQUIRED ) - else() - find_package( HIP MODULE REQUIRED ) - endif() - + find_package( HIP REQUIRED ) target_link_libraries( hipfft-rider PRIVATE hip::host hip::device ) else() target_compile_definitions( hipfft-rider PRIVATE __HIP_PLATFORM_NVIDIA__) diff --git a/clients/samples/CMakeLists.txt b/clients/samples/CMakeLists.txt index 30f2056..7ee1578 100644 --- a/clients/samples/CMakeLists.txt +++ b/clients/samples/CMakeLists.txt @@ -65,11 +65,7 @@ foreach( sample ${sample_list} ) target_compile_options( ${sample} PRIVATE ${WARNING_FLAGS} ) if( NOT CMAKE_CXX_COMPILER MATCHES ".*/hipcc$" ) - if( WIN32 ) - find_package( HIP CONFIG REQUIRED ) - else() - find_package( HIP MODULE REQUIRED ) - endif() + find_package( HIP REQUIRED ) if( NOT BUILD_WITH_LIB STREQUAL "CUDA" ) target_link_libraries( ${sample} PRIVATE hip::host hip::device ) else() diff --git a/clients/tests/CMakeLists.txt b/clients/tests/CMakeLists.txt index bb682b6..43a1ff6 100644 --- a/clients/tests/CMakeLists.txt +++ b/clients/tests/CMakeLists.txt @@ -73,11 +73,7 @@ target_compile_options( hipfft-test PRIVATE ${WARNING_FLAGS} ) if( NOT CMAKE_CXX_COMPILER MATCHES ".*/hipcc$" ) if( NOT BUILD_WITH_LIB STREQUAL "CUDA" ) - if( WIN32 ) - find_package( HIP CONFIG REQUIRED ) - else() - find_package( HIP MODULE REQUIRED ) - endif() + find_package( HIP REQUIRED ) target_link_libraries( hipfft-test PRIVATE hip::host hip::device ) else() target_compile_definitions( hipfft-test PRIVATE __HIP_PLATFORM_NVIDIA__) diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake index 262478d..bc654c0 100644 --- a/cmake/dependencies.cmake +++ b/cmake/dependencies.cmake @@ -27,22 +27,14 @@ find_package(Git REQUIRED) # HIP if( NOT CMAKE_CXX_COMPILER MATCHES ".*/hipcc$" ) if( NOT BUILD_WITH_LIB STREQUAL "CUDA" ) - if( WIN32 ) - find_package( HIP CONFIG REQUIRED ) - else() - find_package( HIP MODULE REQUIRED ) - endif() + find_package( HIP REQUIRED ) list( APPEND HIP_INCLUDE_DIRS "${HIP_ROOT_DIR}/include" ) endif() else() if( BUILD_WITH_LIB STREQUAL "CUDA" ) set(HIP_INCLUDE_DIRS "${HIP_ROOT_DIR}/include") else() - if( WIN32 ) - find_package( HIP CONFIG REQUIRED ) - else() - find_package( HIP MODULE REQUIRED ) - endif() + find_package( HIP REQUIRED ) endif() endif()