Make GLFW_VULKAN_STATIC available only on Apple platforms

The Vulkan-Loader restricted support for static linking to only
Apple platforms.
This commit is contained in:
Charles Giessen 2021-04-22 00:22:16 -06:00
parent 33cd8b865d
commit 91294f8ad1
4 changed files with 13 additions and 9 deletions

View File

@ -27,7 +27,10 @@ option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" ${GLFW_STANDALONE})
option(GLFW_BUILD_TESTS "Build the GLFW test programs" ${GLFW_STANDALONE})
option(GLFW_BUILD_DOCS "Build the GLFW documentation" ON)
option(GLFW_INSTALL "Generate installation target" ON)
if(APPLE)
option(GLFW_VULKAN_STATIC "Assume the Vulkan loader is linked with the application" OFF)
endif()
include(GNUInstallDirs)
include(CMakeDependentOption)

View File

@ -130,6 +130,7 @@ information on what to include when reporting a bug.
- Made joystick subsystem initialize at first use (#1284,#1646)
- Updated the minimum required CMake version to 3.1
- Disabled tests and examples by default when built as a CMake subdirectory
- Make the `GLFW_VULKAN_STATIC` option available only on Apple platforms
- Bugfix: The CMake config-file package used an absolute path and was not
relocatable (#1470)
- Bugfix: Video modes with a duplicate screen area were discarded (#1555,#1556)

View File

@ -225,7 +225,7 @@ with the library.
@anchor GLFW_VULKAN_STATIC
__GLFW_VULKAN_STATIC__ determines whether to use the Vulkan loader linked
directly with the application.
directly with the application. This is only available on Apple platforms.
@subsubsection compile_options_win32 Windows specific CMake options
@ -271,7 +271,7 @@ must also define @b _GLFW_BUILD_DLL. Otherwise, you must not define it.
If you are linking the Vulkan loader directly with your application then you
must also define @b _GLFW_VULKAN_STATIC. Otherwise, GLFW will attempt to use the
external version.
external version. This is only available on Apple platforms.
If you are using a custom name for the Vulkan, EGL, GLX, OSMesa, OpenGL, GLESv1
or GLESv2 library, you can override the default names by defining those you need

View File

@ -31,16 +31,16 @@ are also guides for the other areas of the GLFW API.
@section vulkan_loader Linking against the Vulkan loader
By default, GLFW will look for the Vulkan loader on demand at runtime via its
GLFW looks for the Vulkan loader on demand at runtime via its
standard name (`vulkan-1.dll` on Windows, `libvulkan.so.1` on Linux and other
Unix-like systems and `libvulkan.1.dylib` on macOS). This means that GLFW does
not need to be linked against the loader. However, it also means that if you
are using the static library form of the Vulkan loader GLFW will either fail to
find it or (worse) use the wrong one.
not need to be linked against the loader.
The @ref GLFW_VULKAN_STATIC CMake option makes GLFW call the Vulkan loader
directly instead of dynamically loading it at runtime. Not linking against the
Vulkan loader will then be a compile-time error.
@macos On Apple platforms it is possible to link to the library form of the Vulkan
Loader using the @ref GLFW_VULKAN_STATIC CMake option. Not linking against the
Vulkan loader will then be a compile-time error. If you are using the static
library form of the Vulkan Loader but do not enable @ref GLFW_VULKAN_STATIC,
GLFW will either fail to find it or (worse) use the wrong one.
@macos Because the Vulkan loader and ICD are not installed globally on macOS,
you need to set up the application bundle according to the LunarG SDK