Skip to content

Miscellaneous changes to support in-tree builds.#185

Open
stellaraccident wants to merge 1 commit into
ROCm:masterfrom
stellaraccident:support_intree_build
Open

Miscellaneous changes to support in-tree builds.#185
stellaraccident wants to merge 1 commit into
ROCm:masterfrom
stellaraccident:support_intree_build

Conversation

@stellaraccident
Copy link
Copy Markdown
Contributor

  • Conditions find_package hsakmt on the pressence of the target.
  • Move finding of clang/llvm-objcopy to a common place and use an in-tree target if available.
  • Add options for depending on in-tree device libs.

This is a roll-up of changes that I needed to do in order to build ROCR-Runtime with other parts of the toolkit. In my final arrangement, I am only using the first point, but I believe the second/third are general improvements -- so including those as well.

* Conditions find_package hsakmt on the pressence of the target.
* Move finding of clang/llvm-objcopy to a common place and use an in-tree target if available.
* Add options for depending on in-tree device libs.

This is a roll-up of changes that I needed to do in order to build ROCR-Runtime with other parts of the toolkit. In my final arrangement, I am only using the first point, but I believe the second/third are general improvements -- so including those as well.
Comment thread src/CMakeLists.txt
if(TARGET hsakmt::hsakmt)
message(STATUS "Using build dep on hsakmt")
else()
find_package(hsakmt 1.0 REQUIRED HINTS ${CMAKE_INSTALL_PREFIX} PATHS /opt/rocm)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The find_package should be disabled by the superproject either by using the OVERRIDE_FIND_PACKAGE in FetchContent_Declare or by using the register_source_package function as described here:

function(register_source_package NAME)
  file(WRITE "${CMAKE_BINARY_DIR}/__pkg/${NAME}/${NAME}Config.cmake" "")
  set(${NAME}_DIR ${CMAKE_BINARY_DIR}/__pkg/${NAME} CACHE PATH "")
endfunction()

Comment thread src/CMakeLists.txt
pkg_check_modules(drm REQUIRED IMPORTED_TARGET libdrm)

## Find dependencies that may be built with us or from an installed package.
if(TARGET hsakmt::hsakmt)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not be checking for if(TARGET) as this would require the superproject to order the add_subdirectory based on the dependency order. This can be quite fragile as we would need to change the order if the dependencies between components change. Instead we should just let cmake order the dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants