Skip to content

Commit

Permalink
Rename CMake package to ROCmCMakeBuildTools (ROCm#151)
Browse files Browse the repository at this point in the history
For discussion, see: Rename CMake package to ROCmCMakeBuildTools (ROCm#128).

Having the name of this CMake package be ROCM is consistently confusing to users who expect find_package(ROCM [...]) to add ROCm packages to their build, instead of tools that we use to build ROCm (see ROCm#49). Renaming the CMake project to ROCmCMakeBuildTools makes the purpose of this package clearer.

In order to have as smooth a transition as possible, starting this as a notice, will make into a deprecation/warning in ~6.2, error sometime later, remove in 7.0.
  • Loading branch information
lawruble13 committed Oct 11, 2023
1 parent 5a34e72 commit e6695c3
Show file tree
Hide file tree
Showing 42 changed files with 144 additions and 38 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## [rocm-cmake 0.11.0 for ROCm 6.0.0]
### Changed
- ROCMSphinxDoc: Improved validation, documentation and rocm-docs-core integration.
- Rename CMake package to ROCmCMakeBuildTools
### Fixed
- ROCMClangTidy: Fixed extra make flags passed for clang tidy.
- ROCMTest: Fixed issues when using module in a subdirectory.
Expand Down
10 changes: 6 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,21 @@ set(CMAKE_INSTALL_PREFIX "/opt/rocm" CACHE PATH "")
project(rocm-cmake LANGUAGES NONE)

install(DIRECTORY share DESTINATION .)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ROCMConfigVersion.cmake DESTINATION share/rocm/cmake)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/ROCmCMakeBuildToolsConfigVersion.cmake
DESTINATION share/rocmcmakebuildtools/cmake
)

set(CPACK_RPM_PACKAGE_LICENSE "MIT")

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/share/rocm/cmake)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/share/rocmcmakebuildtools/cmake)
include(ROCMCreatePackage)
include(ROCMSetupVersion)

rocm_setup_version(VERSION 0.11.0)

include(CMakePackageConfigHelpers)
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/ROCMConfigVersion.cmake
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/ROCmCMakeBuildToolsConfigVersion.cmake
COMPATIBILITY SameMajorVersion)

rocm_create_package(
Expand All @@ -41,4 +44,3 @@ enable_testing()
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C ${CMAKE_CFG_INTDIR})
add_subdirectory(test)
add_subdirectory(doc)

5 changes: 2 additions & 3 deletions share/rocm/cmake/ROCMConfig.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# ######################################################################################################################
# Copyright (C) 2017 Advanced Micro Devices, Inc.
# Copyright (C) 2023 Advanced Micro Devices, Inc.
# ######################################################################################################################

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
include(ROCMChecks)
find_package(ROCmCMakeBuildTools HINTS "${CMAKE_CURRENT_LIST_DIR}")
7 changes: 7 additions & 0 deletions share/rocm/cmake/ROCMConfigVersion.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# ######################################################################################################################
# Copyright (C) 2023 Advanced Micro Devices, Inc.
# ######################################################################################################################

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../rocmcmakebuildtools/cmake)

include(ROCmCMakeBuildToolsConfigVersion)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# ######################################################################################################################
# Copyright (C) 2017 Advanced Micro Devices, Inc.
# ######################################################################################################################

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
include(ROCMChecks)
File renamed without changes.
8 changes: 4 additions & 4 deletions test/analyze/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
cmake_minimum_required (VERSION 3.5)
project(simple LANGUAGES CXX)

find_package(ROCM)
find_package(ROCmCMakeBuildTools)

include(ROCMInstallTargets)
include(ROCMAnalyzers)
Expand All @@ -15,7 +15,7 @@ include(ROCMSetupVersion)
include(ROCMClangTidy)
rocm_enable_clang_tidy(
DEV_WARNINGS_AS_ERRORS
CHECKS
CHECKS
*
-llvmlibc-*
ERRORS
Expand All @@ -26,10 +26,10 @@ rocm_enable_clang_tidy(
include(ROCMCppCheck)
rocm_enable_cppcheck(
INCONCLUSIVE
CHECKS
CHECKS
warning
FORCE
SUPPRESS
SUPPRESS
unmatchedSuppression
SOURCES
simple.cpp
Expand Down
2 changes: 1 addition & 1 deletion test/docsphinx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ project(useful LANGUAGES CXX)
# Ideally should be NONE, but GNUInstallDirs detects platform arch using try_compile
# https://stackoverflow.com/questions/43379311/why-does-project-affect-cmakes-opinion-on-cmake-sizeof-void-p

find_package(ROCM)
find_package(ROCmCMakeBuildTools)

include(ROCMSphinxDoc)
include(GNUInstallDirs)
Expand Down
2 changes: 1 addition & 1 deletion test/libbasic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
cmake_minimum_required (VERSION 3.5)
project(basic CXX)

find_package(ROCM)
find_package(ROCmCMakeBuildTools)
find_package(simple)

include(ROCMInstallTargets)
Expand Down
20 changes: 10 additions & 10 deletions test/libheaderonly/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
cmake_minimum_required (VERSION 3.5)
project(headeronly LANGUAGES NONE)

find_package(ROCM)
find_package(ROCmCMakeBuildTools)

include(ROCMInstallTargets)
include(ROCMPackageConfigHelpers)
Expand All @@ -18,15 +18,15 @@ rocm_setup_version(VERSION 1.0.0)

if(ROCM_PREFIX)
rocm_create_package(
NAME headeronly
NAME headeronly
PREFIX ${ROCM_PREFIX}
MAINTAINER "Amd amd@amd.com"
PTH
LDCONFIG
HEADER_ONLY)
else()
rocm_create_package(
NAME headeronly
NAME headeronly
MAINTAINER "Amd amd@amd.com"
PTH
LDCONFIG
Expand All @@ -38,15 +38,15 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)

add_library(headeronly INTERFACE)
target_include_directories(headeronly
INTERFACE
target_include_directories(headeronly
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:headeronly/include/>)

if(ROCM_PREFIX)
rocm_install_targets(
TARGETS headeronly
INCLUDE include
TARGETS headeronly
INCLUDE include
PREFIX ${ROCM_PREFIX})
rocm_install(
DIRECTORY
Expand All @@ -58,8 +58,8 @@ if(ROCM_PREFIX)
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ
)
rocm_export_targets(
TARGETS headeronly
INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/importtarget.cmake
TARGETS headeronly
INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/importtarget.cmake
PREFIX ${ROCM_PREFIX})
rocm_install_symlink_subdir(${ROCM_PREFIX})
else()
Expand All @@ -76,6 +76,6 @@ else()
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ
)
rocm_export_targets(
TARGETS headeronly
TARGETS headeronly
INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/importtarget.cmake)
endif()
6 changes: 3 additions & 3 deletions test/libsimple/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
cmake_minimum_required (VERSION 3.5)
project(simple CXX)

find_package(ROCM)
find_package(ROCmCMakeBuildTools)

include(ROCMInstallTargets)
include(ROCMPackageConfigHelpers)
Expand All @@ -18,14 +18,14 @@ rocm_setup_version(VERSION 1.0.0)

if(ROCM_PREFIX)
rocm_create_package(
NAME simple
NAME simple
PREFIX ${ROCM_PREFIX}
MAINTAINER "Amd amd@amd.com"
PTH
LDCONFIG)
else()
rocm_create_package(
NAME simple
NAME simple
MAINTAINER "Amd amd@amd.com"
PTH
LDCONFIG)
Expand Down
6 changes: 3 additions & 3 deletions test/libsimple2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
cmake_minimum_required (VERSION 3.5)
project(simple2 CXX)

find_package(ROCM)
find_package(ROCmCMakeBuildTools)

include(ROCMInstallTargets)
include(ROCMPackageConfigHelpers)
Expand All @@ -20,13 +20,13 @@ rocm_setup_version(VERSION 1.0.0)

if(ROCM_PREFIX)
rocm_create_package(
NAME simple2
NAME simple2
PREFIX ${ROCM_PREFIX}
MAINTAINER "Amd amd@amd.com"
LDCONFIG)
else()
rocm_create_package(
NAME simple2
NAME simple2
MAINTAINER "Amd amd@amd.com"
LDCONFIG)
endif()
Expand Down
51 changes: 51 additions & 0 deletions test/libsimplecompat/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
################################################################################
# Copyright (C) 2017 Advanced Micro Devices, Inc.
################################################################################


cmake_minimum_required (VERSION 3.5)
project(simple CXX)

find_package(ROCM)

include(ROCMInstallTargets)
include(ROCMPackageConfigHelpers)
include(ROCMSetupVersion)
include(ROCMInstallSymlinks)
include(ROCMCreatePackage)

rocm_setup_version(VERSION 1.0.0)

if(ROCM_PREFIX)
rocm_create_package(
NAME simple
PREFIX ${ROCM_PREFIX}
MAINTAINER "Amd amd@amd.com"
PTH
LDCONFIG)
else()
rocm_create_package(
NAME simple
MAINTAINER "Amd amd@amd.com"
PTH
LDCONFIG)
endif()

set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)

add_library(simple simple.cpp)
rocm_set_soversion(simple 1.1.2)

add_executable(simple-main main.cpp)
target_link_libraries(simple-main simple)

if(ROCM_PREFIX)
rocm_install_targets(TARGETS simple simple-main INCLUDE include PREFIX ${ROCM_PREFIX})
rocm_export_targets(TARGETS simple INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/importtarget.cmake PREFIX ${ROCM_PREFIX})
rocm_install_symlink_subdir(${ROCM_PREFIX})
else()
rocm_install_targets(TARGETS simple simple-main INCLUDE include)
rocm_export_targets(TARGETS simple INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/importtarget.cmake)
endif()
3 changes: 3 additions & 0 deletions test/libsimplecompat/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This is a placeholder license file for the purposes of testing, and is not the license for this repository or the files
contained in this directory. The license for rocm-cmake (including all files in this directory) can be located at
"https://github.com/RadeonOpenCompute/rocm-cmake/blob/master/LICENSE".
3 changes: 3 additions & 0 deletions test/libsimplecompat/importtarget.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# ######################################################################################################################
# Copyright (C) 2017 Advanced Micro Devices, Inc.
# ######################################################################################################################
12 changes: 12 additions & 0 deletions test/libsimplecompat/include/simple.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*******************************************************************************
* Copyright (C) 2017 Advanced Micro Devices, Inc.
******************************************************************************/


#ifndef GUARD_SIMPLE_H
#define GUARD_SIMPLE_H

void simple();


#endif
6 changes: 6 additions & 0 deletions test/libsimplecompat/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

void simple();

int main() {
simple();
}
7 changes: 7 additions & 0 deletions test/libsimplecompat/simple.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*******************************************************************************
* Copyright (C) 2017 Advanced Micro Devices, Inc.
******************************************************************************/


void simple()
{}
4 changes: 2 additions & 2 deletions test/libsimpletest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
cmake_minimum_required (VERSION 3.5)
project(simple CXX)

find_package(ROCM)
find_package(ROCmCMakeBuildTools)

include(ROCMInstallTargets)
include(ROCMPackageConfigHelpers)
Expand All @@ -20,7 +20,7 @@ rocm_setup_version(VERSION 1.0.0)
rocm_enable_test_package(simple)

rocm_create_package(
NAME simple
NAME simple
MAINTAINER "Amd amd@amd.com"
PTH
LDCONFIG)
Expand Down
6 changes: 3 additions & 3 deletions test/libwrapper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
cmake_minimum_required (VERSION 3.5)
project(test-wrapper CXX)

find_package(ROCM)
find_package(ROCmCMakeBuildTools)

include(ROCMInstallTargets)
include(ROCMPackageConfigHelpers)
Expand All @@ -19,14 +19,14 @@ rocm_setup_version(VERSION 1.0.0)

if(ROCM_PREFIX)
rocm_create_package(
NAME wrapper
NAME wrapper
PREFIX ${ROCM_PREFIX}
MAINTAINER "Amd amd@amd.com"
PTH
LDCONFIG)
else()
rocm_create_package(
NAME wrapper
NAME wrapper
MAINTAINER "Amd amd@amd.com"
PTH
LDCONFIG)
Expand Down
9 changes: 9 additions & 0 deletions test/pass/rename-compatibility.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# ######################################################################################################################
# Copyright (C) 2023 Advanced Micro Devices, Inc.
# ######################################################################################################################

install_dir(${TEST_DIR}/libsimplecompat TARGETS package)
test_check_package(
NAME simple
HEADER simple.h
TARGET simple)
2 changes: 1 addition & 1 deletion test/test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ macro(test_exec)
endmacro()

macro(use_rocm_cmake)
list(APPEND CMAKE_MODULE_PATH ${PREFIX}/share/rocm/cmake)
list(APPEND CMAKE_MODULE_PATH ${PREFIX}/share/rocmcmakebuildtools/cmake)
endmacro()

function(configure_dir DIR)
Expand Down
2 changes: 1 addition & 1 deletion test/toolchain-var/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


cmake_minimum_required (VERSION 3.5)
find_package(ROCM)
find_package(ROCmCMakeBuildTools)
project(toolchain-var CXX)

if(CHANGE_TOOLCHAIN)
Expand Down
Loading

0 comments on commit e6695c3

Please sign in to comment.