From a8b5a66439e61ca561a34b4502f8fe58daef1c55 Mon Sep 17 00:00:00 2001 From: Mateusz Jablonski Date: Thu, 8 Mar 2018 14:20:16 +0100 Subject: [PATCH] Cmake refactor part 12 igdrcl_tests: define os_interface sources in subdirectories Change-Id: Ibbf1754bf7a095f22ad152db709614f7e40ed2fb --- unit_tests/CMakeLists.txt | 5 - unit_tests/os_interface/CMakeLists.txt | 118 +++--------------- unit_tests/os_interface/linux/CMakeLists.txt | 51 ++++++++ .../os_interface/windows/CMakeLists.txt | 54 ++++++++ 4 files changed, 120 insertions(+), 108 deletions(-) create mode 100644 unit_tests/os_interface/linux/CMakeLists.txt create mode 100644 unit_tests/os_interface/windows/CMakeLists.txt diff --git a/unit_tests/CMakeLists.txt b/unit_tests/CMakeLists.txt index 8e2314b1c8..5b2323378f 100644 --- a/unit_tests/CMakeLists.txt +++ b/unit_tests/CMakeLists.txt @@ -113,11 +113,6 @@ if(GTEST_FILTERING_PATTERN) message(STATUS "GTest filter for regular tests: ${GTEST_FILTERING_PATTERN}") endif(GTEST_FILTERING_PATTERN) - -set(IGDRCL_SRCS_tests - ${IGDRCL_SRCS_tests_os_interface} -) - if(NOT MSVC) set_source_files_properties(helpers/uint16_sse4_tests.cpp PROPERTIES COMPILE_FLAGS -msse4.2) endif (NOT MSVC) diff --git a/unit_tests/os_interface/CMakeLists.txt b/unit_tests/os_interface/CMakeLists.txt index bab336c9da..210c4ba17d 100644 --- a/unit_tests/os_interface/CMakeLists.txt +++ b/unit_tests/os_interface/CMakeLists.txt @@ -18,107 +18,19 @@ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. -if(MSVC) -set(IGDRCL_SRCS_tests_os_interface_windows - "${CMAKE_CURRENT_SOURCE_DIR}/windows/deferrable_deletion_win_tests.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/windows/device_command_stream_tests.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/windows/device_os_tests.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/windows/driver_info_tests.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/windows/gdi_interface_tests.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/windows/mock_kmdaf_listener.h" - "${CMAKE_CURRENT_SOURCE_DIR}/windows/mock_gdi_interface.h" - "${CMAKE_CURRENT_SOURCE_DIR}/windows/mock_os_time_win.h" - "${CMAKE_CURRENT_SOURCE_DIR}/windows/mock_wddm_memory_manager.h" - "${CMAKE_CURRENT_SOURCE_DIR}/windows/options.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/windows/os_library_win_tests.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/windows/os_interface_tests.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/windows/os_interface_tests.h" - "${CMAKE_CURRENT_SOURCE_DIR}/windows/os_time_win_tests.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/windows/self_lib_win.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/windows/ult_dxgi_factory.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/windows/ult_dxgi_factory.h" - "${CMAKE_CURRENT_SOURCE_DIR}/windows/wddm_create.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/windows/wddm_fixture.h" - "${CMAKE_CURRENT_SOURCE_DIR}/windows/wddm_kmdaf_listener_tests.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/windows/wddm_memory_manager_tests.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/windows/wddm_memory_manager_tests.h" - "${CMAKE_CURRENT_SOURCE_DIR}/windows/wddm_tests.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/windows/wddm_tests.h" -) - -set(IGDRCL_SRCS_tests_os_interface_windows_perf_counters - "${CMAKE_CURRENT_SOURCE_DIR}/windows/mock_performance_counters_win.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/windows/mock_performance_counters_win.h" - "${CMAKE_CURRENT_SOURCE_DIR}/windows/performance_counters_win_tests.cpp" -) - -set(IGDRCL_SRCS_perf_tests_os_interface - "${CMAKE_CURRENT_SOURCE_DIR}/windows/options.cpp" - PARENT_SCOPE -) - -elseif(UNIX) - -set(IGDRCL_SRCS_tests_os_interface_linux - "${CMAKE_CURRENT_SOURCE_DIR}/linux/debug_env_reader.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/linux/device_command_stream_tests.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/linux/device_os_tests.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/linux/driver_info_tests.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/linux/drm_command_stream_tests.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/linux/drm_command_stream_mm_tests.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/linux/drm_buffer_object_tests.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/linux/drm_gem_close_worker_tests.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/linux/drm_memory_manager_tests.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/linux/drm_mock.h" - "${CMAKE_CURRENT_SOURCE_DIR}/linux/drm_neo_create.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/linux/drm_tests.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/linux/device_factory_tests.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/linux/device_factory_tests.h" - "${CMAKE_CURRENT_SOURCE_DIR}/linux/hw_info_config_tests.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/linux/hw_info_config_tests.h" - "${CMAKE_CURRENT_SOURCE_DIR}/linux/mock_os_time_linux.h" - "${CMAKE_CURRENT_SOURCE_DIR}/linux/options.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/linux/os_time_test.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/linux/self_lib_lin.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/linux/os_interface_tests.cpp" -) - -set(IGDRCL_SRCS_tests_os_interface_linux_perf_counters - "${CMAKE_CURRENT_SOURCE_DIR}/linux/mock_performance_counters_linux.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/linux/mock_performance_counters_linux.h" - "${CMAKE_CURRENT_SOURCE_DIR}/linux/performance_counters_linux_tests.cpp" -) - -set(IGDRCL_SRCS_perf_tests_os_interface - "${CMAKE_CURRENT_SOURCE_DIR}/linux/options.cpp" - PARENT_SCOPE -) - -endif() - -# We are setting all of the source/OpenCL/unit_tests/os_interface files here and -# sending the variable up to the parent scope - -set(IGDRCL_SRCS_tests_os_interface_perf_counters - "${CMAKE_CURRENT_SOURCE_DIR}/mock_performance_counters.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/mock_performance_counters.h" - "${CMAKE_CURRENT_SOURCE_DIR}/performance_counters_tests.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/performance_counters_gen_tests.cpp" -) - -set(IGDRCL_SRCS_tests_os_interface - "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt" - "${CMAKE_CURRENT_SOURCE_DIR}/32bit_memory_tests.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/debug_settings_manager_tests.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/device_factory_tests.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_tests.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_tests.h" - "${CMAKE_CURRENT_SOURCE_DIR}/os_library_tests.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/os_interface_tests.cpp" - "${IGDRCL_SRCS_tests_os_interface_linux}" - "${IGDRCL_SRCS_tests_os_interface_windows}" - "${IGDRCL_SRCS_tests_os_interface_perf_counters}" - "${IGDRCL_SRCS_tests_os_interface_linux_perf_counters}" - "${IGDRCL_SRCS_tests_os_interface_windows_perf_counters}" - PARENT_SCOPE +set(IGDRCL_SRCS_tests_os_interface_base + ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt + ${CMAKE_CURRENT_SOURCE_DIR}/32bit_memory_tests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/debug_settings_manager_tests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/device_factory_tests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_tests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_tests.h + ${CMAKE_CURRENT_SOURCE_DIR}/mock_performance_counters.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/mock_performance_counters.h + ${CMAKE_CURRENT_SOURCE_DIR}/os_interface_tests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/os_library_tests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/performance_counters_gen_tests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/performance_counters_tests.cpp ) +target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_os_interface_base}) +add_subdirectories() diff --git a/unit_tests/os_interface/linux/CMakeLists.txt b/unit_tests/os_interface/linux/CMakeLists.txt new file mode 100644 index 0000000000..aa1ea6cf5e --- /dev/null +++ b/unit_tests/os_interface/linux/CMakeLists.txt @@ -0,0 +1,51 @@ +# Copyright (c) 2018, Intel Corporation +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +set(IGDRCL_SRCS_tests_os_interface_linux + ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt + ${CMAKE_CURRENT_SOURCE_DIR}/debug_env_reader.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/device_command_stream_tests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/device_factory_tests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/device_factory_tests.h + ${CMAKE_CURRENT_SOURCE_DIR}/device_os_tests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/driver_info_tests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/drm_buffer_object_tests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/drm_command_stream_mm_tests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/drm_command_stream_tests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/drm_gem_close_worker_tests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/drm_memory_manager_tests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/drm_mock.h + ${CMAKE_CURRENT_SOURCE_DIR}/drm_neo_create.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/drm_tests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_tests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_tests.h + ${CMAKE_CURRENT_SOURCE_DIR}/mock_os_time_linux.h + ${CMAKE_CURRENT_SOURCE_DIR}/mock_performance_counters_linux.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/mock_performance_counters_linux.h + ${CMAKE_CURRENT_SOURCE_DIR}/options.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/os_interface_tests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/os_time_test.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/performance_counters_linux_tests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/self_lib_lin.cpp +) +if(UNIX) + target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_os_interface_linux}) +endif() +add_subdirectories() diff --git a/unit_tests/os_interface/windows/CMakeLists.txt b/unit_tests/os_interface/windows/CMakeLists.txt new file mode 100644 index 0000000000..223e3431e6 --- /dev/null +++ b/unit_tests/os_interface/windows/CMakeLists.txt @@ -0,0 +1,54 @@ +# Copyright (c) 2018, Intel Corporation +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +set(IGDRCL_SRCS_tests_os_interface_windows + ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt + ${CMAKE_CURRENT_SOURCE_DIR}/deferrable_deletion_win_tests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/device_command_stream_tests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/device_os_tests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/driver_info_tests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/gdi_interface_tests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/mock_gdi_interface.h + ${CMAKE_CURRENT_SOURCE_DIR}/mock_kmdaf_listener.h + ${CMAKE_CURRENT_SOURCE_DIR}/mock_os_time_win.h + ${CMAKE_CURRENT_SOURCE_DIR}/mock_performance_counters_win.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/mock_performance_counters_win.h + ${CMAKE_CURRENT_SOURCE_DIR}/mock_wddm_memory_manager.h + ${CMAKE_CURRENT_SOURCE_DIR}/options.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/os_interface_tests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/os_interface_tests.h + ${CMAKE_CURRENT_SOURCE_DIR}/os_library_win_tests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/os_time_win_tests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/performance_counters_win_tests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/self_lib_win.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/ult_dxgi_factory.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/ult_dxgi_factory.h + ${CMAKE_CURRENT_SOURCE_DIR}/wddm_create.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/wddm_fixture.h + ${CMAKE_CURRENT_SOURCE_DIR}/wddm_kmdaf_listener_tests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/wddm_memory_manager_tests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/wddm_memory_manager_tests.h + ${CMAKE_CURRENT_SOURCE_DIR}/wddm_tests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/wddm_tests.h +) +if(WIN32) + target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_os_interface_windows}) +endif() +add_subdirectories()