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

@ -63,3 +63,33 @@ macro(create_project_source_tree_with_exports target exports_filename)
endif()
endif()
endmacro()
macro(apply_macro_for_each_gen type)
set(given_type ${type})
foreach(GEN_TYPE ${ALL_GEN_TYPES})
string(TOLOWER ${GEN_TYPE} GEN_TYPE_LOWER)
GEN_CONTAINS_PLATFORMS(${given_type} ${GEN_TYPE} GENX_HAS_PLATFORMS)
if(${GENX_HAS_PLATFORMS})
macro_for_each_gen()
endif()
endforeach()
endmacro()
macro(apply_macro_for_each_platform)
GET_PLATFORMS_FOR_GEN(${given_type} ${GEN_TYPE} TESTED_GENX_PLATFORMS)
foreach(PLATFORM_IT ${TESTED_GENX_PLATFORMS})
string(TOLOWER ${PLATFORM_IT} PLATFORM_IT_LOWER)
macro_for_each_platform()
endforeach()
endmacro()
macro(apply_macro_for_each_test_config type)
GET_TEST_CONFIGURATIONS_FOR_PLATFORM(${type} ${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)
macro_for_each_test_config()
endforeach()
endmacro()