Skip to content

Commit

Permalink
Revert "cmake: use HIP CONFIG on Windows"
Browse files Browse the repository at this point in the history
This reverts commit 41491c9.

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 <heroxbd@gentoo.org>
  • Loading branch information
Benda Xu committed Jul 29, 2023
1 parent a3168b5 commit 7170dba
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 26 deletions.
7 changes: 1 addition & 6 deletions clients/rider/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down
6 changes: 1 addition & 5 deletions clients/samples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 1 addition & 5 deletions clients/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down
12 changes: 2 additions & 10 deletions cmake/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 7170dba

Please sign in to comment.