diff options
| author | Charles Giessen <charles@lunarg.com> | 2024-05-01 23:30:19 -0500 |
|---|---|---|
| committer | Charles Giessen <46324611+charles-lunarg@users.noreply.github.com> | 2024-05-01 23:09:08 -0600 |
| commit | e6d5b0a67d1b1179f99e1745a8d9c16f22c85f82 (patch) | |
| tree | ec86463be52dc6b324579059c9d2b9c58f00d16b | |
| parent | d21838aeaafbeb57cbed3a8072e26b7b15cc533e (diff) | |
| download | usermoji-e6d5b0a67d1b1179f99e1745a8d9c16f22c85f82.tar.xz | |
test: Simplify how MockICD binaries are provided
| -rw-r--r-- | tests/CMakeLists.txt | 21 | ||||
| -rw-r--r-- | tests/binary_locations.h.in | 20 | ||||
| -rw-r--r-- | tests/test_common.h | 3 |
3 files changed, 4 insertions, 40 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0da3c1de..8a35ae36 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -31,21 +31,6 @@ endif() find_package(VulkanLoader CONFIG) -# setup binary_locations_$<CONFIG>.h.in using binary_locations.h.in as a source -file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/binary_locations_$<CONFIG>.h" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/binary_locations.h.in") - -# copy binary_locations_$<CONFIG> to the build directory -add_custom_command( - PRE_BUILD - COMMAND ${CMAKE_COMMAND} "-E" "copy_if_different" "${CMAKE_CURRENT_BINARY_DIR}/binary_locations_$<CONFIG>.h" "${CMAKE_CURRENT_BINARY_DIR}/binary_locations.h" - VERBATIM - DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/binary_locations_$<CONFIG>.h" - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/binary_locations.h" - COMMENT "creating binary_locations.h file ({event: PRE_BUILD}, {filename: binary_locations.h })" - ) -add_custom_target (generate_binary_locations DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/binary_locations.h") -add_dependencies (generate_binary_locations vkcube vkcubepp VkICD_mock_icd vulkaninfo) - find_package(GTest REQUIRED CONFIG QUIET) add_executable(vulkan_tools_tests) @@ -57,14 +42,16 @@ target_sources(vulkan_tools_tests PRIVATE get_target_property(TEST_SOURCES vulkan_tools_tests SOURCES) source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" FILES ${TEST_SOURCES}) -target_include_directories(vulkan_tools_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) +target_include_directories(vulkan_tools_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) target_link_libraries(vulkan_tools_tests GTest::gtest Vulkan::Headers Vulkan::Loader) -add_dependencies(vulkan_tools_tests generate_binary_locations) if (WIN32) target_compile_definitions(vulkan_tools_tests PUBLIC -DVK_USE_PLATFORM_WIN32_KHR -DWIN32_LEAN_AND_MEAN -DNOMINMAX) endif() set_target_properties(vulkan_tools_tests PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL") +# Set the exact path to Mock JSON ICD +target_compile_definitions(vulkan_tools_tests PRIVATE MOCK_ICD_JSON_MANIFEST_PATH="$<TARGET_FILE_DIR:VkICD_mock_icd>") + if (DEFINED GIT_BRANCH_NAME AND DEFINED GIT_TAG_INFO) target_compile_definitions(vulkan_tools_tests PRIVATE GIT_BRANCH_NAME="${GIT_BRANCH_NAME}" GIT_TAG_INFO="${GIT_TAG_INFO}") endif() diff --git a/tests/binary_locations.h.in b/tests/binary_locations.h.in deleted file mode 100644 index acdd9b83..00000000 --- a/tests/binary_locations.h.in +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2023 The Khronos Group Inc. - * Copyright (c) 2023 Valve Corporation - * Copyright (c) 2023 LunarG, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#define MOCK_ICD_JSON_MANIFEST_PATH "$<TARGET_FILE_DIR:VkICD_mock_icd>" diff --git a/tests/test_common.h b/tests/test_common.h index de06a784..72df9067 100644 --- a/tests/test_common.h +++ b/tests/test_common.h @@ -26,9 +26,6 @@ #include "gtest/gtest.h" #include "vulkan/vulkan.h" -// Location of the built binaries in this repo -#include "binary_locations.h" - #if defined(WIN32) #include <windows.h> inline int set_environment_var(const char* name, const char* value) { return SetEnvironmentVariable(name, value); } |
