From f3679ac0bb4c7c62258fbf5a7f3784467a67bb44 Mon Sep 17 00:00:00 2001 From: Sean Keely Date: Wed, 17 Jun 2020 15:08:28 -0500 Subject: [PATCH] Allow cmake UI to switch between static and dynamic. Dependency changes between static and dynamic build caused a cmake crash when using ccmake or cmake-gui. This is fixed by cmake in version 3.12. Until then deleting the target dependency data at project startup allows the UI to function correctly. Also warns about cosmetic issues when using older cmakes. Change-Id: I8bd2ade9b59e7c27652090d1b6298cb01095a965 [ROCm/ROCR-Runtime commit: 0dae86f686e976b089b3cc5749708298ed7cc1a0] --- .../runtime/hsa-runtime/CMakeLists.txt | 17 +++++++++++++++++ .../hsa-runtime/image/blit_src/CMakeLists.txt | 5 +++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/projects/rocr-runtime/runtime/hsa-runtime/CMakeLists.txt b/projects/rocr-runtime/runtime/hsa-runtime/CMakeLists.txt index 62c92326e3..1a8d2cb6d9 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/CMakeLists.txt +++ b/projects/rocr-runtime/runtime/hsa-runtime/CMakeLists.txt @@ -42,6 +42,23 @@ cmake_minimum_required ( VERSION 3.5.0 ) +## Cosmetic Cmake version warnings. +if(NOT EXISTS VERSION_WARNED) + set (VERSION_WARNED FALSE CACHE BOOL "") +endif() +if(${CMAKE_VERSION} VERSION_LESS "3.6.0" AND NOT ${VERSION_WARNED}) + message("Your CMake version is too old for full functionality. +Generated package file names may be incorrect. +Please update to CMake 3.6 or newer to generate correct package file names") + set( VERSION_WARNED TRUE CACHE BOOL "Suppress cosmetic build errors due to CMake version after first warning." FORCE ) + mark_as_advanced( FORCE VERSION_WARNED ) +endif() + +## Clear target dependency data. +## Needed to allow UI transitions between static and dynamic builds. +## Need an update to CMake 3.12 to remove this hack. See CMake policy change CMP0073. +unset ( hsa-runtime64_LIB_DEPENDS CACHE ) + ## Set core runtime module name and project name. set ( CORE_RUNTIME_NAME "hsa-runtime64" ) set ( CORE_RUNTIME_TARGET "${CORE_RUNTIME_NAME}" ) diff --git a/projects/rocr-runtime/runtime/hsa-runtime/image/blit_src/CMakeLists.txt b/projects/rocr-runtime/runtime/hsa-runtime/image/blit_src/CMakeLists.txt index 12dae5846e..f80b2fd035 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/image/blit_src/CMakeLists.txt +++ b/projects/rocr-runtime/runtime/hsa-runtime/image/blit_src/CMakeLists.txt @@ -46,12 +46,13 @@ cmake_minimum_required ( VERSION 3.5.0 ) set (QUIT 0) # Import target 'clang' -find_package(Clang REQUIRED HINTS ${CMAKE_INSTALL_PREFIX}/llvm PATHS /opt/rocm/llvm ) +find_package(Clang REQUIRED HINTS ${CMAKE_INSTALL_PREFIX}/llvm ${CMAKE_PREFIX_PATH}/llvm PATHS /opt/rocm/llvm ) # Device libs doesn't support find_package yet. get_include_path(BITCODE_DIR "Bitcode library path" RESULT FOUND NAMES "opencl.amdgcn.bc" HINTS "${CMAKE_INSTALL_PREFIX}/lib/bitcode" "${CMAKE_INSTALL_PREFIX}/lib/x86_64/bitcode" - PATHS "/opt/rocm/lib/bitcode" "${CMAKE_INSTALL_PREFIX}/lib/x86_64/bitcode") + "${CMAKE_PREFIX_PATH}/lib/bitcode" "${CMAKE_PREFIX_PATH}/lib/x86_64/bitcode" + PATHS "/opt/rocm/lib/bitcode" "/opt/rocm/lib/x86_64/bitcode") if (NOT ${FOUND}) set (QUIT 1) endif()