2017-12-21 07:45:38 +08:00
|
|
|
#
|
2019-11-26 18:19:13 +08:00
|
|
|
# Copyright (C) 2017-2020 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
#
|
2018-09-18 15:11:08 +08:00
|
|
|
# SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
#
|
|
|
|
|
|
|
|
project(igdrcl_tests)
|
|
|
|
|
2018-03-08 16:14:07 +08:00
|
|
|
set(TEST_PROJECTS_FOLDER "opencl runtime")
|
|
|
|
set(PLATFORM_SPECIFIC_TARGETS_FOLDER "${TEST_PROJECTS_FOLDER}/test platforms")
|
|
|
|
|
2018-11-16 20:29:24 +08:00
|
|
|
# disable optimizations for ults
|
|
|
|
if(UNIX)
|
2018-12-06 16:58:20 +08:00
|
|
|
string(REPLACE "-O2" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
2018-11-16 20:29:24 +08:00
|
|
|
#disable fortify source as this requires optimization to be on
|
2019-11-26 18:19:13 +08:00
|
|
|
string(REPLACE "-Wp,-D_FORTIFY_SOURCE=2" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
2018-11-16 20:29:24 +08:00
|
|
|
string(REPLACE "-D_FORTIFY_SOURCE=2" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O0")
|
2019-04-24 23:42:10 +08:00
|
|
|
set(CMAKE_CXX_FLAGS_RELEASEINTERNAL "${CMAKE_CXX_FLAGS_RELEASEINTERNAL} -O0")
|
2018-11-16 20:29:24 +08:00
|
|
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O0")
|
2019-04-24 23:42:10 +08:00
|
|
|
set(CMAKE_C_FLAGS_RELEASEINTERNAL "${CMAKE_C_FLAGS_RELEASEINTERNAL} -O0")
|
2018-11-16 20:29:24 +08:00
|
|
|
endif()
|
|
|
|
|
2018-11-16 16:44:24 +08:00
|
|
|
if(WIN32)
|
2018-12-06 16:58:20 +08:00
|
|
|
string(REPLACE "/O2" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
|
|
|
string(REPLACE "/O2" "/Od" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
|
|
|
|
string(REPLACE "/O2" "/Od" CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
|
|
|
|
string(REPLACE "/O2" "/Od" CMAKE_CXX_FLAGS_RELEASEINTERNAL ${CMAKE_CXX_FLAGS_RELEASEINTERNAL})
|
|
|
|
string(REPLACE "/O2" "/Od" CMAKE_C_FLAGS_RELEASEINTERNAL ${CMAKE_C_FLAGS_RELEASEINTERNAL})
|
2018-11-16 16:44:24 +08:00
|
|
|
endif()
|
|
|
|
|
2019-12-23 17:47:20 +08:00
|
|
|
function(ADD_SUPPORTED_TEST_PRODUCT_FAMILIES_DEFINITION)
|
|
|
|
set(NEO_SUPPORTED_PRODUCT_FAMILIES ${ALL_PRODUCT_FAMILY_LIST})
|
|
|
|
string(REPLACE ";" "," NEO_SUPPORTED_PRODUCT_FAMILIES "${NEO_SUPPORTED_PRODUCT_FAMILIES}")
|
|
|
|
add_definitions(-DSUPPORTED_TEST_PRODUCT_FAMILIES=${NEO_SUPPORTED_PRODUCT_FAMILIES})
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
ADD_SUPPORTED_TEST_PRODUCT_FAMILIES_DEFINITION()
|
2019-02-19 20:23:14 +08:00
|
|
|
link_libraries(${ASAN_LIBS} ${TSAN_LIBS})
|
|
|
|
|
2018-03-01 21:25:19 +08:00
|
|
|
add_custom_target(unit_tests)
|
2019-11-05 16:40:19 +08:00
|
|
|
add_custom_target(prepare_test_kernels)
|
2018-03-14 19:45:24 +08:00
|
|
|
add_custom_target(run_unit_tests ALL)
|
2018-03-01 21:25:19 +08:00
|
|
|
|
|
|
|
set(IGDRCL_SRCS_tests_local
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
2019-01-25 20:49:29 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/libult/os_interface.cpp
|
2018-08-27 18:11:07 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/tests_configuration.h
|
2018-03-01 21:25:19 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/ult_configuration.cpp
|
|
|
|
)
|
|
|
|
|
2018-05-11 15:44:37 +08:00
|
|
|
if(WIN32)
|
2020-02-23 22:20:22 +08:00
|
|
|
list(APPEND IGDRCL_SRCS_tests_local ${NEO_SOURCE_DIR}/opencl/test/unit_test/os_interface/windows/wddm_create.cpp)
|
2018-05-11 15:44:37 +08:00
|
|
|
endif()
|
|
|
|
|
2018-03-01 21:25:19 +08:00
|
|
|
add_subdirectory(libult)
|
|
|
|
|
2018-03-14 19:45:24 +08:00
|
|
|
hide_subdir(libult)
|
|
|
|
hide_subdir(linux)
|
|
|
|
|
|
|
|
if(UNIX)
|
|
|
|
add_subdirectory(linux)
|
|
|
|
add_custom_command(
|
|
|
|
TARGET run_unit_tests
|
|
|
|
POST_BUILD
|
|
|
|
COMMAND echo running tests for linux dynamic library - .so in ${TargetDir}
|
|
|
|
COMMAND igdrcl_linux_dll_tests ${IGDRCL_TESTS_LISTENER_OPTION}
|
|
|
|
COMMAND WORKING_DIRECTORY ${TargetDir}
|
|
|
|
)
|
|
|
|
if(PRE_ULT_COMMAND)
|
|
|
|
add_custom_command(
|
|
|
|
TARGET unit_tests
|
|
|
|
POST_BUILD
|
|
|
|
COMMAND echo running ${PRE_ULT_COMMAND} utility before ULTs execution
|
|
|
|
COMMAND ${PRE_ULT_COMMAND}
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2018-03-01 21:25:19 +08:00
|
|
|
set(NEO_IGDRCL_TESTS__TARGET_OBJECTS
|
|
|
|
$<TARGET_OBJECTS:igdrcl_libult>
|
|
|
|
$<TARGET_OBJECTS:igdrcl_libult_cs>
|
2018-03-20 17:58:28 +08:00
|
|
|
$<TARGET_OBJECTS:igdrcl_libult_env>
|
2020-01-09 23:14:59 +08:00
|
|
|
$<TARGET_OBJECTS:mock_gmm>
|
2018-03-01 21:25:19 +08:00
|
|
|
$<TARGET_OBJECTS:${SHARINGS_ENABLE_LIB_NAME}>
|
|
|
|
$<TARGET_OBJECTS:${BUILTINS_SOURCES_LIB_NAME}>
|
2020-02-20 23:00:19 +08:00
|
|
|
$<TARGET_OBJECTS:${BUILTINS_VME_LIB_NAME}>
|
2018-03-01 21:25:19 +08:00
|
|
|
$<TARGET_OBJECTS:${BUILTINS_BINARIES_LIB_NAME}>
|
|
|
|
$<TARGET_OBJECTS:${SCHEDULER_BINARY_LIB_NAME}>
|
|
|
|
)
|
|
|
|
|
2018-12-07 16:42:35 +08:00
|
|
|
if(DEFINED AUB_STREAM_DIR)
|
2019-06-24 19:48:14 +08:00
|
|
|
add_library (aub_stream_mock_lib OBJECT EXCLUDE_FROM_ALL
|
2020-02-23 22:20:22 +08:00
|
|
|
${NEO_SOURCE_DIR}/opencl/test/unit_test/aub_stream_mocks/aub_stream_interface_mock.cpp
|
2018-12-11 00:12:32 +08:00
|
|
|
)
|
2019-01-19 04:44:23 +08:00
|
|
|
list(APPEND NEO_IGDRCL_TESTS__TARGET_OBJECTS
|
|
|
|
$<TARGET_OBJECTS:${AUB_STREAM_PROJECT_NAME}_all_hw>
|
2018-12-11 00:12:32 +08:00
|
|
|
$<TARGET_OBJECTS:aub_stream_mock_lib>
|
|
|
|
)
|
|
|
|
else()
|
2020-02-23 05:50:57 +08:00
|
|
|
list(APPEND IGDRCL_SRCS_tests_local ${NEO_SOURCE_DIR}/opencl/source/aub/aub_stream_interface.cpp)
|
2018-12-07 16:42:35 +08:00
|
|
|
endif()
|
|
|
|
|
2018-03-01 21:25:19 +08:00
|
|
|
add_executable(igdrcl_tests
|
|
|
|
${NEO_IGDRCL_TESTS__TARGET_OBJECTS}
|
|
|
|
${IGDRCL_SRCS_tests_local}
|
|
|
|
)
|
2019-01-19 04:44:23 +08:00
|
|
|
|
2020-02-23 22:20:22 +08:00
|
|
|
include(${NEO_SOURCE_DIR}/opencl/test/unit_test/core_unit_tests_files.cmake)
|
2019-12-03 04:04:32 +08:00
|
|
|
|
2018-10-31 01:00:15 +08:00
|
|
|
hide_subdir(gen_common)
|
|
|
|
add_subdirectory(gen_common)
|
2018-03-01 21:25:19 +08:00
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
if(NOT GTEST_REPEAT)
|
|
|
|
set(GTEST_REPEAT 1 CACHE STRING "Google test iterations")
|
2018-03-13 16:03:21 +08:00
|
|
|
endif()
|
2017-12-21 07:45:38 +08:00
|
|
|
set(GTEST_REPEAT ${GTEST_REPEAT} CACHE STRING "Google test iterations")
|
|
|
|
|
2019-06-14 07:56:07 +08:00
|
|
|
if(NOT DEFINED GTEST_XML_OUTPUT_DIR)
|
|
|
|
set(GTEST_XML_OUTPUT_DIR "test_logs")
|
|
|
|
endif()
|
|
|
|
set(GTEST_XML_OUTPUT_DIR ${GTEST_XML_OUTPUT_DIR} CACHE STRING "Google Test xml output file location")
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
message(STATUS "GTest repeat count set to ${GTEST_REPEAT}")
|
|
|
|
if(NOT GTEST_SHUFFLE)
|
|
|
|
set(GTEST_SHUFFLE --gtest_shuffle --gtest_random_seed=0)
|
2018-03-13 16:03:21 +08:00
|
|
|
endif()
|
2017-12-21 07:45:38 +08:00
|
|
|
message(STATUS "GTest shuffle set to ${GTEST_SHUFFLE}")
|
|
|
|
|
2018-03-13 16:03:21 +08:00
|
|
|
if(NOT GTEST_EXCEPTION_OPTIONS)
|
|
|
|
set(GTEST_EXCEPTION_OPTIONS --gtest_catch_exceptions=1)
|
|
|
|
endif()
|
|
|
|
message(STATUS "GTest exception options set to ${GTEST_EXCEPTION_OPTIONS}")
|
|
|
|
|
2018-01-12 00:39:26 +08:00
|
|
|
if(GTEST_FILTERING_PATTERN)
|
|
|
|
set(GTEST_FILTER_OPTION "--gtest_filter=${GTEST_FILTERING_PATTERN}")
|
|
|
|
message(STATUS "GTest filter for regular tests: ${GTEST_FILTERING_PATTERN}")
|
2018-03-13 16:03:21 +08:00
|
|
|
endif()
|
2018-01-12 00:39:26 +08:00
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
if(NOT MSVC)
|
|
|
|
set_source_files_properties(helpers/uint16_sse4_tests.cpp PROPERTIES COMPILE_FLAGS -msse4.2)
|
2018-03-14 19:45:24 +08:00
|
|
|
endif()
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2020-02-25 20:31:00 +08:00
|
|
|
target_link_libraries(igdrcl_tests ${NEO_MOCKABLE_LIB_NAME} ${NEO_CORE_MOCKABLE_LIB_NAME} ${NEO_MOCKABLE_LIB_NAME} ${NEO_CORE_MOCKABLE_LIB_NAME})
|
2018-02-19 21:24:56 +08:00
|
|
|
target_link_libraries(igdrcl_tests igdrcl_mocks)
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-02-21 17:03:07 +08:00
|
|
|
option(SHOW_VERBOSE_UTESTS_RESULTS "Use the default/verbose test output" OFF)
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
if(NOT SHOW_VERBOSE_UTESTS_RESULTS)
|
|
|
|
set(IGDRCL_TESTS_LISTENER_OPTION "--disable_default_listener")
|
2019-01-28 15:27:26 +08:00
|
|
|
else()
|
|
|
|
set(IGDRCL_TESTS_LISTENER_OPTION "--enable_default_listener")
|
2017-12-21 07:45:38 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
target_include_directories(igdrcl_tests PRIVATE
|
2020-02-23 22:20:22 +08:00
|
|
|
${NEO_SOURCE_DIR}/opencl/test/unit_test/mocks${BRANCH_DIR_SUFFIX}
|
2019-03-27 17:06:29 +08:00
|
|
|
${ENGINE_NODE_DIR}
|
2018-08-27 22:30:40 +08:00
|
|
|
${KHRONOS_GL_HEADERS_DIR}
|
2019-04-01 18:57:35 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
2017-12-21 07:45:38 +08:00
|
|
|
)
|
|
|
|
|
2018-05-09 06:57:07 +08:00
|
|
|
target_link_libraries(igdrcl_tests gmock-gtest ${IGDRCL_EXTRA_LIBS})
|
2018-03-14 19:45:24 +08:00
|
|
|
|
2020-02-24 20:10:44 +08:00
|
|
|
set(BUILT_IN_KERNEL_DIR "${NEO_SOURCE_DIR}/shared/source/built_ins")
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2018-03-14 19:45:24 +08:00
|
|
|
function(neo_copy_test_files target product)
|
|
|
|
set(outputdir "${TargetDir}/${product}")
|
2017-12-21 07:45:38 +08:00
|
|
|
add_custom_target(${target})
|
|
|
|
add_custom_command(
|
|
|
|
TARGET ${target}
|
|
|
|
POST_BUILD
|
2018-03-14 19:45:24 +08:00
|
|
|
COMMAND echo deleting and re-creating ${product} cache directory...
|
2017-12-21 07:45:38 +08:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E remove_directory ${outputdir}/cl_cache
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${outputdir}/cl_cache
|
|
|
|
COMMAND echo copying built-in kernel files from ${BUILT_IN_KERNEL_DIR}/kernels to ${outputdir}/test_files
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory ${BUILT_IN_KERNEL_DIR}/kernels ${outputdir}/test_files
|
2020-02-23 22:20:22 +08:00
|
|
|
COMMAND echo copying test files from ${NEO_SOURCE_DIR}/opencl/test/unit_test/test_files to ${outputdir}/test_files
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory ${NEO_SOURCE_DIR}/opencl/test/unit_test/test_files ${outputdir}/test_files
|
2017-12-21 07:45:38 +08:00
|
|
|
COMMAND WORKING_DIRECTORY ${TargetDir}
|
2020-02-23 22:20:22 +08:00
|
|
|
DEPENDS ${NEO_SOURCE_DIR}/opencl/test/unit_test/test_files
|
2017-12-21 07:45:38 +08:00
|
|
|
)
|
|
|
|
add_dependencies(${target} copy_compiler_files)
|
2018-03-14 19:45:24 +08:00
|
|
|
set_target_properties(${target} PROPERTIES FOLDER "${PLATFORM_SPECIFIC_TARGETS_FOLDER}/${product}")
|
2017-12-21 07:45:38 +08:00
|
|
|
endfunction()
|
|
|
|
|
2018-03-01 21:25:19 +08:00
|
|
|
add_dependencies(unit_tests
|
|
|
|
igdrcl_tests
|
|
|
|
test_dynamic_lib
|
2019-11-05 16:40:19 +08:00
|
|
|
prepare_test_kernels
|
2017-12-21 07:45:38 +08:00
|
|
|
)
|
|
|
|
|
2018-03-08 16:14:07 +08:00
|
|
|
set_target_properties(igdrcl_tests PROPERTIES FOLDER ${TEST_PROJECTS_FOLDER})
|
2017-12-21 07:45:38 +08:00
|
|
|
set_property(TARGET igdrcl_tests APPEND_STRING PROPERTY COMPILE_FLAGS ${ASAN_FLAGS})
|
2018-03-14 19:45:24 +08:00
|
|
|
if(UNIX)
|
2017-12-21 07:45:38 +08:00
|
|
|
set_property(TARGET igdrcl_tests APPEND_STRING PROPERTY COMPILE_FLAGS " -g")
|
|
|
|
endif()
|
|
|
|
|
2018-03-08 16:14:07 +08:00
|
|
|
set_target_properties(unit_tests PROPERTIES FOLDER ${TEST_PROJECTS_FOLDER})
|
2019-11-05 16:40:19 +08:00
|
|
|
set_target_properties(prepare_test_kernels PROPERTIES FOLDER ${TEST_PROJECTS_FOLDER})
|
2018-03-08 16:14:07 +08:00
|
|
|
set_target_properties(run_unit_tests PROPERTIES FOLDER ${TEST_PROJECTS_FOLDER})
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2020-02-24 07:22:25 +08:00
|
|
|
target_include_directories(igdrcl_tests BEFORE PRIVATE ${NEO_CORE_TEST_DIRECTORY}/unit_test/test_macros${BRANCH_DIR_SUFFIX})
|
2018-03-14 19:45:24 +08:00
|
|
|
|
|
|
|
if(WIN32)
|
2018-11-19 23:29:16 +08:00
|
|
|
set(cloc_cmd_prefix ocloc)
|
2018-03-14 19:45:24 +08:00
|
|
|
else()
|
2020-01-14 21:38:19 +08:00
|
|
|
if(DEFINED NEO__IGC_LIBRARY_PATH)
|
2020-02-07 21:06:50 +08:00
|
|
|
set(cloc_cmd_prefix LD_LIBRARY_PATH=${NEO__IGC_LIBRARY_PATH}:$<TARGET_FILE_DIR:ocloc_lib> $<TARGET_FILE:ocloc>)
|
2018-06-19 05:51:12 +08:00
|
|
|
else()
|
2020-02-07 21:06:50 +08:00
|
|
|
set(cloc_cmd_prefix LD_LIBRARY_PATH=$<TARGET_FILE_DIR:ocloc_lib> $<TARGET_FILE:ocloc>)
|
2018-06-19 05:51:12 +08:00
|
|
|
endif()
|
2017-12-21 07:45:38 +08:00
|
|
|
endif()
|
|
|
|
|
2019-11-05 16:40:19 +08:00
|
|
|
function(neo_gen_kernels platform_name_with_type platform_name suffix)
|
2018-04-18 00:11:50 +08:00
|
|
|
set(outputdir "${TargetDir}/${suffix}/test_files/${NEO_ARCH}/")
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-11-05 16:40:19 +08:00
|
|
|
set(kernels_to_compile)
|
2017-12-21 07:45:38 +08:00
|
|
|
foreach(filepath ${ARGN})
|
|
|
|
get_filename_component(filename ${filepath} NAME)
|
|
|
|
get_filename_component(basename ${filepath} NAME_WE)
|
2018-09-25 07:04:23 +08:00
|
|
|
get_filename_component(workdir ${filepath} DIRECTORY)
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2018-04-18 00:11:50 +08:00
|
|
|
set(outputpath_base "${outputdir}${basename}_${suffix}")
|
2017-12-21 07:45:38 +08:00
|
|
|
set(output_files
|
2019-02-08 22:37:37 +08:00
|
|
|
${outputpath_base}.spv
|
2017-12-21 07:45:38 +08:00
|
|
|
${outputpath_base}.bin
|
|
|
|
${outputpath_base}.gen
|
|
|
|
)
|
|
|
|
|
2018-03-14 19:45:24 +08:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${output_files}
|
2018-04-18 00:11:50 +08:00
|
|
|
COMMAND ${cloc_cmd_prefix} -q -file ${filename} -device ${platform_name} -${NEO_BITS} -out_dir ${outputdir}
|
2018-03-14 19:45:24 +08:00
|
|
|
WORKING_DIRECTORY ${workdir}
|
2018-11-19 23:29:16 +08:00
|
|
|
DEPENDS ${filepath} ocloc
|
2018-03-14 19:45:24 +08:00
|
|
|
)
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-11-05 16:40:19 +08:00
|
|
|
list(APPEND kernels_to_compile ${output_files})
|
2017-12-21 07:45:38 +08:00
|
|
|
endforeach()
|
2019-11-05 16:40:19 +08:00
|
|
|
list(APPEND kernels_to_compile_${platform_name_with_type} ${kernels_to_compile})
|
|
|
|
set(kernels_to_compile_${platform_name_with_type} ${kernels_to_compile_${platform_name_with_type}} PARENT_SCOPE)
|
2017-12-21 07:45:38 +08:00
|
|
|
endfunction()
|
|
|
|
|
2019-11-05 16:40:19 +08:00
|
|
|
function(neo_gen_kernels_with_options platform_name_with_type platform_name suffix filepath)
|
|
|
|
set(kernels_to_compile)
|
2018-10-17 06:37:07 +08:00
|
|
|
foreach(filearg ${filepath})
|
|
|
|
get_filename_component(filename ${filearg} NAME)
|
|
|
|
get_filename_component(basename ${filearg} NAME_WE)
|
|
|
|
get_filename_component(base_workdir ${filearg} DIRECTORY)
|
|
|
|
|
|
|
|
set(outputdir "${TargetDir}/${suffix}/test_files/${NEO_ARCH}/")
|
|
|
|
set(workdir "${CMAKE_CURRENT_SOURCE_DIR}/${base_workdir}/")
|
|
|
|
|
|
|
|
foreach(arg ${ARGN})
|
|
|
|
string(REPLACE " " "_" argwospaces ${arg})
|
|
|
|
|
|
|
|
set(outputpath_base "${outputdir}/${basename}_${suffix}")
|
|
|
|
set(output_files
|
2019-02-12 17:21:32 +08:00
|
|
|
${outputpath_base}.spv${argwospaces}
|
2018-10-17 06:37:07 +08:00
|
|
|
${outputpath_base}.bin${argwospaces}
|
|
|
|
${outputpath_base}.gen${argwospaces}
|
|
|
|
)
|
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${output_files}
|
|
|
|
COMMAND ${cloc_cmd_prefix} -q -file ${filename} -device ${platform_name} -${NEO_BITS} -out_dir ${outputdir} -options ${arg} -options_name
|
|
|
|
WORKING_DIRECTORY ${workdir}
|
2018-11-19 23:29:16 +08:00
|
|
|
DEPENDS ${filearg} ocloc
|
2018-10-17 06:37:07 +08:00
|
|
|
)
|
|
|
|
|
2019-11-05 16:40:19 +08:00
|
|
|
list(APPEND kernels_to_compile ${output_files})
|
2018-10-17 06:37:07 +08:00
|
|
|
endforeach()
|
2017-12-21 07:45:38 +08:00
|
|
|
endforeach()
|
2019-11-05 16:40:19 +08:00
|
|
|
list(APPEND kernels_to_compile_${platform_name_with_type} ${kernels_to_compile})
|
|
|
|
set(kernels_to_compile_${platform_name_with_type} ${kernels_to_compile_${platform_name_with_type}} PARENT_SCOPE)
|
2017-12-21 07:45:38 +08:00
|
|
|
endfunction()
|
|
|
|
|
2019-11-05 16:40:19 +08:00
|
|
|
function(neo_gen_kernels_with_internal_options platform_name_with_type platform_name suffix filepath)
|
|
|
|
set(kernels_to_compile)
|
2019-09-09 18:35:44 +08:00
|
|
|
foreach(filearg ${filepath})
|
|
|
|
get_filename_component(filename ${filearg} NAME)
|
|
|
|
get_filename_component(basename ${filearg} NAME_WE)
|
|
|
|
get_filename_component(base_workdir ${filearg} DIRECTORY)
|
|
|
|
|
|
|
|
set(outputdir "${TargetDir}/${suffix}/test_files/${NEO_ARCH}/")
|
|
|
|
set(workdir "${CMAKE_CURRENT_SOURCE_DIR}/${base_workdir}/")
|
|
|
|
|
|
|
|
foreach(arg ${ARGN})
|
|
|
|
|
|
|
|
set(outputpath_base "${outputdir}/${basename}_${suffix}")
|
|
|
|
set(output_files
|
|
|
|
${outputpath_base}.spv
|
|
|
|
${outputpath_base}.bin
|
|
|
|
${outputpath_base}.gen
|
|
|
|
)
|
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${output_files}
|
|
|
|
COMMAND ${cloc_cmd_prefix} -q -file ${filename} -device ${platform_name} -${NEO_BITS} -out_dir ${outputdir} -internal_options ${arg}
|
|
|
|
WORKING_DIRECTORY ${workdir}
|
|
|
|
DEPENDS ${filearg} ocloc
|
|
|
|
)
|
|
|
|
|
2019-11-05 16:40:19 +08:00
|
|
|
list(APPEND kernels_to_compile ${output_files})
|
2019-09-09 18:35:44 +08:00
|
|
|
endforeach()
|
|
|
|
endforeach()
|
2019-11-05 16:40:19 +08:00
|
|
|
list(APPEND kernels_to_compile_${platform_name_with_type} ${kernels_to_compile})
|
|
|
|
set(kernels_to_compile_${platform_name_with_type} ${kernels_to_compile_${platform_name_with_type}} PARENT_SCOPE)
|
2019-09-09 18:35:44 +08:00
|
|
|
endfunction()
|
|
|
|
|
2018-04-18 21:48:03 +08:00
|
|
|
set(TEST_KERNEL_kernel_debug_enable
|
|
|
|
"-cl-kernel-debug-enable"
|
|
|
|
)
|
|
|
|
|
2019-11-05 16:40:19 +08:00
|
|
|
function(neo_gen_kernel_with_kernel_debug_options platform_name_with_type platform_name suffix filepath)
|
2018-03-16 01:13:52 +08:00
|
|
|
get_filename_component(filename ${filepath} NAME)
|
|
|
|
get_filename_component(basename ${filepath} NAME_WE)
|
2018-09-25 07:04:23 +08:00
|
|
|
get_filename_component(base_workdir ${filepath} DIRECTORY)
|
2018-03-16 01:13:52 +08:00
|
|
|
|
2018-04-18 00:11:50 +08:00
|
|
|
set(outputdir "${TargetDir}/${suffix}/test_files/${NEO_ARCH}/")
|
2018-09-25 07:04:23 +08:00
|
|
|
set(workdir "${CMAKE_CURRENT_SOURCE_DIR}/${base_workdir}/")
|
2018-03-16 01:13:52 +08:00
|
|
|
|
2018-04-18 21:48:03 +08:00
|
|
|
string(REPLACE " " "_" argwospaces ${TEST_KERNEL_kernel_debug_enable})
|
2018-03-16 01:13:52 +08:00
|
|
|
|
2018-04-18 00:11:50 +08:00
|
|
|
set(outputpath_base "${outputdir}/${argwospaces}_${suffix}")
|
2018-04-18 21:48:03 +08:00
|
|
|
set(output_files
|
2019-02-12 17:21:32 +08:00
|
|
|
${outputpath_base}.spv
|
2018-04-18 21:48:03 +08:00
|
|
|
${outputpath_base}.bin
|
|
|
|
${outputpath_base}.gen
|
|
|
|
${outputpath_base}.dbg
|
|
|
|
)
|
2018-03-16 01:13:52 +08:00
|
|
|
|
2018-04-18 21:48:03 +08:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${output_files}
|
2018-04-18 00:11:50 +08:00
|
|
|
COMMAND ${cloc_cmd_prefix} -q -file ${filename} -device ${platform_name} -${NEO_BITS} -out_dir ${outputdir} -output ${argwospaces} -internal_options ${TEST_KERNEL_kernel_debug_enable} -options "-g"
|
2018-04-18 21:48:03 +08:00
|
|
|
WORKING_DIRECTORY ${workdir}
|
2018-11-19 23:29:16 +08:00
|
|
|
DEPENDS ${filepath} ocloc
|
2018-04-18 21:48:03 +08:00
|
|
|
)
|
2018-03-16 01:13:52 +08:00
|
|
|
|
2019-11-05 16:40:19 +08:00
|
|
|
list(APPEND kernels_to_compile_${platform_name_with_type} ${output_files})
|
|
|
|
set(kernels_to_compile_${platform_name_with_type} ${kernels_to_compile_${platform_name_with_type}} PARENT_SCOPE)
|
2018-03-16 01:13:52 +08:00
|
|
|
endfunction()
|
|
|
|
|
2019-11-05 16:40:19 +08:00
|
|
|
function(neo_gen_kernel_from_ll platform_name_with_type platform_name suffix filepath output_name compile_options)
|
2018-03-09 21:40:31 +08:00
|
|
|
get_filename_component(filename ${filepath} NAME)
|
|
|
|
get_filename_component(basename ${filepath} NAME_WE)
|
|
|
|
|
2018-04-18 00:11:50 +08:00
|
|
|
set(outputdir "${TargetDir}/${suffix}/test_files/${NEO_ARCH}")
|
2018-03-09 21:40:31 +08:00
|
|
|
set(workdir "${CMAKE_CURRENT_SOURCE_DIR}/test_files/")
|
|
|
|
|
2018-04-18 00:11:50 +08:00
|
|
|
set(outputpath_base "${outputdir}/${output_name}_${suffix}")
|
2018-03-09 21:40:31 +08:00
|
|
|
set(output_files
|
|
|
|
${outputpath_base}.bin
|
|
|
|
${outputpath_base}.gen
|
|
|
|
)
|
|
|
|
string(CONCAT compile_options \" ${compile_options} \" )
|
|
|
|
|
2018-03-14 19:45:24 +08:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${output_files}
|
2018-04-18 00:11:50 +08:00
|
|
|
COMMAND ${cloc_cmd_prefix} -q -file ${filename} -output ${output_name} -device ${platform_name} -${NEO_BITS} -out_dir ${outputdir} -internal_options ${compile_options} -llvm_input
|
2018-03-14 19:45:24 +08:00
|
|
|
WORKING_DIRECTORY ${workdir}
|
2018-11-19 23:29:16 +08:00
|
|
|
DEPENDS ${filepath} ocloc
|
2018-03-14 19:45:24 +08:00
|
|
|
)
|
2018-03-09 21:40:31 +08:00
|
|
|
|
2019-11-05 16:40:19 +08:00
|
|
|
list(APPEND kernels_to_compile_${platform_name_with_type} ${output_files})
|
|
|
|
set(kernels_to_compile_${platform_name_with_type} ${kernels_to_compile_${platform_name_with_type}} PARENT_SCOPE)
|
2018-03-09 21:40:31 +08:00
|
|
|
endfunction()
|
|
|
|
|
2020-02-12 17:10:28 +08:00
|
|
|
set(TEST_KERNEL test_files/CopyBuffer_simd16.cl)
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
set(TEST_KERNEL_options
|
|
|
|
"-cl-fast-relaxed-math"
|
|
|
|
"-cl-finite-math-only"
|
|
|
|
"-cl-kernel-arg-info"
|
|
|
|
"-x spir -spir-std=1.2"
|
|
|
|
)
|
|
|
|
|
|
|
|
set(TEST_KERNEL_2_0_options
|
|
|
|
"-cl-std=CL2.0"
|
|
|
|
)
|
|
|
|
|
|
|
|
set(TEST_KERNEL_2_0
|
|
|
|
test_files/simple_block_kernel.cl
|
2018-10-17 06:37:07 +08:00
|
|
|
test_files/simple_nonuniform.cl
|
2017-12-21 07:45:38 +08:00
|
|
|
)
|
|
|
|
|
2019-09-09 18:35:44 +08:00
|
|
|
set(TEST_KERNEL_STATELESS_internal_options
|
|
|
|
"-cl-intel-greater-than-4GB-buffer-required"
|
|
|
|
)
|
|
|
|
|
|
|
|
set(TEST_KERNEL_STATELESS_internal_options_gen9lp
|
|
|
|
"-cl-intel-greater-than-4GB-buffer-required -m32"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
set(TEST_KERNEL_STATELESS
|
|
|
|
test_files/stateless_kernel.cl
|
|
|
|
)
|
|
|
|
|
2019-07-29 17:07:37 +08:00
|
|
|
set(TEST_KERNEL_VME
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/test_files/vme_kernels.cl
|
2019-08-08 19:29:44 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/test_files/media_kernels_backend.cl
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/test_files/media_kernels_frontend.cl
|
2019-07-29 17:07:37 +08:00
|
|
|
)
|
|
|
|
|
2018-03-09 21:40:31 +08:00
|
|
|
set(TEST_KERNEL_SIP_DEBUG_options
|
|
|
|
"-cl-include-sip-kernel-debug -cl-include-sip-csr -cl-set-bti:0"
|
|
|
|
)
|
|
|
|
|
|
|
|
set(TEST_KERNEL_SIP_DEBUG_LOCAL_options
|
|
|
|
"-cl-include-sip-kernel-local-debug -cl-include-sip-csr -cl-set-bti:0"
|
|
|
|
)
|
|
|
|
|
2018-09-25 07:04:23 +08:00
|
|
|
file(GLOB_RECURSE TEST_KERNELS test_files/*.cl)
|
|
|
|
list(REMOVE_ITEM TEST_KERNELS "${CMAKE_CURRENT_SOURCE_DIR}/test_files/shouldfail.cl")
|
|
|
|
list(REMOVE_ITEM TEST_KERNELS "${CMAKE_CURRENT_SOURCE_DIR}/test_files/simple_block_kernel.cl")
|
2018-10-17 06:37:07 +08:00
|
|
|
list(REMOVE_ITEM TEST_KERNELS "${CMAKE_CURRENT_SOURCE_DIR}/test_files/simple_nonuniform.cl")
|
2019-09-09 18:35:44 +08:00
|
|
|
list(REMOVE_ITEM TEST_KERNELS "${CMAKE_CURRENT_SOURCE_DIR}/test_files/stateless_kernel.cl")
|
|
|
|
list(REMOVE_ITEM TEST_KERNELS ${TEST_KERNEL_VME}
|
|
|
|
)
|
2018-09-25 07:04:23 +08:00
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
function(gen_run_tests_with_appverifier product slices subslices eu_per_ss)
|
|
|
|
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug" AND "${IGDRCL_OPTION__BITS}" STREQUAL "64" AND APPVERIFIER_ALLOWED)
|
|
|
|
add_custom_command(
|
|
|
|
TARGET run_${product}_unit_tests
|
|
|
|
POST_BUILD
|
|
|
|
COMMAND echo copying test verify.bat file from ${CMAKE_CURRENT_SOURCE_DIR} to ${TargetDir}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SRC} ${DST} ${CMAKE_CURRENT_SOURCE_DIR}/verify.bat ${TargetDir}/verify.bat
|
|
|
|
COMMAND WORKING_DIRECTORY ${TargetDir}
|
|
|
|
COMMAND echo Running igdrcl_tests with App Verifier
|
2018-03-13 16:03:21 +08:00
|
|
|
COMMAND ${TargetDir}/verify.bat --product ${product} --slices ${slices} --subslices ${subslices} --eu_per_ss ${eu_per_ss} ${GTEST_EXCEPTION_OPTIONS} ${IGDRCL_TESTS_LISTENER_OPTION} ${GTEST_FILTER_OPTION}
|
2017-12-21 07:45:38 +08:00
|
|
|
COMMAND echo App Verifier returned: %errorLevel%
|
|
|
|
)
|
|
|
|
endif()
|
2018-03-14 19:45:24 +08:00
|
|
|
endfunction()
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
function(gen_run_unit_tests product slices subslices eu_per_ss)
|
|
|
|
add_custom_target(run_${product}_unit_tests ALL DEPENDS unit_tests)
|
|
|
|
neo_copy_test_files(copy_test_files_${product} ${product})
|
|
|
|
add_dependencies(unit_tests copy_test_files_${product})
|
2018-03-08 16:14:07 +08:00
|
|
|
set_target_properties(run_${product}_unit_tests PROPERTIES FOLDER "${PLATFORM_SPECIFIC_TARGETS_FOLDER}/${product}")
|
2017-12-21 07:45:38 +08:00
|
|
|
add_custom_command(
|
|
|
|
TARGET run_${product}_unit_tests
|
|
|
|
POST_BUILD
|
|
|
|
COMMAND WORKING_DIRECTORY ${TargetDir}
|
|
|
|
COMMAND echo Running igdrcl_tests ${target} ${slices}x${subslices}x${eu_per_ss} in ${TargetDir}/${product}
|
2019-06-14 07:56:07 +08:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E env GTEST_OUTPUT=xml:${GTEST_XML_OUTPUT_DIR}/test_details_${product}_${slices}_${subslices}_${eu_per_ss}.xml $<TARGET_FILE:igdrcl_tests> --product ${product} --slices ${slices} --subslices ${subslices} --eu_per_ss ${eu_per_ss} ${GTEST_EXCEPTION_OPTIONS} --gtest_repeat=${GTEST_REPEAT} ${GTEST_SHUFFLE} ${IGDRCL_TESTS_LISTENER_OPTION} ${GTEST_FILTER_OPTION}
|
2017-12-21 07:45:38 +08:00
|
|
|
)
|
|
|
|
add_dependencies(run_unit_tests run_${product}_unit_tests)
|
2018-03-14 19:45:24 +08:00
|
|
|
endfunction()
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2018-03-22 18:35:24 +08:00
|
|
|
macro(macro_for_each_test_config)
|
|
|
|
gen_run_unit_tests(${PLATFORM_IT_LOWER} ${SLICES} ${SUBSLICES} ${EU_PER_SS})
|
|
|
|
if(MSVC AND ${TESTED_WITH_APPVERIFIER})
|
|
|
|
gen_run_tests_with_appverifier(${PLATFORM_IT_LOWER} ${SLICES} ${SUBSLICES} ${EU_PER_SS})
|
2018-03-14 19:45:24 +08:00
|
|
|
endif()
|
2018-03-22 18:35:24 +08:00
|
|
|
endmacro()
|
|
|
|
|
|
|
|
macro(macro_for_each_platform)
|
|
|
|
PLATFORM_TESTED_WITH_APPVERIFIER(${GEN_TYPE} ${PLATFORM_IT} TESTED_WITH_APPVERIFIER)
|
|
|
|
apply_macro_for_each_test_config("UNIT_TESTS")
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
macro(macro_for_each_gen)
|
2019-07-24 17:43:29 +08:00
|
|
|
foreach(PLATFORM_TYPE ${PLATFORM_TYPES})
|
2018-04-18 00:11:50 +08:00
|
|
|
if(${GEN_TYPE}_HAS_${PLATFORM_TYPE})
|
|
|
|
get_family_name_with_type(${GEN_TYPE} ${PLATFORM_TYPE})
|
|
|
|
string(TOLOWER ${PLATFORM_TYPE} PLATFORM_TYPE_LOWER)
|
|
|
|
set(PLATFORM_LOWER ${DEFAULT_SUPPORTED_${GEN_TYPE}_${PLATFORM_TYPE}_PLATFORM})
|
|
|
|
set(PLATFORM_2_0_LOWER ${DEFAULT_SUPPORTED_2_0_${GEN_TYPE}_${PLATFORM_TYPE}_PLATFORM})
|
2019-07-29 17:07:37 +08:00
|
|
|
set(PLATFORM_VME_LOWER ${DEFAULT_SUPPORTED_VME_${GEN_TYPE}_${PLATFORM_TYPE}_PLATFORM})
|
2018-04-18 00:11:50 +08:00
|
|
|
|
2020-02-12 23:57:56 +08:00
|
|
|
set(PLATFORM_TEST_KERNELS ${TEST_KERNELS})
|
|
|
|
foreach(KERNEL_TO_REMOVE ${${GEN_TYPE}_TEST_KERNELS_BLACKLIST})
|
|
|
|
set(KERNEL_TO_REMOVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/test_files/${KERNEL_TO_REMOVE}")
|
|
|
|
list(REMOVE_ITEM PLATFORM_TEST_KERNELS ${KERNEL_TO_REMOVE_PATH})
|
|
|
|
endforeach()
|
|
|
|
|
2018-04-18 00:11:50 +08:00
|
|
|
if(MSVC OR CMAKE_SIZEOF_VOID_P EQUAL 8)
|
2020-02-12 23:57:56 +08:00
|
|
|
neo_gen_kernels(${family_name_with_type} ${PLATFORM_LOWER} ${family_name_with_type} ${PLATFORM_TEST_KERNELS})
|
2019-11-05 16:40:19 +08:00
|
|
|
neo_gen_kernels_with_options(${family_name_with_type} ${PLATFORM_LOWER} ${family_name_with_type} ${TEST_KERNEL} ${TEST_KERNEL_options})
|
2018-04-18 00:11:50 +08:00
|
|
|
# Temporarily disabled debug kernel generation on gen8
|
|
|
|
if(NOT ("${GEN_TYPE_LOWER}" STREQUAL "gen8"))
|
2019-11-05 16:40:19 +08:00
|
|
|
neo_gen_kernel_with_kernel_debug_options(${family_name_with_type} ${PLATFORM_LOWER} ${family_name_with_type} ${TEST_KERNEL})
|
2018-04-18 00:11:50 +08:00
|
|
|
endif()
|
2019-09-09 18:35:44 +08:00
|
|
|
# Gen9lp needs extra -m32 flag
|
|
|
|
if( ("${GEN_TYPE_LOWER}" STREQUAL "gen9") AND ("${PLATFORM_TYPE_LOWER}" STREQUAL "lp"))
|
2019-11-05 16:40:19 +08:00
|
|
|
neo_gen_kernels_with_internal_options(${family_name_with_type} ${PLATFORM_LOWER} ${family_name_with_type} ${TEST_KERNEL_STATELESS} ${TEST_KERNEL_STATELESS_internal_options_gen9lp})
|
2019-09-09 18:35:44 +08:00
|
|
|
else()
|
2019-11-05 16:40:19 +08:00
|
|
|
neo_gen_kernels_with_internal_options(${family_name_with_type} ${PLATFORM_LOWER} ${family_name_with_type} ${TEST_KERNEL_STATELESS} ${TEST_KERNEL_STATELESS_internal_options})
|
2019-09-09 18:35:44 +08:00
|
|
|
endif()
|
2018-04-18 00:11:50 +08:00
|
|
|
set(sip_kernel_file_name)
|
|
|
|
set(sip_kernel_output_file)
|
|
|
|
set(sip_debug_kernel_output_file)
|
|
|
|
set(sip_debug_local_kernel_output_file)
|
2020-02-23 22:20:22 +08:00
|
|
|
list(APPEND sip_kernel_file_name "opencl/test/unit_test/test_files/sip_dummy_kernel_${NEO_BITS}.ll")
|
2018-04-18 00:11:50 +08:00
|
|
|
list(APPEND sip_debug_kernel_output_file "sip_dummy_kernel_debug_${NEO_BITS}")
|
|
|
|
list(APPEND sip_debug_local_kernel_output_file "sip_dummy_kernel_debug_local_${NEO_BITS}")
|
|
|
|
|
|
|
|
# Temporarily disabled sip kernel generation
|
|
|
|
# if("${GEN_TYPE_LOWER}" STREQUAL "gen9" )
|
2019-11-05 16:40:19 +08:00
|
|
|
# neo_gen_kernel_from_ll(${family_name_with_type} ${PLATFORM_LOWER} ${family_name_with_type} ${sip_kernel_file_name} ${sip_debug_local_kernel_output_file} ${TEST_KERNEL_SIP_DEBUG_LOCAL_options})
|
2018-04-18 00:11:50 +08:00
|
|
|
# endif()
|
|
|
|
|
2019-11-05 16:40:19 +08:00
|
|
|
# neo_gen_kernel_from_ll(${family_name_with_type} ${PLATFORM_LOWER} ${family_name_with_type} ${sip_kernel_file_name} ${sip_debug_kernel_output_file} ${TEST_KERNEL_SIP_DEBUG_options})
|
2018-04-18 00:11:50 +08:00
|
|
|
|
|
|
|
if(PLATFORM_2_0_LOWER)
|
2019-11-05 16:40:19 +08:00
|
|
|
neo_gen_kernels_with_options(${family_name_with_type} ${PLATFORM_2_0_LOWER} ${family_name_with_type} "${TEST_KERNEL_2_0}" ${TEST_KERNEL_2_0_options})
|
2018-04-18 00:11:50 +08:00
|
|
|
endif()
|
2019-07-29 17:07:37 +08:00
|
|
|
if(PLATFORM_VME_LOWER)
|
2019-11-05 16:40:19 +08:00
|
|
|
neo_gen_kernels(${family_name_with_type} ${PLATFORM_VME_LOWER} ${family_name_with_type} ${TEST_KERNEL_VME})
|
2019-07-29 17:07:37 +08:00
|
|
|
endif()
|
2018-04-18 00:11:50 +08:00
|
|
|
endif()
|
2019-11-05 16:40:19 +08:00
|
|
|
add_custom_target(prepare_test_kernels_${family_name_with_type} DEPENDS ${kernels_to_compile_${family_name_with_type}} copy_compiler_files)
|
|
|
|
set_target_properties(prepare_test_kernels_${family_name_with_type} PROPERTIES FOLDER "${PLATFORM_SPECIFIC_TARGETS_FOLDER}/${family_name_with_type}")
|
|
|
|
add_dependencies(prepare_test_kernels prepare_test_kernels_${family_name_with_type})
|
2018-04-18 00:11:50 +08:00
|
|
|
endif()
|
|
|
|
endforeach()
|
2018-03-22 18:35:24 +08:00
|
|
|
apply_macro_for_each_platform()
|
|
|
|
endmacro()
|
|
|
|
apply_macro_for_each_gen("TESTED")
|
2018-04-18 00:11:50 +08:00
|
|
|
add_subdirectories()
|
2019-10-10 23:41:59 +08:00
|
|
|
create_project_source_tree(igdrcl_tests ${NEO_SOURCE_DIR}/runtime)
|
2018-11-16 21:09:42 +08:00
|
|
|
|
2019-04-04 17:25:56 +08:00
|
|
|
set(UltPchHeader "${CMAKE_CURRENT_SOURCE_DIR}/igdrcl_tests_pch.h")
|
|
|
|
set(UltPchSource "${CMAKE_CURRENT_SOURCE_DIR}/igdrcl_tests_pch.cpp")
|
|
|
|
get_target_property(UltSources igdrcl_tests SOURCES)
|
|
|
|
|
2019-05-08 20:00:32 +08:00
|
|
|
if(MSVC AND NOT DISABLE_ULT_PCH_WIN)
|
2018-11-16 21:09:42 +08:00
|
|
|
set(UltPchBinary "${CMAKE_CURRENT_BINARY_DIR}/igdrcl_tests_pch.pch")
|
|
|
|
|
|
|
|
set(IGDRCL_SRCS_ult_pch ${UltPchSource} ${UltPchHeader})
|
2019-04-04 17:25:56 +08:00
|
|
|
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_ult_pch})
|
2018-11-16 21:09:42 +08:00
|
|
|
|
|
|
|
set_source_files_properties(${UltSources}
|
|
|
|
PROPERTIES COMPILE_FLAGS "/Yu${UltPchHeader} /FI${UltPchHeader} /Fp${UltPchBinary}"
|
|
|
|
OBJECT_DEPENDS "${UltPchBinary}")
|
|
|
|
|
|
|
|
set_source_files_properties(${UltPchSource}
|
|
|
|
PROPERTIES COMPILE_FLAGS "/Yc${UltPchHeader} /FI${UltPchHeader} /Fp${UltPchBinary}"
|
|
|
|
OBJECT_OUTPUTS "${UltPchBinary}")
|
2019-04-17 14:05:54 +08:00
|
|
|
elseif(USE_ULT_PCH)
|
2019-04-04 17:25:56 +08:00
|
|
|
set(UltPchHeaderInBuildDir "${CMAKE_CURRENT_BINARY_DIR}/igdrcl_tests_pch.h")
|
|
|
|
set(UltPchBinaryGch "${UltPchHeaderInBuildDir}.gch")
|
|
|
|
set(UltPchBinary "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/igdrcl_ult_pch.dir/igdrcl_tests_pch.h.o")
|
2018-11-16 21:09:42 +08:00
|
|
|
|
2019-06-24 19:48:14 +08:00
|
|
|
add_library(igdrcl_ult_pch STATIC EXCLUDE_FROM_ALL ${UltPchHeader})
|
2019-04-04 17:25:56 +08:00
|
|
|
add_dependencies(igdrcl_tests igdrcl_ult_pch)
|
|
|
|
|
|
|
|
target_include_directories(igdrcl_ult_pch PRIVATE
|
|
|
|
$<TARGET_PROPERTY:${NEO_MOCKABLE_LIB_NAME},INTERFACE_INCLUDE_DIRECTORIES>
|
|
|
|
$<TARGET_PROPERTY:igdrcl_tests,INCLUDE_DIRECTORIES>)
|
|
|
|
target_compile_definitions(igdrcl_ult_pch PRIVATE $<TARGET_PROPERTY:${NEO_MOCKABLE_LIB_NAME},INTERFACE_COMPILE_DEFINITIONS>)
|
|
|
|
|
|
|
|
target_include_directories(igdrcl_tests PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
|
|
|
|
if(NOT USE_ASAN)
|
|
|
|
set_source_files_properties(${UltSources}
|
|
|
|
PROPERTIES COMPILE_FLAGS "-include ${UltPchHeaderInBuildDir} -msse4"
|
|
|
|
OBJECT_DEPENDS ${UltPchBinaryGch})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set_source_files_properties(${UltPchHeader}
|
|
|
|
PROPERTIES LANGUAGE "CXX"
|
|
|
|
COMPILE_FLAGS "-x c++-header -msse4 -gdwarf-2")
|
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${UltPchBinaryGch}
|
|
|
|
COMMAND cp "${UltPchHeader}" "${UltPchHeaderInBuildDir}"
|
|
|
|
COMMAND cp "${UltPchBinary}" "${UltPchBinaryGch}"
|
|
|
|
DEPENDS ${UltPchBinary})
|
2018-11-16 21:09:42 +08:00
|
|
|
endif()
|
2019-12-04 19:47:40 +08:00
|
|
|
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
# !! !!
|
|
|
|
# !! DONT ADD ANY SOURCES HERE! !!
|
|
|
|
# !! !!
|
|
|
|
# !! You are below PCH logic! !!
|
|
|
|
# !! This is to keep PCH dependencies correctly without creating new target !!
|
|
|
|
# !! !!
|
|
|
|
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|