Cmake refactor part 21

Add macro to simplify iteration for gens, platforms and test configs
Common usage:
1. Write macro "macro_for_each_platform", you can use variables:
   GEN_TYPE, GEN_TYPE_LOWER, PLATFORM_IT, PLATFORM_IT_LOWER
2. Write macro "macro_for_each_gen", you can use variables:
   GEN_TYPE, GEN_TYPE_LOWER
3. In macro "macro_for_each_gen" call "apply_macro_for_each_platform"
4. Call "apply_macro_for_each_gen" with gen type (SUPPORTED/TESTED)

When needed iterate over test configurations:
1. Write macro "macro_for_each_test_config", you can use variables from
   parent macro and SLICES, SUBSLICES and EU_PER_SS
2. In macro "macro_for_each_platform" call "apply_macro_for_each_test_config"
   with specified type (AUB_TESTS/MT_TESTS/UNIT_TESTS)

Change-Id: Icd537f409a224a1ffade1874065f8fee66189350
This commit is contained in:
Mateusz Jablonski
2018-03-22 11:35:24 +01:00
committed by sys_ocldev
parent cbf2118275
commit e3b1ba2112
14 changed files with 262 additions and 282 deletions

View File

@ -66,38 +66,34 @@ target_link_libraries(igdrcl_aub_tests gtest gmock ${IGDRCL_EXTRA_LIBS})
target_include_directories(igdrcl_aub_tests BEFORE PRIVATE ${IGDRCL_SOURCE_DIR}/unit_tests/gen_common)
foreach(GEN_TYPE ${ALL_GEN_TYPES})
GEN_CONTAINS_PLATFORMS("TESTED" ${GEN_TYPE} GENX_HAS_PLATFORMS)
if(${GENX_HAS_PLATFORMS})
GET_PLATFORMS_FOR_GEN("TESTED" ${GEN_TYPE} TESTED_GENX_PLATFORMS)
foreach(PLATFORM_IT ${TESTED_GENX_PLATFORMS})
string(TOLOWER ${PLATFORM_IT} PLATFORM_IT_LOWER)
add_custom_target(${PLATFORM_IT_LOWER}_aub_tests
DEPENDS igdrcl_aub_tests
DEPENDS copy_test_files_${PLATFORM_IT_LOWER}
)
add_dependencies(${PLATFORM_IT_LOWER}_aub_tests test_kernels_${PLATFORM_IT_LOWER})
add_dependencies(${PLATFORM_IT_LOWER}_aub_tests test_kernel_${PLATFORM_IT_LOWER})
PLATFORM_HAS_2_0(${GEN_TYPE} ${PLATFORM_IT} PLATFORM_SUPPORTS_2_0)
if(${PLATFORM_SUPPORTS_2_0})
add_dependencies(${PLATFORM_IT_LOWER}_aub_tests test_kernel_2_0_${PLATFORM_IT_LOWER})
endif(${PLATFORM_SUPPORTS_2_0})
add_custom_target(run_${PLATFORM_IT_LOWER}_aub_tests ALL DEPENDS ${PLATFORM_IT_LOWER}_aub_tests)
add_dependencies(run_aub_tests run_${PLATFORM_IT_LOWER}_aub_tests)
set_target_properties(${PLATFORM_IT_LOWER}_aub_tests PROPERTIES FOLDER "${PLATFORM_SPECIFIC_TARGETS_FOLDER}/${PLATFORM_IT_LOWER}")
set_target_properties(run_${PLATFORM_IT_LOWER}_aub_tests PROPERTIES FOLDER "${PLATFORM_SPECIFIC_TARGETS_FOLDER}/${PLATFORM_IT_LOWER}")
if(WIN32)
add_dependencies(${PLATFORM_IT_LOWER}_aub_tests mock_gdi)
endif()
GET_TEST_CONFIGURATIONS_FOR_PLATFORM("AUB_TESTS" ${GEN_TYPE} ${PLATFORM_IT} PLATFORM_CONFIGURATIONS)
foreach(PLATFORM_CONFIGURATION ${PLATFORM_CONFIGURATIONS})
string(REPLACE "/" ";" CONFIGURATION_PARAMS ${PLATFORM_CONFIGURATION})
list(GET CONFIGURATION_PARAMS 1 SLICES)
list(GET CONFIGURATION_PARAMS 2 SUBSLICES)
list(GET CONFIGURATION_PARAMS 3 EU_PER_SS)
neo_run_aub_target(${PLATFORM_IT_LOWER} "${PLATFORM_IT} ${SLICES}x${SUBSLICES}x${EU_PER_SS}" ${PLATFORM_IT_LOWER} ${SLICES} ${SUBSLICES} ${EU_PER_SS})
endforeach()
endforeach()
macro(macro_for_each_test_config)
neo_run_aub_target(${PLATFORM_IT_LOWER} "${PLATFORM_IT} ${SLICES}x${SUBSLICES}x${EU_PER_SS}" ${PLATFORM_IT_LOWER} ${SLICES} ${SUBSLICES} ${EU_PER_SS})
endmacro()
macro(macro_for_each_platform)
add_custom_target(${PLATFORM_IT_LOWER}_aub_tests
DEPENDS igdrcl_aub_tests
DEPENDS copy_test_files_${PLATFORM_IT_LOWER}
)
add_dependencies(${PLATFORM_IT_LOWER}_aub_tests test_kernels_${PLATFORM_IT_LOWER})
add_dependencies(${PLATFORM_IT_LOWER}_aub_tests test_kernel_${PLATFORM_IT_LOWER})
PLATFORM_HAS_2_0(${GEN_TYPE} ${PLATFORM_IT} PLATFORM_SUPPORTS_2_0)
if(${PLATFORM_SUPPORTS_2_0})
add_dependencies(${PLATFORM_IT_LOWER}_aub_tests test_kernel_2_0_${PLATFORM_IT_LOWER})
endif(${PLATFORM_SUPPORTS_2_0})
add_custom_target(run_${PLATFORM_IT_LOWER}_aub_tests ALL DEPENDS ${PLATFORM_IT_LOWER}_aub_tests)
add_dependencies(run_aub_tests run_${PLATFORM_IT_LOWER}_aub_tests)
set_target_properties(${PLATFORM_IT_LOWER}_aub_tests PROPERTIES FOLDER "${PLATFORM_SPECIFIC_TARGETS_FOLDER}/${PLATFORM_IT_LOWER}")
set_target_properties(run_${PLATFORM_IT_LOWER}_aub_tests PROPERTIES FOLDER "${PLATFORM_SPECIFIC_TARGETS_FOLDER}/${PLATFORM_IT_LOWER}")
if(WIN32)
add_dependencies(${PLATFORM_IT_LOWER}_aub_tests mock_gdi)
endif()
endforeach()
apply_macro_for_each_test_config("AUB_TESTS")
endmacro()
macro(macro_for_each_gen)
apply_macro_for_each_platform()
endmacro()
apply_macro_for_each_gen("TESTED")
create_project_source_tree(igdrcl_aub_tests ${IGDRCL_SOURCE_DIR}/runtime ${IGDRCL_SOURCE_DIR}/unit_tests)