Skip to content

Commit fb261f4

Browse files
[rocm-libraries] ROCm/rocm-libraries#8353 (commit 08a7c20)
Revert "Replace download project with fetchcontent" Reverts ROCm/rocm-libraries#6573 fixes: ROCm/rocm-libraries#8352 ``` FAILED: _deps/googlebench-build/src/CMakeFiles/benchmark.dir/string_util.cc.obj B:/build/math-libs/rocThrust/build/_deps/googlebench-src/src/string_util.cc:158:46: error: diagnostic behavior may be improved by adding the 'format(printf, 1, 2)' attribute to the declaration of 'StrFormat' [-Werror,-Wmissing-format-attribute] 1 error generated. ```
1 parent d397304 commit fb261f4

5 files changed

Lines changed: 43 additions & 93 deletions

File tree

cmake/Dependencies.cmake

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MIT License
22
#
3-
# Copyright (c) 2017-2026 Advanced Micro Devices, Inc. All rights reserved.
3+
# Copyright (c) 2017-2025 Advanced Micro Devices, Inc. All rights reserved.
44
#
55
# Permission is hereby granted, free of charge, to any person obtaining a copy
66
# of this software and associated documentation files (the "Software"), to deal
@@ -44,16 +44,14 @@ if(DEFINED BUILD_SHARED_LIBS)
4444
endif()
4545
set(USER_ROCM_WARN_TOOLCHAIN_VAR ${ROCM_WARN_TOOLCHAIN_VAR})
4646

47-
# Suppress ROCmChecks warnings for local toolchain modifications.
48-
set(ROCM_WARN_TOOLCHAIN_VAR OFF)
49-
50-
# Force older versions of option() in googletest to respect the local variable setting.
51-
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
52-
53-
# Resolve Ninja generator errors regarding RPATH relinking during the install phase for merged subprojects.
54-
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
55-
5647
set(ROCM_WARN_TOOLCHAIN_VAR OFF CACHE BOOL "")
48+
# Suppress ROCMChecks WARNING on third-party dependencies
49+
set(_HIPCUB_DISABLE_ROCM_CHECKS FALSE)
50+
macro(rocm_check_toolchain_var var access value list_file)
51+
if(NOT _HIPCUB_DISABLE_ROCM_CHECKS)
52+
_rocm_check_toolchain_var("${var}" "${access}" "${value}" "${list_file}")
53+
endif()
54+
endmacro()
5755
# Turn off warnings and errors for all warnings in dependencies
5856
separate_arguments(CXX_FLAGS_LIST NATIVE_COMMAND ${CMAKE_CXX_FLAGS})
5957
list(REMOVE_ITEM CXX_FLAGS_LIST /WX -Werror -Werror=pendantic -pedantic-errors)
@@ -73,6 +71,8 @@ foreach(SHARED_OPTION BUILD_TEST BUILD_BENCHMARK BUILD_EXAMPLE)
7371
set(${SHARED_OPTION} OFF)
7472
endforeach()
7573

74+
include(FetchContent)
75+
7676
# This function checks to see if the download branch given by "branch" exists in the repository.
7777
# It does so using the git ls-remote command.
7878
# If the branch cannot be found, the variable described by "branch" is changed to "develop" in the host scope.
@@ -293,8 +293,6 @@ function(fetch_dep method repo_name repo_path download_branch)
293293
endif()
294294
endfunction()
295295

296-
include(cmake/FetchContentIsolated.cmake)
297-
298296
# Test dependencies
299297
if(USER_BUILD_TEST)
300298
# NOTE1: Google Test has created a mess with legacy FindGTest.cmake and newer GTestConfig.cmake
@@ -320,19 +318,21 @@ if(USER_BUILD_TEST)
320318
option(BUILD_GMOCK "Builds the googlemock subproject" OFF)
321319
option(INSTALL_GTEST "Enable installation of googletest." OFF)
322320
if(EXISTS /usr/src/googletest AND NOT EXTERNAL_DEPS_FORCE_DOWNLOAD)
323-
set(GTEST_FETCH_ARGS SOURCE_DIR /usr/src/googletest)
321+
FetchContent_Declare(
322+
googletest
323+
SOURCE_DIR /usr/src/googletest
324+
)
324325
else()
325326
message(STATUS "Google Test not found. Fetching...")
326-
set(GTEST_FETCH_ARGS
327-
GIT_REPOSITORY https://github.com/google/googletest.git
328-
GIT_TAG release-1.11.0
327+
FetchContent_Declare(
328+
googletest
329+
GIT_REPOSITORY https://github.com/google/googletest.git
330+
GIT_TAG release-1.11.0
329331
)
330332
endif()
331-
fetch_content_isolated(
332-
googletest
333-
${GTEST_FETCH_ARGS}
334-
CMAKE_ARGS -DBUILD_GTEST=ON -DBUILD_GMOCK=OFF -DINSTALL_GTEST=OFF
335-
)
333+
set(_HIPCUB_DISABLE_ROCM_CHECKS TRUE)
334+
FetchContent_MakeAvailable(googletest)
335+
set(_HIPCUB_DISABLE_ROCM_CHECKS FALSE)
336336
add_library(GTest::GTest ALIAS gtest)
337337
add_library(GTest::Main ALIAS gtest_main)
338338
else()
@@ -351,15 +351,18 @@ if(USER_BUILD_BENCHMARK)
351351
endif()
352352
if(NOT TARGET benchmark::benchmark)
353353
message(STATUS "Google Benchmark not found. Fetching...")
354-
fetch_content_isolated(
354+
option(BENCHMARK_ENABLE_TESTING "Enable testing of the benchmark library." OFF)
355+
option(BENCHMARK_ENABLE_INSTALL "Enable installation of benchmark." OFF)
356+
FetchContent_Declare(
355357
googlebench
356358
GIT_REPOSITORY https://github.com/google/benchmark.git
357359
GIT_TAG v${BENCHMARK_VERSION}
358-
CMAKE_ARGS -DBENCHMARK_ENABLE_TESTING=OFF
359-
-DBENCHMARK_ENABLE_INSTALL=OFF
360-
-DHAVE_STD_REGEX=ON
361-
-DRUN_HAVE_STD_REGEX=1
362360
)
361+
set(HAVE_STD_REGEX ON)
362+
set(RUN_HAVE_STD_REGEX 1)
363+
set(_HIPCUB_DISABLE_ROCM_CHECKS TRUE)
364+
FetchContent_MakeAvailable(googlebench)
365+
set(_HIPCUB_DISABLE_ROCM_CHECKS FALSE)
363366
if(NOT TARGET benchmark::benchmark)
364367
add_library(benchmark::benchmark ALIAS benchmark)
365368
endif()
@@ -410,11 +413,16 @@ else()
410413
if(${ROCPRIM_FETCH_METHOD} STREQUAL "DOWNLOAD" OR ${ROCPRIM_FETCH_METHOD} STREQUAL "MONOREPO")
411414
# The fetch_dep call above should have downloaded/located the source. We just need to make it available.
412415
message(STATUS "Configuring rocPRIM")
413-
fetch_content_isolated(
416+
FetchContent_Declare(
414417
prim
415418
SOURCE_DIR ${ROCPRIM_PATH}
416-
CMAKE_ARGS -DBUILD_TEST=OFF -DCMAKE_PREFIX_PATH=/opt/rocm
419+
INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/deps/rocprim
420+
CMAKE_ARGS -DBUILD_TEST=OFF -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> -DCMAKE_PREFIX_PATH=/opt/rocm
421+
LOG_CONFIGURE TRUE
422+
LOG_BUILD TRUE
423+
LOG_INSTALL TRUE
417424
)
425+
FetchContent_MakeAvailable(prim)
418426
if(NOT TARGET roc::rocprim)
419427
add_library(roc::rocprim ALIAS rocprim)
420428
endif()

cmake/FetchContentIsolated.cmake

Lines changed: 0 additions & 59 deletions
This file was deleted.

cmake/ROCmCMakeBuildToolsDependency.cmake

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MIT License
22
#
3-
# Copyright (c) 2017-2026 Advanced Micro Devices, Inc. All rights reserved.
3+
# Copyright (c) 2017-2025 Advanced Micro Devices, Inc. All rights reserved.
44
#
55
# Permission is hereby granted, free of charge, to any person obtaining a copy
66
# of this software and associated documentation files (the "Software"), to deal
@@ -32,13 +32,14 @@ if(NOT ROCmCMakeBuildTools_FOUND)
3232
else()
3333
set(SOURCE_SUBDIR_ARG)
3434
endif()
35-
include(cmake/FetchContentIsolated.cmake)
36-
fetch_content_isolated(
35+
include(FetchContent)
36+
FetchContent_Declare(
3737
rocm-cmake
3838
GIT_REPOSITORY https://github.com/ROCm/rocm-cmake.git
3939
GIT_TAG rocm-6.4.4
4040
${SOURCE_SUBDIR_ARG}
4141
)
42+
FetchContent_GetProperties(rocm-cmake)
4243
if(NOT rocm-cmake_POPULATED)
4344
# rocm-cmake 0.12.0 and higher needs to built from source
4445
FetchContent_Populate(rocm-cmake)

test/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ endfunction()
7070
# We'll use this small program to detect available GPUs and build the resource JSON file.
7171
set(GEN_RES_SPEC_PATH ${CMAKE_SOURCE_DIR}/test/generate_resource_spec.cpp)
7272
add_executable(generate_resource_spec ${GEN_RES_SPEC_PATH})
73-
target_compile_options(generate_resource_spec PRIVATE -Wno-unused-command-line-argument)
7473
set_target_properties(generate_resource_spec PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
7574
target_link_libraries(generate_resource_spec PRIVATE hip::host)
7675
# This test may still get the offload-compress flag passed. Since it does not include any kernel

test/extra/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MIT License
22
#
3-
# Copyright (c) 2017-2026 Advanced Micro Devices, Inc. All rights reserved.
3+
# Copyright (c) 2017-2025 Advanced Micro Devices, Inc. All rights reserved.
44
#
55
# Permission is hereby granted, free of charge, to any person obtaining a copy
66
# of this software and associated documentation files (the "Software"), to deal
@@ -83,11 +83,12 @@ else()
8383
endif()
8484
if(NOT TARGET roc::rocprim)
8585
message(STATUS "rocPRIM not found. Fetching...")
86-
fetch_content_isolated(
86+
FetchContent_Declare(
8787
prim
8888
GIT_REPOSITORY https://github.com/ROCm/rocPRIM.git
8989
GIT_TAG develop
9090
)
91+
FetchContent_MakeAvailable(prim)
9192
if(NOT TARGET roc::rocprim)
9293
add_library(roc::rocprim ALIAS rocprim)
9394
endif()

0 commit comments

Comments
 (0)