mirror of
https://github.com/glfw/glfw.git
synced 2024-11-24 05:34:36 +00:00
Cocoa: Add QuartzCore as a link-time dependency
This commit is contained in:
parent
8b574030a8
commit
97892c6037
@ -123,6 +123,7 @@ information on what to include when reporting a bug.
|
|||||||
|
|
||||||
- Added `GLFW_UNLIMITED_MOUSE_BUTTONS` input mode that allows mouse buttons beyond
|
- Added `GLFW_UNLIMITED_MOUSE_BUTTONS` input mode that allows mouse buttons beyond
|
||||||
the limit of the mouse button tokens to be reported (#2423)
|
the limit of the mouse button tokens to be reported (#2423)
|
||||||
|
- [Cocoa] Added `QuartzCore` framework as link-time dependency
|
||||||
- [Cocoa] Removed support for OS X 10.10 Yosemite and earlier (#2506)
|
- [Cocoa] Removed support for OS X 10.10 Yosemite and earlier (#2506)
|
||||||
- [Wayland] Bugfix: The fractional scaling related objects were not destroyed
|
- [Wayland] Bugfix: The fractional scaling related objects were not destroyed
|
||||||
- [Wayland] Bugfix: `glfwInit` would segfault on compositor with no seat (#2517)
|
- [Wayland] Bugfix: `glfwInit` would segfault on compositor with no seat (#2517)
|
||||||
|
@ -390,8 +390,8 @@ If you are using the dynamic library version of GLFW, add it to the project
|
|||||||
dependencies.
|
dependencies.
|
||||||
|
|
||||||
If you are using the static library version of GLFW, add it and the Cocoa,
|
If you are using the static library version of GLFW, add it and the Cocoa,
|
||||||
OpenGL and IOKit frameworks to the project as dependencies. They can all be
|
OpenGL, IOKit and QuartzCore frameworks to the project as dependencies. They
|
||||||
found in `/System/Library/Frameworks`.
|
can all be found in `/System/Library/Frameworks`.
|
||||||
|
|
||||||
|
|
||||||
### With command-line or makefile on macOS {#build_link_osx}
|
### With command-line or makefile on macOS {#build_link_osx}
|
||||||
@ -405,7 +405,7 @@ command-line yourself using the `-l` and `-framework` switches.
|
|||||||
If you are using the dynamic GLFW library, which is named `libglfw.3.dylib`, do:
|
If you are using the dynamic GLFW library, which is named `libglfw.3.dylib`, do:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cc -o myprog myprog.c -lglfw -framework Cocoa -framework OpenGL -framework IOKit
|
cc -o myprog myprog.c -lglfw -framework Cocoa -framework OpenGL -framework IOKit -framework QuartzCore
|
||||||
```
|
```
|
||||||
|
|
||||||
If you are using the static library, named `libglfw3.a`, substitute `-lglfw3`
|
If you are using the static library, named `libglfw3.a`, substitute `-lglfw3`
|
||||||
|
@ -151,10 +151,11 @@ endif()
|
|||||||
if (GLFW_BUILD_COCOA)
|
if (GLFW_BUILD_COCOA)
|
||||||
target_link_libraries(glfw PRIVATE "-framework Cocoa"
|
target_link_libraries(glfw PRIVATE "-framework Cocoa"
|
||||||
"-framework IOKit"
|
"-framework IOKit"
|
||||||
"-framework CoreFoundation")
|
"-framework CoreFoundation"
|
||||||
|
"-framework QuartzCore")
|
||||||
|
|
||||||
set(glfw_PKG_DEPS "")
|
set(glfw_PKG_DEPS "")
|
||||||
set(glfw_PKG_LIBS "-framework Cocoa -framework IOKit -framework CoreFoundation")
|
set(glfw_PKG_LIBS "-framework Cocoa -framework IOKit -framework CoreFoundation -framework QuartzCore")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (GLFW_BUILD_WAYLAND)
|
if (GLFW_BUILD_WAYLAND)
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
#if defined(_GLFW_COCOA)
|
#if defined(_GLFW_COCOA)
|
||||||
|
|
||||||
|
#import <QuartzCore/CAMetalLayer.h>
|
||||||
|
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
@ -1948,18 +1950,8 @@ VkResult _glfwCreateWindowSurfaceCocoa(VkInstance instance,
|
|||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
|
|
||||||
// HACK: Dynamically load Core Animation to avoid adding an extra
|
|
||||||
// dependency for the majority who don't use MoltenVK
|
|
||||||
NSBundle* bundle = [NSBundle bundleWithPath:@"/System/Library/Frameworks/QuartzCore.framework"];
|
|
||||||
if (!bundle)
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
|
||||||
"Cocoa: Failed to find QuartzCore.framework");
|
|
||||||
return VK_ERROR_EXTENSION_NOT_PRESENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOTE: Create the layer here as makeBackingLayer should not return nil
|
// NOTE: Create the layer here as makeBackingLayer should not return nil
|
||||||
window->ns.layer = [[bundle classNamed:@"CAMetalLayer"] layer];
|
window->ns.layer = [CAMetalLayer layer];
|
||||||
if (!window->ns.layer)
|
if (!window->ns.layer)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
Loading…
Reference in New Issue
Block a user