@@ -38,20 +38,39 @@ set(IGC_LIT_TEST_DEPENDS
3838 "${IGC_BUILD__PROJ__igc_opt} "
3939 )
4040
41+
42+ # Note:
43+ # This command must be consistent with lit.cfg.py in the following points:
44+ # 1) the path to tests must be consistent with config.test_source_root
45+ # 2) the suffix must be consistent with config.suffixes
46+ # The consistency can be achived by calling a process which returns the list of tests.
47+ file (GLOB_RECURSE _tests "${IGC_TEST_SOURCE_DIR} /*.ll" )
48+ if (MSVC )
49+ source_group (TREE "${IGC_TEST_SOURCE_DIR} " PREFIX "tests" FILES ${_tests} )
50+ endif ()
51+
4152# This will create a target called `check-igc`, which will run all tests from
4253# IGC/Compiler/tests directory. The tests will be run on files in the source
4354# directory, since they are not modified, there doesn't seem to be any reason
4455# for copying them.
45- add_lit_testsuite(check-igc "Running the IGC LIT tests"
46- ${IGC_TEST_BINARY_DIR}
47- DEPENDS ${IGC_LIT_TEST_DEPENDS}
48- )
56+ if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.17" )
57+ igc_add_lit_target(check-igc "${IGC_TEST_BINARY_DIR} " "Running the IGC LIT tests"
58+ DEPENDS ${IGC_LIT_TEST_DEPENDS} ${_tests}
59+ SOURCES ${_tests} ${CMAKE_CURRENT_SOURCE_DIR} /lit.cfg.py
60+ )
61+ else ()
62+ add_lit_testsuite(check-igc "Running the IGC LIT tests"
63+ ${IGC_TEST_BINARY_DIR}
64+ DEPENDS ${IGC_LIT_TEST_DEPENDS}
65+ )
66+ endif ()
4967
5068# Tests should not be excluded from "Build Solution" in VS.
5169set_target_properties (check-igc
52- PROPERTIES
53- EXCLUDE_FROM_DEFAULT_BUILD OFF
54- EXCLUDE_FROM_ALL OFF )
70+ PROPERTIES
71+ EXCLUDE_FROM_DEFAULT_BUILD OFF
72+ EXCLUDE_FROM_ALL OFF
73+ )
5574
5675# Line below is just used to group LIT reated targets in single directory
5776# in IDE. This is completely optional.
0 commit comments