See BUILD.md for details.
Change-Id: Ide1f635a57b57af384d9d1baac20c2256629f812
describes both how ICDs and layers should be properly
packaged, and how developers can point to ICDs and layers within their builds.
+### Linux Install to System Directories
+
+Installing the files resulting from your build to the systems directories is optional since
+environment variables can usually be used instead to locate the binaries.
+There are also risks with interfering with binaries installed by packages.
+If you are certain that you would like to install your binaries to system directories,
+you can proceed with these instructions.
+
+Assuming that you've built the code as described above and the current directory is still `dbuild`,
+you can execute:
+
+```
+sudo make install
+```
+
+This command installs files to:
+
+* `/usr/local/lib`: Vulkan loader and layers shared objects
+* `/usr/local/bin`: vulkaninfo application
+* `/etc/vulkan/explicit_layer.d`: Layer JSON files
+
+You may need to run `ldconfig` in order to refresh the system loader search cache on some Linux systems.
+
+The list of installed files appears in the build directory in a file named `install_manifest.txt`.
+You can easily remove the installed files with:
+
+```
+cat install_manifest.txt | sudo xargs rm
+```
+
+See the CMake documentation for details on using `DESTDIR` and `CMAKE_INSTALL_PREFIX` to customize
+your installation location.
+
+Note that some executables in this repository (e.g., `cube`) use the "rpath" linker directive
+to load the Vulkan loader from the build directory, `dbuild` in this example.
+This means that even after installing the loader to the system directories, these executables
+still use the loader from the build directory.
+
## Validation Test
The test executables can be found in the dbuild/tests directory.
if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL ${CMAKE_HOST_SYSTEM_PROCESSOR})
add_subdirectory(smoke)
endif()
+
+if(UNIX)
+ install(TARGETS vulkaninfo DESTINATION bin)
+endif()
endif()
endif()
+# Add targets for JSON file install on Linux.
+# Need to remove the "./" from the library path before installing to /etc.
+if(UNIX)
+ foreach (config_file ${LAYER_JSON_FILES})
+ add_custom_target(${config_file}-staging-json ALL
+ COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/staging-json
+ COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/linux/${config_file}.json ${CMAKE_CURRENT_BINARY_DIR}/staging-json
+ COMMAND sed -i -e "/\"library_path\":/s$./libVkLayer$libVkLayer$" ${CMAKE_CURRENT_BINARY_DIR}/staging-json/${config_file}.json
+ VERBATIM
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/linux/${config_file}.json
+ )
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/staging-json/${config_file}.json DESTINATION /etc/vulkan/explicit_layer.d)
+ endforeach(config_file)
+endif()
+
if (WIN32)
macro(add_vk_layer target)
add_custom_command(OUTPUT VkLayer_${target}.def
target_link_Libraries(VkLayer_${target} VkLayer_utils)
add_dependencies(VkLayer_${target} generate_dispatch_table_helper generate_vk_layer_helpers generate_enum_string_helper VkLayer_utils)
set_target_properties(VkLayer_${target} PROPERTIES LINK_FLAGS "-Wl,-Bsymbolic")
- install(TARGETS VkLayer_${target} DESTINATION ${PROJECT_BINARY_DIR}/install_staging)
+ install(TARGETS VkLayer_${target} DESTINATION lib)
endmacro()
endif()
add_library(VkLayer_utils STATIC vk_layer_config.cpp vk_layer_extension_utils.cpp vk_layer_utils.cpp)
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)
+ install(TARGETS VkLayer_utils DESTINATION lib)
endif()
add_vk_layer(core_validation core_validation.cpp vk_layer_table.cpp vk_safe_struct.cpp descriptor_sets.cpp)
add_library(vulkan SHARED ${LOADER_SRCS})
set_target_properties(vulkan PROPERTIES SOVERSION "1" VERSION "1.0.28")
target_link_libraries(vulkan -ldl -lpthread -lm)
+ install(TARGETS vulkan LIBRARY DESTINATION lib)
endif()
add_library(VkLayer_${target} SHARED ${ARGN})
add_dependencies(VkLayer_${target} generate_tests_dispatch_table_helper VkLayer_utils)
set_target_properties(VkLayer_${target} PROPERTIES LINK_FLAGS "-Wl,-Bsymbolic")
- install(TARGETS VkLayer_${target} DESTINATION ${PROJECT_BINARY_DIR}/install_staging)
endmacro()
endif()