From 509c8314b1ad46c3fce73d0efa962c6f0b5ac4bd Mon Sep 17 00:00:00 2001 From: Mark Lobodzinski Date: Wed, 8 Jun 2016 12:48:18 -0600 Subject: layers: Make vklayer_utils a shared library Was previously statically linked. Converting to a DLL will allow data sharing and use of utils in samples repo. Change-Id: I63ccc1f0f57dfad40f7068c60ac623bce5bd714d --- layers/CMakeLists.txt | 20 +++++++++++++++++--- layers/VkLayer_utils.def | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 3 deletions(-) create mode 100644 layers/VkLayer_utils.def diff --git a/layers/CMakeLists.txt b/layers/CMakeLists.txt index acf67b8a..5982cdd4 100644 --- a/layers/CMakeLists.txt +++ b/layers/CMakeLists.txt @@ -142,11 +142,10 @@ run_vk_layer_xml_generate(Threading thread_check.h) run_vk_layer_generate(unique_objects unique_objects.cpp) run_vk_layer_xml_generate(ParamChecker parameter_validation.h) + # Layer Utils Library -# For Windows, we use a static lib because the Windows loader has a fairly restrictive loader search -# path that can't be easily modified to point it to the same directory that contains the layers. if (WIN32) - add_library(VkLayer_utils STATIC vk_layer_config.cpp vk_layer_extension_utils.cpp vk_layer_utils.cpp) + add_library(VkLayer_utils SHARED vk_layer_config.cpp vk_layer_extension_utils.cpp vk_layer_utils.cpp VkLayer_utils.def) else() add_library(VkLayer_utils SHARED vk_layer_config.cpp vk_layer_extension_utils.cpp vk_layer_utils.cpp) install(TARGETS VkLayer_utils DESTINATION ${PROJECT_BINARY_DIR}/install_staging) @@ -166,3 +165,18 @@ add_vk_layer(parameter_validation parameter_validation.cpp parameter_validation. target_include_directories(VkLayer_core_validation PRIVATE ${GLSLANG_SPIRV_INCLUDE_DIR}) target_include_directories(VkLayer_core_validation PRIVATE ${SPIRV_TOOLS_INCLUDE_DIR}) target_link_libraries(VkLayer_core_validation ${SPIRV_TOOLS_LIBRARIES}) + +if (WIN32) + file(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/$/VkLayer_utils.dll COPY_SRC_PATH) + file(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/../demos/$/ COPY_DST_PATH) + file(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/../tests/$/ COPY_DST_TEST_PATH) + # Copy layer utils library to correct locations + add_custom_command(TARGET VkLayer_utils + POST_BUILD + COMMAND xcopy /Y /I ${COPY_SRC_PATH} ${COPY_DST_PATH} + COMMENT "Copying VkLayer_utils.dll to demos dir") + add_custom_command(TARGET VkLayer_utils + POST_BUILD + COMMAND xcopy /Y /I ${COPY_SRC_PATH} ${COPY_DST_TEST_PATH} + COMMENT "Copying VkLayer_utils.dll to demos dir") +endif() diff --git a/layers/VkLayer_utils.def b/layers/VkLayer_utils.def new file mode 100644 index 00000000..d2b52852 --- /dev/null +++ b/layers/VkLayer_utils.def @@ -0,0 +1,45 @@ +;;;; Begin Copyright Notice ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Vulkan +; +; Copyright (c) 2015-2016 The Khronos Group Inc. +; Copyright (c) 2015-2016 Valve Corporation +; Copyright (c) 2015-2016 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. +; +; Author: Mark Lobodzinski +;;;; End Copyright Notice ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; The following is required on Windows for exporting symbols from the DLL + +LIBRARY VkLayer_utils +EXPORTS +vk_format_is_depth_or_stencil +vk_format_is_depth_and_stencil +vk_format_is_stencil_only +vk_format_is_depth_only +vk_format_is_norm +vk_format_is_int +vk_format_is_uint +vk_format_is_sint +vk_format_is_float +vk_format_is_srgb +vk_format_is_compressed +vk_format_get_compatibility_class +vk_format_get_size +vk_format_get_channel_count +vk_safe_modulo +vk_string_validate +layer_debug_actions +util_GetExtensionProperties +util_GetLayerProperties -- cgit v1.2.3