Enable directed tests to build HIP locally via cmake option

This commit is contained in:
Maneesh Gupta
2016-04-04 13:53:24 +05:30
parent 7aad3bab84
commit fdfedbd60f
+12 -3
View File
@@ -8,7 +8,13 @@ include_directories( ${PROJECT_SOURCE_DIR}/include )
set (HIP_Unit_Test_VERSION_MAJOR 1)
set (HIP_Unit_Test_VERSION_MINOR 0)
set (HIP_BUILD_LOCAL 0)
if(NOT DEFINED HIP_BUILD_LOCAL)
if(NOT DEFINED ENV{HIP_BUILD_LOCAL})
set(HIP_BUILD_LOCAL 0 CACHE BOOL "Build HIP in local folder")
else()
set(HIP_BUILD_LOCAL $ENV{HIP_BUILD_LOCAL} CACHE BOOL "Build HIP in local folder")
endif()
endif()
set(HIP_PATH $ENV{HIP_PATH})
if (NOT DEFINED HIP_PATH)
@@ -75,9 +81,12 @@ add_library(test_common OBJECT test_common.cpp )
# usage : make_hip_executable (exe_name CPP_FILES)
macro (make_hip_executable exe cpp)
if (${HIP_PLATFORM} STREQUAL "hcc")
add_executable (${exe} ${cpp} ${ARGN} $<TARGET_OBJECTS:test_common> )
#add_executable (${exe} ${cpp} ${ARGN} $<TARGET_OBJECTS:test_common> )
if (${HIP_BUILD_LOCAL})
target_link_libraries(${exe} hip_hcc)
#target_link_libraries(${exe} hip_hcc)
add_executable (${exe} ${cpp} ${ARGN} $<TARGET_OBJECTS:test_common> $<TARGET_OBJECTS:hip_hcc> )
else()
add_executable (${exe} ${cpp} ${ARGN} $<TARGET_OBJECTS:test_common> )
endif()
else()
add_executable (${exe} ${cpp} ${ARGN} $<TARGET_OBJECTS:test_common> )