build: gh52-CMake changes to enable make install on Linux

See BUILD.md for details.

Change-Id: Ide1f635a57b57af384d9d1baac20c2256629f812
This commit is contained in:
Karl Schultz 2016-09-30 13:32:16 -06:00
parent 5df6d909ca
commit 30ca53a076
3 changed files with 39 additions and 1 deletions

View File

@ -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.

View File

@ -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()

View File

@ -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()