diff options
author | Karl Schultz <karl@lunarg.com> | 2018-06-13 08:35:15 -0600 |
---|---|---|
committer | Karl Schultz <karl@lunarg.com> | 2018-06-13 08:35:15 -0600 |
commit | cc51056a002888bd8d1ebdc636e562cc8e558507 (patch) | |
tree | b3e0c3d79620c9736a1bb33b6dbe52fd4646aef2 | |
parent | 26c56bd584536f3a6dae16c1d52dbb79ff67bbc2 (diff) | |
download | vulkan-validation-layers-cc51056a002888bd8d1ebdc636e562cc8e558507.tar.gz |
build: Copy loader DLL only when ldr repo supplied
A previous commit added code to copy the loader DLL to the
test application binary directory so that the application can find
a loader. This works fine when the VULKAN_LOADER_INSTALL_DIR CMake
option is used, as the application is linked with the loader export
lib from this INSTALL_DIR and the DLL is copied from there as well.
But if VULKAN_LOADER_INSTALL_DIR is not specified, the application
is linked with an export lib from an SDK (if present) and the DLL is
copied not from the SDK but from the system install dir. This is
silly since the DLL would be loaded from the system install dir
anyway.
Change the code to copy the DLL only when VULKAN_LOADER_INSTALL_DIR
is supplied.
-rw-r--r-- | tests/CMakeLists.txt | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 4de806be0..fe0074b83 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -143,14 +143,11 @@ if (TARGET gtest_main) FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION> DST_GTEST_DLLS) add_custom_command(TARGET vk_layer_validation_tests POST_BUILD COMMAND xcopy /Y /I ${SRC_GTEST_DLLS} ${DST_GTEST_DLLS}) - # Copy the loader shared lib to the test application directory so the test app finds it. - set(default_find_library_suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES}) - set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_LIBRARY_SUFFIX}) - get_filename_component(lib_name ${Vulkan_LIBRARY} NAME_WE) - find_library(vulkan_dll NAMES ${lib_name} HINTS ${Vulkan_LIBRARY} PATH_SUFFIXES "bin") - set(CMAKE_FIND_LIBRARY_SUFFIXES ${default_find_library_suffixes}) - add_custom_command(TARGET vk_layer_validation_tests POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${vulkan_dll} $<TARGET_FILE_DIR:vk_layer_validation_tests>) + # Copy the loader shared lib (if supplied) to the test application directory so the test app finds it. + if(VULKAN_LOADER_INSTALL_DIR) + add_custom_command(TARGET vk_layer_validation_tests POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${VULKAN_LOADER_INSTALL_DIR}/bin/vulkan-1.dll $<TARGET_FILE_DIR:vk_layer_validation_tests>) + endif() endif() if(INSTALL_TESTS) |