diff --git a/BUILD.md b/BUILD.md index 09982e93..3097efee 100644 --- a/BUILD.md +++ b/BUILD.md @@ -58,6 +58,44 @@ The `LoaderAndLayerInterface` document in the `loader` folder in this repository 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. diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt index 061fb72d..742dec4e 100644 --- a/loader/CMakeLists.txt +++ b/loader/CMakeLists.txt @@ -85,4 +85,5 @@ else() 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() diff --git a/tests/layers/CMakeLists.txt b/tests/layers/CMakeLists.txt index c675f1e4..786ef148 100644 --- a/tests/layers/CMakeLists.txt +++ b/tests/layers/CMakeLists.txt @@ -50,7 +50,6 @@ else() 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()