-
Notifications
You must be signed in to change notification settings - Fork 124
Miscellaneous changes to support in-tree builds. #185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
stellaraccident
wants to merge
1
commit into
ROCm:master
Choose a base branch
from
stellaraccident:support_intree_build
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -95,9 +95,15 @@ set ( PACKAGE_VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_COMMIT | |
| ## Find external dependencies. | ||
| find_package(PkgConfig) | ||
| find_package(LibElf REQUIRED) | ||
| find_package(hsakmt 1.0 REQUIRED HINTS ${CMAKE_INSTALL_PREFIX} PATHS /opt/rocm) | ||
| 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) | ||
| message(STATUS "Using build dep on hsakmt") | ||
| else() | ||
| find_package(hsakmt 1.0 REQUIRED HINTS ${CMAKE_INSTALL_PREFIX} PATHS /opt/rocm) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The 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()
|
||
| endif() | ||
|
|
||
| ## Create the rocr target. | ||
| add_library( ${CORE_RUNTIME_TARGET} "" ) | ||
|
|
||
|
|
@@ -126,6 +132,19 @@ target_include_directories( ${CORE_RUNTIME_TARGET} | |
| ${CMAKE_CURRENT_BINARY_DIR}/core/runtime/trap_handler | ||
| ${CMAKE_CURRENT_BINARY_DIR}/core/runtime/blit_shaders) | ||
|
|
||
| ## ------------------------- Device Library Options ---------------------------- | ||
| set(ROCR_RUNTIME_DEVICE_LIB_PATH "" CACHE PATH "Builds against custom device-lib bitcode files (passed to clang --rocm-device-lib-path=)") | ||
| set(ROCR_RUNTIME_DEVICE_LIB_DEPS "" CACHE STRING "Custom deps to depend on to ensure device libs are built") | ||
|
|
||
| if (ROCR_RUNTIME_DEVICE_LIB_PATH) | ||
| message(STATUS "ROCR Runtime custom device lib path: ${ROCR_RUNTIME_DEVICE_LIB_PATH}") | ||
| if(NOT IS_DIRECTORY "${ROCR_RUNTIME_DEVICE_LIB_PATH}") | ||
| message(WARNING "Custom ROCR_RUNTIME_DEVICE_LIB_PATH does not exist") | ||
| endif() | ||
| set(ROCR_RUNTIME_CLANG_DEVICE_LIB_ARGS "--rocm-device-lib-path=${ROCR_RUNTIME_DEVICE_LIB_PATH}") | ||
| else() | ||
| set(ROCR_RUNTIME_CLANG_DEVICE_LIB_ARGS) | ||
| endif() | ||
|
|
||
| ## ------------------------- Linux Compiler and Linker options ------------------------- | ||
| set ( HSA_CXX_FLAGS ${HSA_COMMON_CXX_FLAGS} -fexceptions -fno-rtti -fvisibility=hidden -Wno-error=missing-braces -Wno-error=sign-compare -Wno-sign-compare -Wno-write-strings -Wno-conversion-null -fno-math-errno -fno-threadsafe-statics -fmerge-all-constants -fms-extensions -Wno-error=comment -Wno-comment -Wno-error=pointer-arith -Wno-pointer-arith -Wno-error=unused-variable -Wno-error=unused-function ) | ||
|
|
@@ -157,6 +176,24 @@ target_compile_options(${CORE_RUNTIME_TARGET} PRIVATE ${HSA_CXX_FLAGS}) | |
| set_property(TARGET ${CORE_RUNTIME_TARGET} PROPERTY LINK_FLAGS ${HSA_SHARED_LINK_FLAGS}) | ||
| ## ------------------------- End Compiler and Linker options ---------------------------- | ||
|
|
||
| ## Ensure that 'clang' and 'llvm-objcopy' targets are available | ||
| if(NOT TARGET clang OR NOT TARGET llvm-objcopy) | ||
| if(TARGET clang OR TARGET llvm-objcopy) | ||
| message(FATAL_ERROR "Detected one of 'clang' or 'llvm-objcopy' targets but not both") | ||
| endif() | ||
| message(STATUS "LLVM deps not found: finding Clang and LLVM packages") | ||
| find_package(Clang REQUIRED HINTS ${CMAKE_PREFIX_PATH}/llvm PATHS /opt/rocm/llvm ) | ||
| find_package(LLVM REQUIRED HINTS ${CMAKE_PREFIX_PATH}/llvm PATHS /opt/rocm/llvm ) | ||
| endif() | ||
|
|
||
| if(${CMAKE_VERBOSE_MAKEFILE}) | ||
| get_property(clang_path TARGET clang PROPERTY LOCATION) | ||
| get_property(objcopy_path TARGET llvm-objcopy PROPERTY LOCATION) | ||
| message("Using clang from: ${clang_path}") | ||
| message("Using llvm-objcopy from: ${objcopy_path}") | ||
| message("Trap handlers assembled for: ${TARGET_DEVS}") | ||
| endif() | ||
|
|
||
| ## Source files. | ||
| set ( SRCS core/util/lnx/os_linux.cpp | ||
| core/util/small_heap.cpp | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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 theadd_subdirectorybased 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.