Add cmake targets to run ocltst test modules

Tests are now excluded from the main build, however ocltst can still be built by running `cmake --build . --target ocltst`.

Test modules can be run by invoking the test_${module_name} target, for example `cmake --build . --target test_oclruntime`.

Change-Id: I6f40d3bd318e821e4fbf35ccfa395dc7036673cb
This commit is contained in:
Vlad Sytchenko
2020-06-03 13:48:39 -04:00
parent 876cf62e0e
commit 8790099ba9
6 changed files with 41 additions and 6 deletions
@@ -49,7 +49,8 @@ set_target_properties(oclruntime PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/tests/ocltst)
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/tests/ocltst
EXCLUDE_FROM_ALL TRUE)
target_compile_definitions(oclruntime
PRIVATE
@@ -77,3 +78,13 @@ add_custom_command(
${CMAKE_BINARY_DIR}/tests/ocltst/oclruntime.exclude)
add_dependencies(ocltst oclruntime)
add_custom_target(test_oclruntime
COMMAND
${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib:$ENV{LD_LIBRARY_PATH}"
$<TARGET_FILE:ocltst> -m $<TARGET_FILE:oclruntime> -A oclruntime.exclude
DEPENDS
ocltst oclruntime amdocl64
WORKING_DIRECTORY
${CMAKE_BINARY_DIR}/tests/ocltst
USES_TERMINAL)