From f50f30f4e3e1d1d36c9948875eb55183e378c935 Mon Sep 17 00:00:00 2001 From: Lauren Wrubleski Date: Thu, 13 Mar 2025 15:03:32 -0600 Subject: [PATCH 1/9] Add rocm-core dependency to all generated packages, not just the root one. (#257) --- share/rocmcmakebuildtools/cmake/ROCMCreatePackage.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/share/rocmcmakebuildtools/cmake/ROCMCreatePackage.cmake b/share/rocmcmakebuildtools/cmake/ROCMCreatePackage.cmake index 8e176031..d3fc9d52 100755 --- a/share/rocmcmakebuildtools/cmake/ROCMCreatePackage.cmake +++ b/share/rocmcmakebuildtools/cmake/ROCMCreatePackage.cmake @@ -139,6 +139,11 @@ macro(rocm_package_add_rocm_core_dependency) endif() rocm_join_if_set(", " CPACK_DEBIAN_PACKAGE_DEPENDS ${_rocm_core_pkg}) rocm_join_if_set(", " CPACK_RPM_PACKAGE_REQUIRES ${_rocm_core_pkg}) + foreach(COMPONENT IN LISTS ROCM_PACKAGE_COMPONENTS) + rocm_package_add_dependencies(COMPONENT ${COMPONENT} DEPENDS ${_rocm_core_pkg}) + endforeach() + rocm_package_add_dependencies(COMPONENT runtime DEPENDS ${_rocm_core_pkg}) + rocm_package_add_dependencies(COMPONENT devel DEPENDS ${_rocm_core_pkg}) unset(_rocm_core_pkg) endif() endmacro() From 32bc14114aa4b95a8b8d467bc780884d771318c7 Mon Sep 17 00:00:00 2001 From: Lauren Wrubleski Date: Fri, 14 Mar 2025 13:22:18 -0600 Subject: [PATCH 2/9] Fix handling of generic targets * Fix handling of hyphens in base target ID * Fixup and comment _rocm_sanitize_target_id * Handle empty target feature list --------- Co-authored-by: Cordell Bloor --- .../cmake/ROCMCheckTargetIds.cmake | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/share/rocmcmakebuildtools/cmake/ROCMCheckTargetIds.cmake b/share/rocmcmakebuildtools/cmake/ROCMCheckTargetIds.cmake index 8eaf7ab8..8b71fcb8 100644 --- a/share/rocmcmakebuildtools/cmake/ROCMCheckTargetIds.cmake +++ b/share/rocmcmakebuildtools/cmake/ROCMCheckTargetIds.cmake @@ -33,9 +33,26 @@ function(_rocm_sanitize_target_id TARGET_ID VARIABLE) # CMake defines a preprocessor macro with this value, so it must be a valid C identifier # Handle + and - for xnack and sramecc so that e.g. xnack+ and xnack- doesn't get folded to # the same string by MAKE_C_IDENTIFIER - string(REPLACE "_" "__" TARGET_ID "${TARGET_ID}") - string(REPLACE "+" "_on" TARGET_ID "${TARGET_ID}") - string(REPLACE "-" "_off" TARGET_ID "${TARGET_ID}") + + # Target ID syntax: + # ::== ( ":" ( "+" | "-" ) )* + + # split target id by colon into a list of components + string(REPLACE ":" ";" _components "${TARGET_ID}") + list(GET _components 0 _processor) + list(REMOVE_AT _components 0) + # remove '-' from processor name + string(REPLACE "-" "_" _processor "${_processor}") + if(_components) + # remove '+' or '-' from target features + string(REPLACE "+" "_on" _components "${_components}") + string(REPLACE "-" "_off" _components "${_components}") + # join components with a colon + string(REPLACE ";" ":" TARGET_ID "${_processor}:${_components}") + else() + set(TARGET_ID "${_processor}") + endif() + string(MAKE_C_IDENTIFIER "${TARGET_ID}" TARGET_ID) set(${VARIABLE} "${TARGET_ID}" PARENT_SCOPE) endfunction() From 753c9cd2262b107b9082fdd9f25fecca876a0b6a Mon Sep 17 00:00:00 2001 From: Lauren Wrubleski Date: Thu, 10 Apr 2025 15:13:08 -0600 Subject: [PATCH 3/9] Remove macOS runner (#266) --- .github/workflows/test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6d8e68bb..7d428f32 100755 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,7 +33,6 @@ jobs: matrix: platform: - ubuntu-20.04 - - macos-12 - windows-2019 cmake-version: - 3.20.0 From d0aa73b9118d8ecac13c8e579041a69c49cadc6a Mon Sep 17 00:00:00 2001 From: Lauren Wrubleski Date: Thu, 10 Apr 2025 15:37:48 -0600 Subject: [PATCH 4/9] Update upper end of cmake_minimum_required range (#241) * Update upper end of cmake_minimum_required range CMake 3.31 is dropping support for cmake_minimum_required for versions less than 3.10, but adding 3.25 (which is tested on math-ci) indicates that we test compatibility with 3.25, which causes those warnings to be suppressed. * Add CMake version 3.31.0 to testing * Change CMP0079 behaviour * Update upper end of range to latest version tested (3.31.0) * Update CMake versions in test.yml --- .github/workflows/test.yml | 5 +++-- CMakeLists.txt | 2 +- share/rocmcmakebuildtools/cmake/ROCMTest.cmake | 2 +- test/analyze/CMakeLists.txt | 2 +- test/docsphinx/CMakeLists.txt | 2 +- test/findpackagecheck/CMakeLists.txt | 2 +- test/libbasic/CMakeLists.txt | 2 +- test/libheaderonly/CMakeLists.txt | 2 +- test/libprivate/CMakeLists.txt | 2 +- test/libsimple/CMakeLists.txt | 2 +- test/libsimple2/CMakeLists.txt | 2 +- test/libsimplecompat/CMakeLists.txt | 2 +- test/libsimpletest/CMakeLists.txt | 2 +- test/libwrapper/CMakeLists.txt | 2 +- test/pass/rocm-package-setup-component.cmake | 2 +- test/toolchain-var/CMakeLists.txt | 2 +- test/version/CMakeLists.txt | 2 +- 17 files changed, 19 insertions(+), 18 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7d428f32..ed4059f5 100755 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,8 +35,9 @@ jobs: - ubuntu-20.04 - windows-2019 cmake-version: - - 3.20.0 - - 3.10.2 + - 3.31.0 + - 3.22.1 + - 3.16.3 exclude: - platform: windows-2019 cmake-version: 3.10.2 diff --git a/CMakeLists.txt b/CMakeLists.txt index 4100ac21..11f0e62d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ # Copyright (C) 2017 Advanced Micro Devices, Inc. ################################################################################ -cmake_minimum_required (VERSION 3.6) +cmake_minimum_required (VERSION 3.6...3.31.0) set(CMAKE_INSTALL_PREFIX "/opt/rocm" CACHE PATH "") diff --git a/share/rocmcmakebuildtools/cmake/ROCMTest.cmake b/share/rocmcmakebuildtools/cmake/ROCMTest.cmake index f534ea42..ccaa3a0b 100644 --- a/share/rocmcmakebuildtools/cmake/ROCMTest.cmake +++ b/share/rocmcmakebuildtools/cmake/ROCMTest.cmake @@ -31,7 +31,7 @@ macro(rocm_enable_test_package NAME) endmacro() if(POLICY CMP0079) - cmake_policy(SET CMP0079 OLD) + cmake_policy(SET CMP0079 NEW) endif() add_library(rocm_test_dependencies INTERFACE) diff --git a/test/analyze/CMakeLists.txt b/test/analyze/CMakeLists.txt index 53aeb92b..cfe1b2ba 100755 --- a/test/analyze/CMakeLists.txt +++ b/test/analyze/CMakeLists.txt @@ -3,7 +3,7 @@ ################################################################################ -cmake_minimum_required (VERSION 3.5) +cmake_minimum_required (VERSION 3.5...3.31.0) project(simple LANGUAGES CXX) find_package(ROCmCMakeBuildTools) diff --git a/test/docsphinx/CMakeLists.txt b/test/docsphinx/CMakeLists.txt index c55fe59f..b49aaace 100644 --- a/test/docsphinx/CMakeLists.txt +++ b/test/docsphinx/CMakeLists.txt @@ -2,7 +2,7 @@ # Copyright (C) 2023 Advanced Micro Devices, Inc. ################################################################################ -cmake_minimum_required (VERSION 3.5) +cmake_minimum_required (VERSION 3.5...3.31.0) 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 diff --git a/test/findpackagecheck/CMakeLists.txt b/test/findpackagecheck/CMakeLists.txt index b26282d6..4f643807 100644 --- a/test/findpackagecheck/CMakeLists.txt +++ b/test/findpackagecheck/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required (VERSION 3.5) +cmake_minimum_required (VERSION 3.5...3.31.0) project(findpackagecheck CXX) message(STATUS "PKG: ${PKG}") diff --git a/test/libbasic/CMakeLists.txt b/test/libbasic/CMakeLists.txt index 8ef39883..7548eb43 100644 --- a/test/libbasic/CMakeLists.txt +++ b/test/libbasic/CMakeLists.txt @@ -3,7 +3,7 @@ ################################################################################ -cmake_minimum_required (VERSION 3.5) +cmake_minimum_required (VERSION 3.5...3.31.0) project(basic CXX) find_package(ROCmCMakeBuildTools) diff --git a/test/libheaderonly/CMakeLists.txt b/test/libheaderonly/CMakeLists.txt index 4a6d6b33..99052174 100644 --- a/test/libheaderonly/CMakeLists.txt +++ b/test/libheaderonly/CMakeLists.txt @@ -3,7 +3,7 @@ ################################################################################ -cmake_minimum_required (VERSION 3.5) +cmake_minimum_required (VERSION 3.5...3.31.0) project(headeronly LANGUAGES NONE) find_package(ROCmCMakeBuildTools) diff --git a/test/libprivate/CMakeLists.txt b/test/libprivate/CMakeLists.txt index 42d68594..60819173 100644 --- a/test/libprivate/CMakeLists.txt +++ b/test/libprivate/CMakeLists.txt @@ -3,7 +3,7 @@ ################################################################################ -cmake_minimum_required (VERSION 3.5) +cmake_minimum_required (VERSION 3.5...3.31.0) project(libprivate CXX) find_package(ROCmCMakeBuildTools) diff --git a/test/libsimple/CMakeLists.txt b/test/libsimple/CMakeLists.txt index 1968a9a1..2eebe1e1 100644 --- a/test/libsimple/CMakeLists.txt +++ b/test/libsimple/CMakeLists.txt @@ -3,7 +3,7 @@ ################################################################################ -cmake_minimum_required (VERSION 3.5) +cmake_minimum_required (VERSION 3.5...3.31.0) project(simple CXX) find_package(ROCmCMakeBuildTools) diff --git a/test/libsimple2/CMakeLists.txt b/test/libsimple2/CMakeLists.txt index 10ed4f0c..28b16b96 100644 --- a/test/libsimple2/CMakeLists.txt +++ b/test/libsimple2/CMakeLists.txt @@ -3,7 +3,7 @@ ################################################################################ -cmake_minimum_required (VERSION 3.5) +cmake_minimum_required (VERSION 3.5...3.31.0) project(simple2 CXX) find_package(ROCmCMakeBuildTools) diff --git a/test/libsimplecompat/CMakeLists.txt b/test/libsimplecompat/CMakeLists.txt index 572c5aa5..1a3688a0 100644 --- a/test/libsimplecompat/CMakeLists.txt +++ b/test/libsimplecompat/CMakeLists.txt @@ -3,7 +3,7 @@ ################################################################################ -cmake_minimum_required (VERSION 3.5) +cmake_minimum_required (VERSION 3.5...3.31.0) project(simple CXX) find_package(ROCM) diff --git a/test/libsimpletest/CMakeLists.txt b/test/libsimpletest/CMakeLists.txt index 86a41cc4..893db1c3 100644 --- a/test/libsimpletest/CMakeLists.txt +++ b/test/libsimpletest/CMakeLists.txt @@ -3,7 +3,7 @@ ################################################################################ -cmake_minimum_required (VERSION 3.5) +cmake_minimum_required (VERSION 3.5...3.31.0) project(simple CXX) find_package(ROCmCMakeBuildTools) diff --git a/test/libwrapper/CMakeLists.txt b/test/libwrapper/CMakeLists.txt index 161407ff..74f79c29 100644 --- a/test/libwrapper/CMakeLists.txt +++ b/test/libwrapper/CMakeLists.txt @@ -3,7 +3,7 @@ ################################################################################ -cmake_minimum_required (VERSION 3.5) +cmake_minimum_required (VERSION 3.5...3.31.0) project(test-wrapper CXX) find_package(ROCmCMakeBuildTools) diff --git a/test/pass/rocm-package-setup-component.cmake b/test/pass/rocm-package-setup-component.cmake index b8ed8cd8..89c079ff 100644 --- a/test/pass/rocm-package-setup-component.cmake +++ b/test/pass/rocm-package-setup-component.cmake @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.10...3.31.0) use_rocm_cmake() include(ROCMCreatePackage) diff --git a/test/toolchain-var/CMakeLists.txt b/test/toolchain-var/CMakeLists.txt index 98810d08..bb3dc465 100644 --- a/test/toolchain-var/CMakeLists.txt +++ b/test/toolchain-var/CMakeLists.txt @@ -3,7 +3,7 @@ ################################################################################ -cmake_minimum_required (VERSION 3.5) +cmake_minimum_required (VERSION 3.5...3.31.0) find_package(ROCmCMakeBuildTools) project(toolchain-var CXX) diff --git a/test/version/CMakeLists.txt b/test/version/CMakeLists.txt index 6c73766a..16f96b7b 100644 --- a/test/version/CMakeLists.txt +++ b/test/version/CMakeLists.txt @@ -2,7 +2,7 @@ # Copyright (C) 2017 Advanced Micro Devices, Inc. ################################################################################ -cmake_minimum_required (VERSION 3.5) +cmake_minimum_required (VERSION 3.5...3.31.0) project(simple LANGUAGES NONE) find_package(ROCmCMakeBuildTools) From 03bf7eb6e3d2e85f7dcc31f6342ed80f5cc196ad Mon Sep 17 00:00:00 2001 From: Eiden Yoshida <47196116+eidenyoshida@users.noreply.github.com> Date: Thu, 19 Jun 2025 15:16:27 -0600 Subject: [PATCH 5/9] Revert "Add rocm-core dependency to all generated packages, not just the root one. (#257)" (#270) This reverts commit f50f30f4e3e1d1d36c9948875eb55183e378c935. --- share/rocmcmakebuildtools/cmake/ROCMCreatePackage.cmake | 5 ----- 1 file changed, 5 deletions(-) diff --git a/share/rocmcmakebuildtools/cmake/ROCMCreatePackage.cmake b/share/rocmcmakebuildtools/cmake/ROCMCreatePackage.cmake index d3fc9d52..8e176031 100755 --- a/share/rocmcmakebuildtools/cmake/ROCMCreatePackage.cmake +++ b/share/rocmcmakebuildtools/cmake/ROCMCreatePackage.cmake @@ -139,11 +139,6 @@ macro(rocm_package_add_rocm_core_dependency) endif() rocm_join_if_set(", " CPACK_DEBIAN_PACKAGE_DEPENDS ${_rocm_core_pkg}) rocm_join_if_set(", " CPACK_RPM_PACKAGE_REQUIRES ${_rocm_core_pkg}) - foreach(COMPONENT IN LISTS ROCM_PACKAGE_COMPONENTS) - rocm_package_add_dependencies(COMPONENT ${COMPONENT} DEPENDS ${_rocm_core_pkg}) - endforeach() - rocm_package_add_dependencies(COMPONENT runtime DEPENDS ${_rocm_core_pkg}) - rocm_package_add_dependencies(COMPONENT devel DEPENDS ${_rocm_core_pkg}) unset(_rocm_core_pkg) endif() endmacro() From 10155d7272ea1bf79f6b5a9dbc339657af1aa372 Mon Sep 17 00:00:00 2001 From: Jacob Lambert Date: Wed, 20 Aug 2025 09:59:29 -0700 Subject: [PATCH 6/9] Add --hip-link to target_id check (#275) * Add --hip-link to target_id check The new driver in clang does not automatically link against the HIP libraries, so we need to add a --hip-link option here to enforce linking. Otherwise we'll get an error on the link stem of check_cxx_compiler_flag() when calling with "-xhip" and "--offload-arch" Note: The link step isn't really needed for this use case, as invalid targets will fail the compilation step. But check_cxx_compiler_flag() performs both compiling and linking by default * Update test.yml --- .github/workflows/test.yml | 6 +++--- share/rocmcmakebuildtools/cmake/ROCMCheckTargetIds.cmake | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ed4059f5..31fba3a4 100755 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ jobs: with: access_token: ${{ github.token }} lint: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v1 - name: Set up Python 3.10 @@ -32,8 +32,8 @@ jobs: max-parallel: 4 matrix: platform: - - ubuntu-20.04 - - windows-2019 + - ubuntu-24.04 + - windows-2022 cmake-version: - 3.31.0 - 3.22.1 diff --git a/share/rocmcmakebuildtools/cmake/ROCMCheckTargetIds.cmake b/share/rocmcmakebuildtools/cmake/ROCMCheckTargetIds.cmake index 8b71fcb8..6f008bf0 100644 --- a/share/rocmcmakebuildtools/cmake/ROCMCheckTargetIds.cmake +++ b/share/rocmcmakebuildtools/cmake/ROCMCheckTargetIds.cmake @@ -21,6 +21,7 @@ function(rocm_check_target_ids VARIABLE) foreach(_target_id ${PARSE_TARGETS}) _rocm_sanitize_target_id("${_target_id}" _result_var) set(_result_var "COMPILER_HAS_TARGET_ID_${_result_var}") + set(CMAKE_REQUIRED_LINK_OPTIONS "--hip-link") check_cxx_compiler_flag("-xhip --offload-arch=${_target_id}" "${_result_var}") if(${_result_var}) list(APPEND _supported_target_ids "${_target_id}") From bb18c61579e46741ad8c6d663fedfcd76aa621be Mon Sep 17 00:00:00 2001 From: arvindcheru <90783369+arvindcheru@users.noreply.github.com> Date: Tue, 26 Aug 2025 14:43:22 -0400 Subject: [PATCH 7/9] Fix Lintian warning for empty pre/post install scripts (#273) * Lintian Warning Fix, License Folder Name Update * Prioritizing Lintian Warning Fixes * UT FIX Update * Update comments --- .../cmake/ROCMCreatePackage.cmake | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/share/rocmcmakebuildtools/cmake/ROCMCreatePackage.cmake b/share/rocmcmakebuildtools/cmake/ROCMCreatePackage.cmake index 8e176031..d399a0f6 100755 --- a/share/rocmcmakebuildtools/cmake/ROCMCreatePackage.cmake +++ b/share/rocmcmakebuildtools/cmake/ROCMCreatePackage.cmake @@ -402,10 +402,6 @@ macro(rocm_create_package) file(WRITE ${PROJECT_BINARY_DIR}/debian/postinst "") file(WRITE ${PROJECT_BINARY_DIR}/debian/prerm "") - set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${PROJECT_BINARY_DIR}/debian/postinst;${PROJECT_BINARY_DIR}/debian/prerm") - set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${PROJECT_BINARY_DIR}/debian/postinst") - set(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE "${PROJECT_BINARY_DIR}/debian/prerm") - if(PARSE_LDCONFIG AND NOT ${ROCM_DISABLE_LDCONFIG}) set(LDCONFIG_DIR ${LIB_DIR}) if(PARSE_LDCONFIG_DIR) @@ -417,7 +413,6 @@ macro(rocm_create_package) echo \"${LDCONFIG_DIR}\" > /etc/ld.so.conf.d/${PARSE_NAME}.conf ldconfig ") - file( APPEND ${PROJECT_BINARY_DIR}/debian/prerm " @@ -433,10 +428,28 @@ macro(rocm_create_package) if(PARSE_COMPONENTS) rocm_set_comp_cpackvar(PARSE_HEADER_ONLY "${PARSE_SUFFIX}" "${PARSE_COMPONENTS}") endif() + + # Lintian Warning Fix: Enable post/pre scripts only if non empty + rocm_check_and_configure_script_files("${PROJECT_BINARY_DIR}/debian/prerm" "${PROJECT_BINARY_DIR}/debian/postinst") + include(CPack) set(ROCM_PACKAGE_CREATED TRUE CACHE INTERNAL "Track whether rocm_create_package has been called.") endmacro() +# Check script File Size and then configure +macro(rocm_check_and_configure_script_files PS_SCRIPT_FILE PR_SCRIPT_FILE) + file(SIZE ${PS_SCRIPT_FILE} _postinst_file_sz) + if(${_postinst_file_sz} GREATER 0) + set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${PS_SCRIPT_FILE}") + set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${PS_SCRIPT_FILE}") + endif() + file(SIZE ${PR_SCRIPT_FILE} _prerm_file_sz) + if(${_prerm_file_sz} GREATER 0) + set(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE "${PR_SCRIPT_FILE}") + set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA};${PR_SCRIPT_FILE}") + endif() +endmacro() + macro(rocm_setup_license HEADER_ONLY) if(NOT CPACK_RESOURCE_FILE_LICENSE) file(GLOB _license_files LIST_DIRECTORIES FALSE "${CMAKE_SOURCE_DIR}/LICENSE*") From 5f1f73d5cfd7fb55eb53d16ce023d66670ad1c7c Mon Sep 17 00:00:00 2001 From: Paul Fultz II Date: Wed, 3 Dec 2025 13:07:55 -0600 Subject: [PATCH 8/9] Fix handling of long pathnames with clang tidy (#279) --- .github/workflows/test.yml | 30 ++++++++++----- .../cmake/ROCMClangTidy.cmake | 38 ++++++++++--------- .../cmake/ROCMCppCheck.cmake | 2 +- .../cmake/ROCMCreatePackage.cmake | 12 ++++++ .../cmake/ROCMInstallTargets.cmake | 2 +- .../rocmcmakebuildtools/cmake/ROCMTest.cmake | 27 +++++++++---- test/CMakeLists.txt | 10 +++-- test/analyze/CMakeLists.txt | 10 ++++- test/analyze/include/simple.h | 2 + test/analyze/simple.cpp | 1 + test/analyze/simple2.cpp.in | 1 + ..._long_filenames_in_clang_tidy_cmake.cpp.in | 8 ++++ test/fail/wrapper.cmake | 2 +- test/pass/analyze-gh.cmake | 15 ++++++-- test/pass/analyze.cmake | 18 ++++++--- test/pass/libprivate.cmake | 9 ++++- test/pass/simple-prefix.cmake | 4 +- test/pass/simple-test-package.cmake | 2 +- test/test.cmake | 19 ++++++++-- 19 files changed, 154 insertions(+), 58 deletions(-) create mode 100644 test/analyze/simple_with_a_ridiculously_long_filename_in_order_to_test_long_filenames_in_clang_tidy_cmake.cpp.in diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 31fba3a4..b1f5f3e4 100755 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -37,10 +37,12 @@ jobs: cmake-version: - 3.31.0 - 3.22.1 - - 3.16.3 + - 3.16.3 + # There are problems with nmake and ninja with this version of cmake + # on windows exclude: - - platform: windows-2019 - cmake-version: 3.10.2 + - platform: windows-2022 + cmake-version: 3.16.3 steps: - uses: actions/checkout@v1 @@ -61,12 +63,22 @@ jobs: uses: ssciwr/doxygen-install@v1 with: version: "1.10.0" - - name: Run tests + - name: Setup git run: | git config --global user.email "you@example.com" git config --global user.name "Your Name" - cmake --version - cget build --test - cget build -T doc - cget build -Cy --test -DROCM_CMAKE_GENERATOR=Ninja - cget build -T doc + + - name: Cmake version + run: cmake --version + + - name: Run tests (default generator) + run: cget build --test + + - name: Build docs (default generator) + run: cget build -T doc + + - name: Run tests (Ninja generator) + run: cget build -Cy --test -DROCM_CMAKE_GENERATOR=Ninja + + - name: Build docs (Ninja generator) + run: cget build -T doc diff --git a/share/rocmcmakebuildtools/cmake/ROCMClangTidy.cmake b/share/rocmcmakebuildtools/cmake/ROCMClangTidy.cmake index 8ddfde4d..2ef7911b 100644 --- a/share/rocmcmakebuildtools/cmake/ROCMClangTidy.cmake +++ b/share/rocmcmakebuildtools/cmake/ROCMClangTidy.cmake @@ -192,24 +192,26 @@ function(rocm_clang_tidy_check TARGET) add_custom_target(tidy-target-${TARGET}) foreach(SOURCE ${SOURCES}) if(NOT "${SOURCE}" MATCHES "(h|hpp|hxx)$") - string(MAKE_C_IDENTIFIER "${SOURCE}" tidy_file) + get_filename_component(SRC_ABS ${SOURCE} ABSOLUTE) + string(FIND ${SRC_ABS} ${CMAKE_CURRENT_BINARY_DIR} BINARY_IDX) + if(BINARY_IDX EQUAL -1) + set(tidy_file_prefix "s") + set(ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + else() + set(tidy_file_prefix "b") + set(ROOT_DIR ${CMAKE_CURRENT_BINARY_DIR}) + endif() + get_filename_component(SRC_PATH ${SRC_ABS} DIRECTORY) + file(RELATIVE_PATH REL_PATH ${ROOT_DIR} ${SRC_PATH}) + get_filename_component(BASE_SOURCE_NAME ${SOURCE} NAME_WE) + if(REL_PATH) + set(BASE_SOURCE ${REL_PATH}/${BASE_SOURCE_NAME}) + else() + set(BASE_SOURCE ${BASE_SOURCE_NAME}) + endif() + string(MAKE_C_IDENTIFIER "${tidy_file_prefix}/${BASE_SOURCE}" tidy_file) set(tidy_target tidy-target-${TARGET}-${tidy_file}) if(CLANG_TIDY_CACHE_SIZE GREATER 0) - get_filename_component(SRC_ABS ${SOURCE} ABSOLUTE) - string(FIND ${SRC_ABS} ${CMAKE_CURRENT_BINARY_DIR} BINARY_IDX) - if(BINARY_IDX EQUAL -1) - set(ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}) - else() - set(ROOT_DIR ${CMAKE_CURRENT_BINARY_DIR}) - endif() - get_filename_component(SRC_PATH ${SRC_ABS} DIRECTORY) - file(RELATIVE_PATH REL_PATH ${ROOT_DIR} ${SRC_PATH}) - get_filename_component(BASE_SOURCE_NAME ${SOURCE} NAME_WE) - if(REL_PATH) - set(BASE_SOURCE ${REL_PATH}/${BASE_SOURCE_NAME}) - else() - set(BASE_SOURCE ${BASE_SOURCE_NAME}) - endif() file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/${tidy_target}.cmake " @@ -236,7 +238,9 @@ function(rocm_clang_tidy_check TARGET) endif() return() endif() - string(REPLACE \"Preprocessing CXX source to \" \"\" PP_FILE \"\${PP_OUT}\") + # Filter out the message so it can handle verbose output + string(REGEX MATCH \"Preprocessing CXX source to [^\\n]*\\\\.i\\n\" PP_SELECT_OUT \"\${PP_OUT}\") + string(REPLACE \"Preprocessing CXX source to \" \"\" PP_FILE \"\${PP_SELECT_OUT}\") string(STRIP \"\${PP_FILE}\" PP_FILE) file(MD5 ${CMAKE_CURRENT_BINARY_DIR}/\${PP_FILE} PP_HASH) execute_process( diff --git a/share/rocmcmakebuildtools/cmake/ROCMCppCheck.cmake b/share/rocmcmakebuildtools/cmake/ROCMCppCheck.cmake index ee0828cc..cc595f57 100755 --- a/share/rocmcmakebuildtools/cmake/ROCMCppCheck.cmake +++ b/share/rocmcmakebuildtools/cmake/ROCMCppCheck.cmake @@ -118,7 +118,7 @@ macro(rocm_enable_cppcheck) # cmake-lint: disable=C0301 set(CPPCHECK_TEMPLATE_ARG "--template=::warning file={file},line={line},col={column}::{severity}: {inconclusive:inconclusive: }{message} [{id}]" - "--template-location={file}:{line}:{column}: note: {info}\\\n{code}") + "--template-location={file}:{line}:{column}: note: {info}\\n{code}") endif() set(CPPCHECK_COMMAND diff --git a/share/rocmcmakebuildtools/cmake/ROCMCreatePackage.cmake b/share/rocmcmakebuildtools/cmake/ROCMCreatePackage.cmake index d399a0f6..e687a4e1 100755 --- a/share/rocmcmakebuildtools/cmake/ROCMCreatePackage.cmake +++ b/share/rocmcmakebuildtools/cmake/ROCMCreatePackage.cmake @@ -432,6 +432,18 @@ macro(rocm_create_package) # Lintian Warning Fix: Enable post/pre scripts only if non empty rocm_check_and_configure_script_files("${PROJECT_BINARY_DIR}/debian/prerm" "${PROJECT_BINARY_DIR}/debian/postinst") + # Create a CPack project config file for generator-specific settings + set(_cpack_project_config "${PROJECT_BINARY_DIR}/CPackProjectConfig.cmake") + file(WRITE "${_cpack_project_config}" " + # Generator-specific configuration for consistent archive paths + if(CPACK_GENERATOR MATCHES \"TGZ|ZIP\") + # Use relative paths for archive generators (consistent across platforms) + set(CPACK_SET_DESTDIR OFF) + set(CPACK_PACKAGING_INSTALL_PREFIX \"/\") + endif() + ") + set(CPACK_PROJECT_CONFIG_FILE "${_cpack_project_config}") + include(CPack) set(ROCM_PACKAGE_CREATED TRUE CACHE INTERNAL "Track whether rocm_create_package has been called.") endmacro() diff --git a/share/rocmcmakebuildtools/cmake/ROCMInstallTargets.cmake b/share/rocmcmakebuildtools/cmake/ROCMInstallTargets.cmake index 304211ba..3aae8c30 100644 --- a/share/rocmcmakebuildtools/cmake/ROCMInstallTargets.cmake +++ b/share/rocmcmakebuildtools/cmake/ROCMInstallTargets.cmake @@ -341,7 +341,7 @@ function(rocm_export_targets) set(CONFIG_NAME ${PACKAGE_NAME_LOWER}-config) set(TARGET_VERSION ${PROJECT_VERSION}) - if(PARSE_PREFIX) + if(PARSE_PREFIX AND NOT WIN32) set(PREFIX_DIR ${PARSE_PREFIX}) set(PREFIX_ARG PREFIX ${PREFIX_DIR}) set(BIN_INSTALL_DIR ${PREFIX_DIR}/${CMAKE_INSTALL_BINDIR}) diff --git a/share/rocmcmakebuildtools/cmake/ROCMTest.cmake b/share/rocmcmakebuildtools/cmake/ROCMTest.cmake index ccaa3a0b..65608cdd 100644 --- a/share/rocmcmakebuildtools/cmake/ROCMTest.cmake +++ b/share/rocmcmakebuildtools/cmake/ROCMTest.cmake @@ -19,13 +19,14 @@ add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -j ${ add_custom_target(tests COMMENT "Build all tests.") add_dependencies(check tests) -add_custom_target(install-tests COMMAND ${CMAKE_COMMAND} -DCOMPONENT=tests -P ${CMAKE_BINARY_DIR}/cmake_install.cmake) +add_custom_target(install-tests COMMAND ${CMAKE_COMMAND} -DCOMPONENT=tests -DCMAKE_INSTALL_CONFIG_NAME=$ -P + ${CMAKE_BINARY_DIR}/cmake_install.cmake) add_dependencies(install-tests tests) rocm_define_property(TARGET "ROCM_TEST_INSTALLDIR" "Install dir for tests") macro(rocm_enable_test_package NAME) message(STATUS "Enable test package ${NAME}") - set_target_properties(tests PROPERTIES ROCM_TEST_INSTALLDIR ${CMAKE_INSTALL_PREFIX}/libexec/installed-tests/${NAME}) + set_target_properties(tests PROPERTIES ROCM_TEST_INSTALLDIR ${CMAKE_INSTALL_LIBEXECDIR}/installed-tests/${NAME}) rocm_package_setup_component(tests DEPENDS COMPONENT runtime) rocm_defer(rocm_test_install_ctest) endmacro() @@ -89,9 +90,9 @@ function(rocm_save_test) set(COMMAND "") foreach(ARG ${PARSE_COMMAND}) if(TARGET ${ARG}) - set(INSTALL_PREFIX "$<${_rocm_test_genex_eval}:$>") - string(APPEND COMMAND - " \"${INSTALL_PREFIX}/$\"") + set(INSTALL_PREFIX + "${CMAKE_INSTALL_PREFIX}/$<${_rocm_test_genex_eval}:$>") + string(APPEND COMMAND " \"${INSTALL_PREFIX}/$\"") else() string(APPEND COMMAND " \"${ARG}\"") endif() @@ -159,7 +160,11 @@ function(rocm_add_test) set(COMMAND_ARGS ${COMMAND}) list(REMOVE_AT COMMAND_ARGS 0) - if(ROCM_TEST_GDB AND TARGET ${COMMAND_EXE}) + get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + + if(NOT IS_MULTI_CONFIG + AND ROCM_TEST_GDB + AND TARGET ${COMMAND_EXE}) set(TEST_DIR ${CMAKE_CURRENT_BINARY_DIR}/gdb/test_${PARSE_NAME}) file(MAKE_DIRECTORY ${TEST_DIR}) if(NOT EXISTS ${TEST_DIR}) @@ -221,9 +226,15 @@ function(rocm_install_test) set(INSTALL_PREFIX "$") if(PARSE_TARGETS) foreach(TARGET ${PARSE_TARGETS}) - set_property(TARGET ${TARGET} APPEND PROPERTY INSTALL_RPATH "$ORIGIN/../../../../lib") + set_property( + TARGET ${TARGET} + APPEND + PROPERTY INSTALL_RPATH "$ORIGIN/../../../../lib") # Adding RPATH to public tests to point to private libraries. - set_property(TARGET ${TARGET} APPEND PROPERTY INSTALL_RPATH "$ORIGIN/../../../../lib/${PROJECT_NAME}/lib") + set_property( + TARGET ${TARGET} + APPEND + PROPERTY INSTALL_RPATH "$ORIGIN/../../../../lib/${PROJECT_NAME}/lib") endforeach() install( TARGETS ${PARSE_TARGETS} diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 6e01921e..f5ed4bfb 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -15,13 +15,15 @@ macro(rocm_cmake_add_test_argument CMAKE_VAR VAR_TYPE DOC_STRING) endif() endmacro() -rocm_cmake_add_test_argument(CMAKE_MAKE_PROGRAM FILEPATH "Make program to relay to test projects") rocm_cmake_add_test_argument(CMAKE_GENERATOR STRING "Generator to relay to test projects") -rocm_cmake_add_test_argument(CMAKE_GENERATOR_INSTANCE STRING "Generator instance to relay to test projects") -rocm_cmake_add_test_argument(CMAKE_GENERATOR_PLATFORM STRING "Generator platform to relay to test projects") -rocm_cmake_add_test_argument(CMAKE_GENERATOR_TOOLSET STRING "Generator toolset to relay to test projects") rocm_cmake_add_test_argument(CMAKE_PREFIX_PATH PATH "Prefix path to relay to test projects") rocm_cmake_add_test_argument(CMAKE_PROGRAM_PATH PATH "Program path to relay to test projects") +if(ROCM_CMAKE_GENERATOR STREQUAL "${CMAKE_GENERATOR}") + rocm_cmake_add_test_argument(CMAKE_GENERATOR_INSTANCE STRING "Generator instance to relay to test projects") + rocm_cmake_add_test_argument(CMAKE_GENERATOR_PLATFORM STRING "Generator platform to relay to test projects") + rocm_cmake_add_test_argument(CMAKE_GENERATOR_TOOLSET STRING "Generator toolset to relay to test projects") + rocm_cmake_add_test_argument(CMAKE_MAKE_PROGRAM FILEPATH "Make program to relay to test projects") +endif() function(rocm_cmake_create_test NAME TEST) add_custom_target(${NAME} COMMAND ${CMAKE_COMMAND} ${TEST_ARGUMENTS} -P ${CMAKE_CURRENT_SOURCE_DIR}/test.cmake ${TEST} ${CMAKE_CURRENT_BINARY_DIR}/tmp/${NAME}) diff --git a/test/analyze/CMakeLists.txt b/test/analyze/CMakeLists.txt index cfe1b2ba..fd8a1c08 100755 --- a/test/analyze/CMakeLists.txt +++ b/test/analyze/CMakeLists.txt @@ -40,11 +40,17 @@ rocm_enable_cppcheck( threadsafety ) +# Workaround clangTooling issue: https://github.com/llvm/llvm-project/issues/100909 +if(NOT MSVC) + add_compile_options(-Wno-unused-command-line-argument) +endif() + rocm_setup_version(VERSION 1.0.0) -configure_file(simple2.cpp.in simple2.cpp) +configure_file(simple2.cpp.in simple.cpp) +configure_file(simple_with_a_ridiculously_long_filename_in_order_to_test_long_filenames_in_clang_tidy_cmake.cpp.in simple_with_a_ridiculously_long_filename_in_order_to_test_long_filenames_in_clang_tidy_cmake.cpp) -add_library(simple simple.cpp ${CMAKE_CURRENT_BINARY_DIR}/simple2.cpp) +add_library(simple simple.cpp ${CMAKE_CURRENT_BINARY_DIR}/simple_with_a_ridiculously_long_filename_in_order_to_test_long_filenames_in_clang_tidy_cmake.cpp ${CMAKE_CURRENT_BINARY_DIR}/simple.cpp) rocm_install_targets(TARGETS simple INCLUDE include) diff --git a/test/analyze/include/simple.h b/test/analyze/include/simple.h index e17a9e2b..e8b503b5 100644 --- a/test/analyze/include/simple.h +++ b/test/analyze/include/simple.h @@ -7,6 +7,8 @@ #define GUARD_SIMPLE_H void simple(); +void simple2(); +void simple_long(); #endif diff --git a/test/analyze/simple.cpp b/test/analyze/simple.cpp index c5ae3d49..75539451 100644 --- a/test/analyze/simple.cpp +++ b/test/analyze/simple.cpp @@ -2,6 +2,7 @@ * Copyright (C) 2017 Advanced Micro Devices, Inc. ******************************************************************************/ +#include void simple() {} diff --git a/test/analyze/simple2.cpp.in b/test/analyze/simple2.cpp.in index b7679979..c44f848d 100644 --- a/test/analyze/simple2.cpp.in +++ b/test/analyze/simple2.cpp.in @@ -2,6 +2,7 @@ * Copyright (C) 2020 Advanced Micro Devices, Inc. ******************************************************************************/ +#include void simple2() {} diff --git a/test/analyze/simple_with_a_ridiculously_long_filename_in_order_to_test_long_filenames_in_clang_tidy_cmake.cpp.in b/test/analyze/simple_with_a_ridiculously_long_filename_in_order_to_test_long_filenames_in_clang_tidy_cmake.cpp.in new file mode 100644 index 00000000..3d296166 --- /dev/null +++ b/test/analyze/simple_with_a_ridiculously_long_filename_in_order_to_test_long_filenames_in_clang_tidy_cmake.cpp.in @@ -0,0 +1,8 @@ +/******************************************************************************* + * Copyright (C) 2017 Advanced Micro Devices, Inc. + ******************************************************************************/ + +#include + +void simple_long() +{} diff --git a/test/fail/wrapper.cmake b/test/fail/wrapper.cmake index f3354eb4..4fdb6ad7 100644 --- a/test/fail/wrapper.cmake +++ b/test/fail/wrapper.cmake @@ -2,7 +2,7 @@ # Copyright (C) 2022 Advanced Micro Devices, Inc. # ###################################################################################################################### -if(NOT MSVC) +if(NOT WIN32) install_dir(${TEST_DIR}/libwrapper CMAKE_ARGS -DBUILD_SHARED_LIBS=On -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=On -DERR_ON_WARN=ON) test_check_package( diff --git a/test/pass/analyze-gh.cmake b/test/pass/analyze-gh.cmake index 993cdf1c..a80c0c53 100644 --- a/test/pass/analyze-gh.cmake +++ b/test/pass/analyze-gh.cmake @@ -2,9 +2,18 @@ # Copyright (C) 2020 Advanced Micro Devices, Inc. # ###################################################################################################################### -install_dir(${TEST_DIR}/analyze TARGETS analyze analyze) +if(WIN32) +install_dir(${TEST_DIR}/analyze) install_dir( ${TEST_DIR}/analyze - CMAKE_ARGS -DCLANG_TIDY_CACHE_SIZE=0 -DROCM_ENABLE_GH_ANNOTATIONS=On - TARGETS analyze analyze) + CMAKE_ARGS -DCLANG_TIDY_CACHE_SIZE=0 -DROCM_ENABLE_GH_ANNOTATIONS=On) + +else() + install_dir(${TEST_DIR}/analyze TARGETS analyze analyze) + + install_dir( + ${TEST_DIR}/analyze + CMAKE_ARGS -DCLANG_TIDY_CACHE_SIZE=0 -DROCM_ENABLE_GH_ANNOTATIONS=On + TARGETS analyze analyze) +endif() diff --git a/test/pass/analyze.cmake b/test/pass/analyze.cmake index 9a8ef918..1d0dfb7d 100644 --- a/test/pass/analyze.cmake +++ b/test/pass/analyze.cmake @@ -2,9 +2,17 @@ # Copyright (C) 2017 Advanced Micro Devices, Inc. # ###################################################################################################################### -install_dir(${TEST_DIR}/analyze TARGETS analyze analyze) +if(WIN32) + install_dir(${TEST_DIR}/analyze) -install_dir( - ${TEST_DIR}/analyze - CMAKE_ARGS -DCLANG_TIDY_CACHE_SIZE=0 - TARGETS analyze analyze) + install_dir( + ${TEST_DIR}/analyze + CMAKE_ARGS -DCLANG_TIDY_CACHE_SIZE=0) +else() + install_dir(${TEST_DIR}/analyze TARGETS analyze analyze) + + install_dir( + ${TEST_DIR}/analyze + CMAKE_ARGS -DCLANG_TIDY_CACHE_SIZE=0 + TARGETS analyze analyze) +endif() diff --git a/test/pass/libprivate.cmake b/test/pass/libprivate.cmake index e2992175..9cf4ab48 100644 --- a/test/pass/libprivate.cmake +++ b/test/pass/libprivate.cmake @@ -6,6 +6,11 @@ install_dir( ${TEST_DIR}/libprivate CMAKE_ARGS -DROCM_SYMLINK_LIBS=OFF -DROCM_PREFIX=rocm TARGETS package) -test_expect_file(${PREFIX}/lib/libprivate/include/simpleprivate.h) -test_expect_file(${PREFIX}/lib/libprivate/lib/libsimple_private.a) +if(WIN32) + test_expect_file(${PREFIX}/include/simpleprivate.h) + test_expect_file(${PREFIX}/lib/simple_private.lib) +else() + test_expect_file(${PREFIX}/lib/libprivate/include/simpleprivate.h) + test_expect_file(${PREFIX}/lib/libprivate/lib/libsimple_private.a) +endif() install_dir(${TEST_DIR}/libprivate) diff --git a/test/pass/simple-prefix.cmake b/test/pass/simple-prefix.cmake index 6a6c67b3..0b57f753 100644 --- a/test/pass/simple-prefix.cmake +++ b/test/pass/simple-prefix.cmake @@ -7,5 +7,7 @@ install_dir( CMAKE_ARGS -DROCM_PREFIX=simple TARGETS package) test_expect_file(${PREFIX}/include/simple.h) -test_expect_file(${PREFIX}/simple/include/simple.h) +if(NOT WIN32) + test_expect_file(${PREFIX}/simple/include/simple.h) +endif() install_dir(${TEST_DIR}/libbasic) diff --git a/test/pass/simple-test-package.cmake b/test/pass/simple-test-package.cmake index b60b1755..b4942cf0 100644 --- a/test/pass/simple-test-package.cmake +++ b/test/pass/simple-test-package.cmake @@ -7,5 +7,5 @@ file(GLOB TEST_PACKAGE ${BUILD_DIR}/*-tests.tar.gz) list(LENGTH TEST_PACKAGE NTEST_PACKAGE) test_expect_eq(${NTEST_PACKAGE} 1) test_exec(COMMAND ${CMAKE_COMMAND} -E tar t ${TEST_PACKAGE}) -test_exec(COMMAND ${CMAKE_COMMAND} -E tar x ${TEST_PACKAGE} WORKING_DIRECTORY /) +test_exec(COMMAND ${CMAKE_COMMAND} -E tar x ${TEST_PACKAGE} WORKING_DIRECTORY ${PREFIX}) test_expect_file(${PREFIX}/libexec/installed-tests/simple/CTestTestfile.cmake) diff --git a/test/test.cmake b/test/test.cmake index 3200c0c9..9b0e2411 100755 --- a/test/test.cmake +++ b/test/test.cmake @@ -91,7 +91,13 @@ macro(test_exec) string(REPLACE "|" "\;" REAL_EXEC_COMMAND "${ARGN}") execute_process(${REAL_EXEC_COMMAND} RESULT_VARIABLE test_exec_RESULT) if(NOT test_exec_RESULT EQUAL 0) - message(FATAL_ERROR "Process failed: ${EXEC_COMMAND}") + # Build a quoted command string that shows argument boundaries clearly + set(test_exec_quoted_cmd "") + foreach(test_exec_arg ${ARGN}) + string(APPEND test_exec_quoted_cmd "\"${test_exec_arg}\" ") + endforeach() + + message(FATAL_ERROR "Process failed with exit code: ${test_exec_RESULT}\n" "Command: ${test_exec_quoted_cmd}\n") endif() endmacro() @@ -107,7 +113,12 @@ function(configure_dir DIR) cmake_parse_arguments(PARSE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) string(RANDOM BUILD_RAND) - set(BUILD_DIR ${BUILDS_DIR}/${BUILD_RAND}) + if(WIN32) + set(BUILD_DIR ${BUILDS_DIR}/${BUILD_RAND}) + else() + set(LONG_PATH "longer_pathname_so_that_rpms_can_support_packaging_the_debug_info_for_all_os_profiles") + set(BUILD_DIR ${BUILDS_DIR}/${BUILD_RAND}/${LONG_PATH}/src/out/some-os-version/version/build/rocm-cmake/build) + endif() if(NOT EXISTS ${BUILD_DIR}) file(MAKE_DIRECTORY ${BUILD_DIR}) endif() @@ -123,7 +134,9 @@ function(configure_dir DIR) endforeach() if(PARSE_BUILD_DIR_VAR) - set(${PARSE_BUILD_DIR_VAR} ${BUILD_DIR} PARENT_SCOPE) + set(${PARSE_BUILD_DIR_VAR} + ${BUILD_DIR} + PARENT_SCOPE) else() file(REMOVE_RECURSE ${BUILD_DIR}) endif() From c01b4f1fd36a94d26c76e7f617b57577b3b84275 Mon Sep 17 00:00:00 2001 From: Braden Stefanuk <121893577+bstefanuk@users.noreply.github.com> Date: Thu, 15 Jan 2026 15:35:06 -0700 Subject: [PATCH 9/9] Allow suppression of warnings in ROCMChecks (#281) * fix: allow suppression of warning for third-party deps * fix: analyzer issues --- .../cmake/ROCMChecks.cmake | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/share/rocmcmakebuildtools/cmake/ROCMChecks.cmake b/share/rocmcmakebuildtools/cmake/ROCMChecks.cmake index f5ecfce5..6a08309d 100644 --- a/share/rocmcmakebuildtools/cmake/ROCMChecks.cmake +++ b/share/rocmcmakebuildtools/cmake/ROCMChecks.cmake @@ -25,17 +25,18 @@ function(rocm_check_toolchain_var var access value list_file) set(message_type WARNING) set(message_title "ROCMChecks WARNING") endif() - if(access STREQUAL "MODIFIED_ACCESS") - set(cmake_module Off) - get_filename_component(base "${list_file}" DIRECTORY) - # Skip warning in cmake's built-in modules - if("${base}" STREQUAL "${CMAKE_ROOT}/Modules") - set(cmake_module On) - elseif("${base}" MATCHES ".*/CMakeFiles/${CMAKE_VERSION}$") - set(cmake_module On) - endif() - if(NOT cmake_module) - message( " + if(ROCM_WARN_TOOLCHAIN_VAR OR ROCM_ERROR_TOOLCHAIN_VAR) + if(access STREQUAL "MODIFIED_ACCESS") + set(cmake_module Off) + get_filename_component(base "${list_file}" DIRECTORY) + # Skip warning in cmake's built-in modules + if("${base}" STREQUAL "${CMAKE_ROOT}/Modules") + set(cmake_module On) + elseif("${base}" MATCHES ".*/CMakeFiles/${CMAKE_VERSION}$") + set(cmake_module On) + endif() + if(NOT cmake_module) + message( " ******************************************************************************* *------------------------------- ${message_title} --------------------------* Options and properties should be set on a cmake target where possible. The @@ -43,10 +44,11 @@ function(rocm_check_toolchain_var var access value list_file) calling 'cmake -D${var}=\"${value}\"' or set in a toolchain file and added with 'cmake -DCMAKE_TOOLCHAIN_FILE='. ROCMChecks now calling:") - message(${message_type} "'${var}' is set at ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt: shown below:") - message( "*-----------------------------------------------------------------------------* + message(${message_type} "'${var}' is set at ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt: below:") + message( "*-----------------------------------------------------------------------------* ******************************************************************************* ") + endif() endif() endif() endfunction()