SWDEV-561273 - hip samples on TheRock build using HIP LANGUAGE and hip-lang package. (#1794)
This commit is contained in:
@@ -18,9 +18,7 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
project(inline_asm)
|
||||
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
cmake_minimum_required(VERSION 3.21)
|
||||
|
||||
if(UNIX)
|
||||
if(NOT DEFINED ROCM_PATH)
|
||||
@@ -34,27 +32,32 @@ if(UNIX)
|
||||
list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH})
|
||||
endif()
|
||||
|
||||
# Find hip
|
||||
find_package(hip)
|
||||
project(inline_asm LANGUAGES CXX HIP)
|
||||
|
||||
# Set compiler and linker
|
||||
set(CMAKE_CXX_COMPILER ${HIP_HIPCC_EXECUTABLE})
|
||||
set(CMAKE_CXX_LINKER ${HIP_HIPCC_EXECUTABLE})
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
|
||||
# Create the excutable
|
||||
if(TARGET build_cookbook)
|
||||
set(EXCLUDE_OPTION EXCLUDE_FROM_ALL)
|
||||
set(EXCLUDE_OPTION EXCLUDE_FROM_ALL)
|
||||
else()
|
||||
set(EXCLUDE_OPTION )
|
||||
set(EXCLUDE_OPTION)
|
||||
endif()
|
||||
|
||||
# Mark source file as HIP code (contains __global__ kernels)
|
||||
set_source_files_properties(inline_asm.cpp PROPERTIES LANGUAGE HIP)
|
||||
|
||||
add_executable(inline_asm ${EXCLUDE_OPTION} inline_asm.cpp)
|
||||
|
||||
target_include_directories(inline_asm PRIVATE ../../common)
|
||||
|
||||
# Link with HIP
|
||||
target_link_libraries(inline_asm hip::host)
|
||||
# Set RPATH so executable can find HIP libraries at runtime
|
||||
if(UNIX)
|
||||
set_target_properties(inline_asm PROPERTIES
|
||||
BUILD_RPATH "${ROCM_PATH}/lib"
|
||||
INSTALL_RPATH "${ROCM_PATH}/lib"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(TARGET build_cookbook)
|
||||
add_dependencies(build_cookbook inline_asm)
|
||||
add_dependencies(build_cookbook inline_asm)
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user