mirror of
https://github.com/gwm17/glfw.git
synced 2024-11-22 18:28:52 -05:00
Cleanup
Cleanup of 8bdb105897
.
Add build macro to configuration header and documentation. Add
corresponding CMake option. Add change log entry and credit. Add
loader static library to link dependencies and add detection to
FindVulkan.cmake.
This commit is contained in:
parent
8bdb105897
commit
7c3706763a
|
@ -12,6 +12,9 @@ if (WIN32)
|
||||||
find_library(VULKAN_LIBRARY NAMES vulkan-1 HINTS
|
find_library(VULKAN_LIBRARY NAMES vulkan-1 HINTS
|
||||||
"$ENV{VULKAN_SDK}/Bin"
|
"$ENV{VULKAN_SDK}/Bin"
|
||||||
"$ENV{VK_SDK_PATH}/Bin")
|
"$ENV{VK_SDK_PATH}/Bin")
|
||||||
|
find_library(VULKAN_STATIC_LIBRARY NAMES vkstatic.1 HINTS
|
||||||
|
"$ENV{VULKAN_SDK}/Bin"
|
||||||
|
"$ENV{VK_SDK_PATH}/Bin")
|
||||||
else()
|
else()
|
||||||
find_library(VULKAN_LIBRARY NAMES vulkan-1 HINTS
|
find_library(VULKAN_LIBRARY NAMES vulkan-1 HINTS
|
||||||
"$ENV{VULKAN_SDK}/Bin32"
|
"$ENV{VULKAN_SDK}/Bin32"
|
||||||
|
@ -27,5 +30,5 @@ endif()
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
find_package_handle_standard_args(Vulkan DEFAULT_MSG VULKAN_LIBRARY VULKAN_INCLUDE_DIR)
|
find_package_handle_standard_args(Vulkan DEFAULT_MSG VULKAN_LIBRARY VULKAN_INCLUDE_DIR)
|
||||||
|
|
||||||
mark_as_advanced(VULKAN_INCLUDE_DIR VULKAN_LIBRARY)
|
mark_as_advanced(VULKAN_INCLUDE_DIR VULKAN_LIBRARY VULKAN_STATIC_LIBRARY)
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" ON)
|
||||||
option(GLFW_BUILD_TESTS "Build the GLFW test programs" ON)
|
option(GLFW_BUILD_TESTS "Build the GLFW test programs" ON)
|
||||||
option(GLFW_BUILD_DOCS "Build the GLFW documentation" ON)
|
option(GLFW_BUILD_DOCS "Build the GLFW documentation" ON)
|
||||||
option(GLFW_INSTALL "Generate installation target" ON)
|
option(GLFW_INSTALL "Generate installation target" ON)
|
||||||
|
option(GLFW_VULKAN_STATIC "Use the Vulkan loader statically linked into application" OFF)
|
||||||
option(GLFW_DOCUMENT_INTERNALS "Include internals in documentation" OFF)
|
option(GLFW_DOCUMENT_INTERNALS "Include internals in documentation" OFF)
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
|
@ -57,6 +58,10 @@ else()
|
||||||
set(GLFW_LIB_NAME glfw3)
|
set(GLFW_LIB_NAME glfw3)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (GLFW_VULKAN_STATIC)
|
||||||
|
set(_GLFW_VULKAN_STATIC 1)
|
||||||
|
endif()
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH "${GLFW_SOURCE_DIR}/CMake/modules")
|
list(APPEND CMAKE_MODULE_PATH "${GLFW_SOURCE_DIR}/CMake/modules")
|
||||||
|
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
|
@ -148,6 +153,21 @@ else()
|
||||||
message(FATAL_ERROR "No supported platform was detected")
|
message(FATAL_ERROR "No supported platform was detected")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# Add Vulkan static library if requested
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
if (GLFW_VULKAN_STATIC)
|
||||||
|
if (VULKAN_FOUND AND VULKAN_STATIC_LIBRARY)
|
||||||
|
list(APPEND glfw_LIBRARIES ${VULKAN_STATIC_LIBRARY})
|
||||||
|
else()
|
||||||
|
if (BUILD_SHARED_LIBS OR GLFW_BUILD_EXAMPLES OR GLFW_BUILD_TESTS)
|
||||||
|
message(FATAL_ERROR "Vulkan loader static library not found")
|
||||||
|
else()
|
||||||
|
message(WARNING "Vulkan loader static library not found")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Find and add Unix math and time libraries
|
# Find and add Unix math and time libraries
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
|
|
|
@ -93,6 +93,8 @@ information on what to include when reporting a bug.
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
- Added on-demand loading of Vulkan and context creation API libraries
|
- Added on-demand loading of Vulkan and context creation API libraries
|
||||||
|
- Added `_GLFW_VULKAN_STATIC` build macro to make the library use the Vulkan
|
||||||
|
loader linked statically into the application
|
||||||
- Bugfix: Single compilation unit builds failed due to naming conflicts (#783)
|
- Bugfix: Single compilation unit builds failed due to naming conflicts (#783)
|
||||||
- Bugfix: The range checks for `glfwSetCursorPos` used the wrong minimum (#773)
|
- Bugfix: The range checks for `glfwSetCursorPos` used the wrong minimum (#773)
|
||||||
- [Win32] Bugfix: `glfwSetClipboardString` created an unnecessary intermediate
|
- [Win32] Bugfix: `glfwSetClipboardString` created an unnecessary intermediate
|
||||||
|
@ -208,6 +210,7 @@ skills.
|
||||||
- Emmanuel Gil Peyrot
|
- Emmanuel Gil Peyrot
|
||||||
- Cyril Pichard
|
- Cyril Pichard
|
||||||
- Pieroman
|
- Pieroman
|
||||||
|
- Philip Rideout
|
||||||
- Jorge Rodriguez
|
- Jorge Rodriguez
|
||||||
- Ed Ropple
|
- Ed Ropple
|
||||||
- Aleksey Rybalkin
|
- Aleksey Rybalkin
|
||||||
|
|
|
@ -197,6 +197,9 @@ built along with the library.
|
||||||
`GLFW_BUILD_DOCS` determines whether the GLFW documentation is built along with
|
`GLFW_BUILD_DOCS` determines whether the GLFW documentation is built along with
|
||||||
the library.
|
the library.
|
||||||
|
|
||||||
|
`GLFW_VULKAN_STATIC` determines whether to use the Vulkan loader linked
|
||||||
|
statically into the application.
|
||||||
|
|
||||||
|
|
||||||
@subsubsection compile_options_osx OS X specific CMake options
|
@subsubsection compile_options_osx OS X specific CMake options
|
||||||
|
|
||||||
|
@ -251,6 +254,10 @@ ramps and clipboard. The options are:
|
||||||
If you are building GLFW as a shared library / dynamic library / DLL then you
|
If you are building GLFW as a shared library / dynamic library / DLL then you
|
||||||
must also define `_GLFW_BUILD_DLL`. Otherwise, you must not define it.
|
must also define `_GLFW_BUILD_DLL`. Otherwise, you must not define it.
|
||||||
|
|
||||||
|
If you are linking the Vulkan loader statically into your application then you
|
||||||
|
must also define `_GLFW_VULKAN_STATIC`. Otherwise, GLFW will attempt to use the
|
||||||
|
external version.
|
||||||
|
|
||||||
For the EGL context creation API, the following options are available:
|
For the EGL context creation API, the following options are available:
|
||||||
|
|
||||||
- `_GLFW_USE_EGLPLATFORM_H` to use `EGL/eglplatform.h` for native handle
|
- `_GLFW_USE_EGLPLATFORM_H` to use `EGL/eglplatform.h` for native handle
|
||||||
|
|
|
@ -47,6 +47,8 @@
|
||||||
|
|
||||||
// Define this to 1 if building as a shared library / dynamic library / DLL
|
// Define this to 1 if building as a shared library / dynamic library / DLL
|
||||||
#cmakedefine _GLFW_BUILD_DLL
|
#cmakedefine _GLFW_BUILD_DLL
|
||||||
|
// Define this to 1 to use Vulkan loader linked statically into application
|
||||||
|
#cmakedefine _GLFW_VULKAN_STATIC
|
||||||
|
|
||||||
// Define this to 1 to force use of high-performance GPU on hybrid systems
|
// Define this to 1 to force use of high-performance GPU on hybrid systems
|
||||||
#cmakedefine _GLFW_USE_HYBRID_HPG
|
#cmakedefine _GLFW_USE_HYBRID_HPG
|
||||||
|
|
|
@ -450,10 +450,10 @@ struct _GLFWlibrary
|
||||||
void* handle;
|
void* handle;
|
||||||
char** extensions;
|
char** extensions;
|
||||||
uint32_t extensionCount;
|
uint32_t extensionCount;
|
||||||
#if !defined(_GLFW_VULKAN_STATIC)
|
#if !defined(_GLFW_VULKAN_STATIC)
|
||||||
PFN_vkEnumerateInstanceExtensionProperties EnumerateInstanceExtensionProperties;
|
PFN_vkEnumerateInstanceExtensionProperties EnumerateInstanceExtensionProperties;
|
||||||
PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
|
PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
|
||||||
#endif
|
#endif
|
||||||
GLFWbool KHR_surface;
|
GLFWbool KHR_surface;
|
||||||
GLFWbool KHR_win32_surface;
|
GLFWbool KHR_win32_surface;
|
||||||
GLFWbool KHR_xlib_surface;
|
GLFWbool KHR_xlib_surface;
|
||||||
|
|
|
@ -80,7 +80,6 @@ GLFWbool _glfwInitVulkan(void)
|
||||||
_glfwTerminateVulkan();
|
_glfwTerminateVulkan();
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _GLFW_VULKAN_STATIC
|
#endif // _GLFW_VULKAN_STATIC
|
||||||
|
|
||||||
err = vkEnumerateInstanceExtensionProperties(NULL, &count, NULL);
|
err = vkEnumerateInstanceExtensionProperties(NULL, &count, NULL);
|
||||||
|
|
|
@ -48,7 +48,9 @@ set(CONSOLE_BINARIES clipboard events msaa gamma glfwinfo
|
||||||
if (VULKAN_FOUND)
|
if (VULKAN_FOUND)
|
||||||
add_executable(vulkan WIN32 vulkan.c ${ICON})
|
add_executable(vulkan WIN32 vulkan.c ${ICON})
|
||||||
target_include_directories(vulkan PRIVATE "${VULKAN_INCLUDE_DIR}")
|
target_include_directories(vulkan PRIVATE "${VULKAN_INCLUDE_DIR}")
|
||||||
target_link_libraries(vulkan "${VULKAN_LIBRARY}")
|
if (NOT GLFW_VULKAN_STATIC)
|
||||||
|
target_link_libraries(vulkan "${VULKAN_LIBRARY}")
|
||||||
|
endif()
|
||||||
list(APPEND WINDOWS_BINARIES vulkan)
|
list(APPEND WINDOWS_BINARIES vulkan)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user