Skip to content

Commit

Permalink
ROCm package file/folder reorganization(SWDEV-291455) (ROCm#176)
Browse files Browse the repository at this point in the history
* Update CMakeLists.txt

* Update CMakeLists.txt

* Update VerifyCompiler.cmake

* Update install

* Update CMakeLists.txt

* Bin Path Reorg - Dep Change
  • Loading branch information
arvindcheru authored Nov 23, 2021
1 parent c44957f commit 912eb91
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 16 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ project(hipcub LANGUAGES CXX)
# CMake modules
list(APPEND CMAKE_MODULE_PATH
${CMAKE_CURRENT_SOURCE_DIR}/cmake
${HIP_PATH}/cmake /opt/rocm/hip/cmake # FindHIP.cmake
${HIP_PATH}/cmake /opt/rocm/lib/cmake/hip # FindHIP.cmake
)

# Set a default build type if none was specified
Expand Down
2 changes: 1 addition & 1 deletion cmake/VerifyCompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

list(APPEND CMAKE_PREFIX_PATH /opt/rocm /opt/rocm/hip)
list(APPEND CMAKE_PREFIX_PATH /opt/rocm)
if(CMAKE_CXX_COMPILER MATCHES ".*/nvcc$" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
find_package(hip QUIET CONFIG PATHS /opt/rocm)
if(NOT hip_FOUND)
Expand Down
12 changes: 3 additions & 9 deletions hipcub/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ target_include_directories(hipcub
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include/hipcub>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:hipcub/include/>
$<INSTALL_INTERFACE:include/>
)

if(HIP_COMPILER STREQUAL "hcc" OR HIP_COMPILER STREQUAL "clang")
Expand Down Expand Up @@ -70,13 +70,12 @@ set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR})
# does not support header-only libraries (INTERFACE targets)
rocm_install_targets(
TARGETS hipcub
PREFIX hipcub
)
rocm_install(
install(
DIRECTORY
"include/"
"${PROJECT_BINARY_DIR}/hipcub/include/"
DESTINATION hipcub/include/
DESTINATION include
FILES_MATCHING
PATTERN "*.h"
PATTERN "*.hpp"
Expand All @@ -89,17 +88,12 @@ include(ROCMExportTargetsHeaderOnly)
if(HIP_COMPILER STREQUAL "hcc" OR HIP_COMPILER STREQUAL "clang")
rocm_export_targets_header_only(
TARGETS hip::hipcub
PREFIX hipcub
DEPENDS PACKAGE rocprim
NAMESPACE hip::
)
else()
rocm_export_targets_header_only(
TARGETS hip::hipcub
PREFIX hipcub
NAMESPACE hip::
)
endif()

# Create symlinks
rocm_install_symlink_subdir(hipcub)
4 changes: 2 additions & 2 deletions install
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ fi
if [[ "${build_relocatable}" == true ]]; then
CXX=$rocm_path/bin/${compiler} ${cmake_executable} \
-DCMAKE_INSTALL_PREFIX=${rocm_path} \
-DCMAKE_PREFIX_PATH="${rocm_path} ${rocm_path}/hcc ${rocm_path}/hip" \
-DCMAKE_MODULE_PATH="${rocm_path}/hip/cmake" \
-DCMAKE_PREFIX_PATH="${rocm_path} ${rocm_path}/hcc" \
-DCMAKE_MODULE_PATH="${rocm_path}/lib/cmake/hip" \
-Drocprim_DIR=${rocm_path}/rocprim \
${cmake_common_options} \
${build_tests} ${build_type} ../../. # or cmake-gui ../.
Expand Down
2 changes: 1 addition & 1 deletion test/extra/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ project(hipCUB_package_install_test CXX)
# CMake modules
list(APPEND CMAKE_MODULE_PATH
${CMAKE_CURRENT_SOURCE_DIR}/../../cmake
${HIP_PATH}/cmake /opt/rocm/hip/cmake # FindHIP.cmake
${HIP_PATH}/cmake /opt/rocm/lib/cmake/hip # FindHIP.cmake
)

# Detect compiler support for target ID
Expand Down
4 changes: 2 additions & 2 deletions toolchain-linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#set(CMAKE_GENERATOR_PLATFORM x64)

if (DEFINED ENV{ROCM_PATH})
set(rocm_bin "$ENV{ROCM_PATH}/hip/bin")
set(rocm_bin "$ENV{ROCM_PATH}/bin")
else()
set(rocm_bin "/opt/rocm/hip/bin")
set(rocm_bin "/opt/rocm/bin")
endif()


Expand Down

0 comments on commit 912eb91

Please sign in to comment.