[SWDEV-431345][SWDEV-432633] toplevel cmake for hip samples

Change-Id: If22e7e96604f184458cc6ab6bb9945152f9359e0
This commit is contained in:
Rahul Manocha committed 2023-12-05 11:36:15 -05:00
1 parent 4a60fe5fd1
commit 7481de706f
33 files changed
+461 -89

No files matched your search

@@ -41,19 +41,23 @@ set(CMAKE_CXX_LINKER ${HIP_HIPCC_EXECUTABLE})
set(CMAKE_BUILD_TYPE Release)
# Create the excutable
add_executable(hipDispatchLatency hipDispatchLatency.cpp)
add_executable(hipDispatchEnqueueRateMT hipDispatchEnqueueRateMT.cpp)
if(TARGET build_utils)
set(EXCLUDE_OPTION EXCLUDE_FROM_ALL)
else()
set(EXCLUDE_OPTION )
endif()
add_executable(hipDispatchLatency ${EXCLUDE_OPTION} hipDispatchLatency.cpp)
add_executable(hipDispatchEnqueueRateMT ${EXCLUDE_OPTION} hipDispatchEnqueueRateMT.cpp)
# Generate code object
add_custom_target(
codeobj
ALL
COMMAND ${HIP_HIPCC_EXECUTABLE} --genco ../test_kernel.cpp -o test_kernel.code
COMMENT "codeobj generated"
codeobj2
COMMAND ${HIP_HIPCC_EXECUTABLE} --genco ${CMAKE_CURRENT_SOURCE_DIR}/test_kernel.cpp -o test_kernel.code
COMMENT "codeobj2 generated"
)
add_dependencies(hipDispatchLatency codeobj)
add_dependencies(hipDispatchEnqueueRateMT codeobj)
add_dependencies(hipDispatchLatency codeobj2)
add_dependencies(hipDispatchEnqueueRateMT codeobj2)
# Link with HIP
target_link_libraries(hipDispatchLatency hip::host)
@@ -63,3 +67,7 @@ if(UNIX)
endif()
set_property(TARGET hipDispatchLatency PROPERTY CXX_STANDARD 11)
set_property(TARGET hipDispatchEnqueueRateMT PROPERTY CXX_STANDARD 11)
if(TARGET build_utils)
add_dependencies(build_utils hipDispatchLatency hipDispatchEnqueueRateMT)
endif()