mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 09:55:40 +00:00
all: add support for macOS to flake.nix
The Nix version of the macOS toolchain has difficulties compiling Objective-C modules; disable modules instead of figuring out why. It also doesn't include any frameworks automatically; add them explicitly. While here, move suppression of OpenGL deprecation to a GL-specific file. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -16,6 +16,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
#cgo CFLAGS: -DGL_SILENCE_DEPRECATION -xobjective-c -fobjc-arc
|
||||||
|
#cgo LDFLAGS: -framework OpenGL
|
||||||
|
|
||||||
#include <CoreFoundation/CoreFoundation.h>
|
#include <CoreFoundation/CoreFoundation.h>
|
||||||
#include <CoreGraphics/CoreGraphics.h>
|
#include <CoreGraphics/CoreGraphics.h>
|
||||||
#include <AppKit/AppKit.h>
|
#include <AppKit/AppKit.h>
|
||||||
|
|||||||
+1
-2
@@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
// +build darwin,!ios,nometal
|
// +build darwin,!ios,nometal
|
||||||
|
|
||||||
@import AppKit;
|
#import <AppKit/AppKit.h>
|
||||||
|
|
||||||
#include <CoreFoundation/CoreFoundation.h>
|
#include <CoreFoundation/CoreFoundation.h>
|
||||||
#include <OpenGL/OpenGL.h>
|
#include <OpenGL/OpenGL.h>
|
||||||
#include "_cgo_export.h"
|
#include "_cgo_export.h"
|
||||||
|
|||||||
+4
-3
@@ -12,10 +12,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#cgo CFLAGS: -Werror -xobjective-c -fmodules -fobjc-arc
|
#cgo CFLAGS: -Werror -xobjective-c -fobjc-arc
|
||||||
|
#cgo LDFLAGS: -framework QuartzCore -framework Metal
|
||||||
|
|
||||||
@import Metal;
|
#import <Metal/Metal.h>
|
||||||
@import QuartzCore.CAMetalLayer;
|
#import <QuartzCore/CAMetalLayer.h>
|
||||||
|
|
||||||
#include <CoreFoundation/CoreFoundation.h>
|
#include <CoreFoundation/CoreFoundation.h>
|
||||||
|
|
||||||
|
|||||||
+3
-5
@@ -6,12 +6,10 @@
|
|||||||
package app
|
package app
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#cgo CFLAGS: -Werror -xobjective-c -fmodules -fobjc-arc
|
#cgo CFLAGS: -Werror -xobjective-c -fobjc-arc
|
||||||
|
|
||||||
@import AppKit;
|
|
||||||
|
|
||||||
@import QuartzCore.CAMetalLayer;
|
|
||||||
|
|
||||||
|
#import <AppKit/AppKit.h>
|
||||||
|
#import <QuartzCore/CAMetalLayer.h>
|
||||||
#include <CoreFoundation/CoreFoundation.h>
|
#include <CoreFoundation/CoreFoundation.h>
|
||||||
|
|
||||||
CALayer *gio_layerFactory(void) {
|
CALayer *gio_layerFactory(void) {
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
// SPDX-License-Identifier: Unlicense OR MIT
|
// SPDX-License-Identifier: Unlicense OR MIT
|
||||||
|
|
||||||
@import Dispatch;
|
#import <Dispatch/Dispatch.h>
|
||||||
@import Foundation;
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#include "_cgo_export.h"
|
#include "_cgo_export.h"
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -24,7 +24,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#cgo CFLAGS: -DGL_SILENCE_DEPRECATION -Werror -Wno-deprecated-declarations -fmodules -fobjc-arc -x objective-c
|
#cgo CFLAGS: -Werror -Wno-deprecated-declarations -fobjc-arc -x objective-c
|
||||||
|
#cgo LDFLAGS: -framework AppKit -framework QuartzCore
|
||||||
|
|
||||||
#include <AppKit/AppKit.h>
|
#include <AppKit/AppKit.h>
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
// +build darwin,!ios
|
// +build darwin,!ios
|
||||||
|
|
||||||
@import AppKit;
|
#import <AppKit/AppKit.h>
|
||||||
|
|
||||||
#include "_cgo_export.h"
|
#include "_cgo_export.h"
|
||||||
|
|
||||||
|
|||||||
Generated
+22
-47
@@ -3,17 +3,17 @@
|
|||||||
"android": {
|
"android": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"devshell": "devshell",
|
"devshell": "devshell",
|
||||||
"flake-utils": "flake-utils_2",
|
"flake-utils": "flake-utils",
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1654115078,
|
"lastModified": 1659298920,
|
||||||
"narHash": "sha256-V1XCuFIl6QJuCSJvWKWZKzoHZ+oXP2jYEev4Wf49qk4=",
|
"narHash": "sha256-LgRMge8BZUG15EN43iDJOlnEMX1dvRprB7SaoNqgibU=",
|
||||||
"owner": "tadfisher",
|
"owner": "tadfisher",
|
||||||
"repo": "android-nixpkgs",
|
"repo": "android-nixpkgs",
|
||||||
"rev": "5573d91ad076bfceeae780d9942ab6ec4ef000f0",
|
"rev": "d4f20a3cd4ce961bb23b48447457f6810d69ae5e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -24,15 +24,21 @@
|
|||||||
},
|
},
|
||||||
"devshell": {
|
"devshell": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": [
|
||||||
"nixpkgs": "nixpkgs"
|
"android",
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"nixpkgs": [
|
||||||
|
"android",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1653917170,
|
"lastModified": 1658746384,
|
||||||
"narHash": "sha256-FyxOnEE/V4PNEcMU62ikY4FfYPo349MOhMM97HS0XEo=",
|
"narHash": "sha256-CCJcoMOcXyZFrV1ag4XMTpAPjLWb4Anbv+ktXFI1ry0=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "devshell",
|
"repo": "devshell",
|
||||||
"rev": "fc7a3e3adde9bbcab68af6d1e3c6eb738e296a92",
|
"rev": "0ffc7937bb5e8141af03d462b468bd071eb18e1b",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -43,26 +49,11 @@
|
|||||||
},
|
},
|
||||||
"flake-utils": {
|
"flake-utils": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1642700792,
|
"lastModified": 1656928814,
|
||||||
"narHash": "sha256-XqHrk7hFb+zBvRg6Ghl+AZDq03ov6OshJLiSWOoX5es=",
|
"narHash": "sha256-RIFfgBuKz6Hp89yRr7+NR5tzIAbn52h8vT6vXkYjZoM=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "846b2ae0fc4cc943637d3d1def4454213e203cba",
|
"rev": "7e2a3b3dfd9af950a856d66b0a7d01e3c18aa249",
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"flake-utils_2": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1653893745,
|
|
||||||
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
|
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -73,27 +64,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1643381941,
|
"lastModified": 1659305579,
|
||||||
"narHash": "sha256-pHTwvnN4tTsEKkWlXQ8JMY423epos8wUOhthpwJjtpc=",
|
"narHash": "sha256-SFeQTmh7hc9Y2fSkooHaoS8mDfPa04sfmUCtQ8MA6Pg=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "5efc8ca954272c4376ac929f4c5ffefcc20551d5",
|
"rev": "5857574d45925585baffde730369414319228a84",
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "NixOS",
|
|
||||||
"ref": "nixpkgs-unstable",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs_2": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1654165167,
|
|
||||||
"narHash": "sha256-cx57sQl9Q+kJoIB0INg8Gomvyl2KahCL9UPz0F6g20Y=",
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "7adf49bbab9814d5b071d50cf17cce4270e1c294",
|
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -105,7 +80,7 @@
|
|||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"android": "android",
|
"android": "android",
|
||||||
"nixpkgs": "nixpkgs_2"
|
"nixpkgs": "nixpkgs"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -47,6 +47,12 @@
|
|||||||
xorg.libXfixes
|
xorg.libXfixes
|
||||||
libGL
|
libGL
|
||||||
pkgconfig
|
pkgconfig
|
||||||
|
] else if stdenv.isDarwin then [
|
||||||
|
darwin.apple_sdk_11_0.frameworks.Foundation
|
||||||
|
darwin.apple_sdk_11_0.frameworks.Metal
|
||||||
|
darwin.apple_sdk_11_0.frameworks.QuartzCore
|
||||||
|
darwin.apple_sdk_11_0.frameworks.AppKit
|
||||||
|
darwin.apple_sdk_11_0.MacOSX-SDK
|
||||||
] else [ ]);
|
] else [ ]);
|
||||||
} // (if stdenv.isLinux then {
|
} // (if stdenv.isLinux then {
|
||||||
LD_LIBRARY_PATH = "${vulkan-loader}/lib";
|
LD_LIBRARY_PATH = "${vulkan-loader}/lib";
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#cgo CFLAGS: -Werror -Wno-deprecated-declarations -fmodules -fobjc-arc -x objective-c
|
#cgo CFLAGS: -Werror -Wno-deprecated-declarations -fobjc-arc -x objective-c
|
||||||
#cgo LDFLAGS: -framework CoreGraphics
|
#cgo LDFLAGS: -framework CoreGraphics -framework Metal -framework Foundation
|
||||||
|
|
||||||
@import Metal;
|
#import <Metal/Metal.h>
|
||||||
|
|
||||||
static CFTypeRef createDevice(void) {
|
static CFTypeRef createDevice(void) {
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
|
|||||||
@@ -13,10 +13,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#cgo CFLAGS: -Werror -xobjective-c -fmodules -fobjc-arc
|
#cgo CFLAGS: -Werror -xobjective-c -fobjc-arc
|
||||||
#cgo LDFLAGS: -framework CoreGraphics
|
#cgo LDFLAGS: -framework CoreGraphics -framework Metal -framework Foundation
|
||||||
|
|
||||||
@import Metal;
|
|
||||||
|
|
||||||
#include <CoreFoundation/CoreFoundation.h>
|
#include <CoreFoundation/CoreFoundation.h>
|
||||||
#include <Metal/Metal.h>
|
#include <Metal/Metal.h>
|
||||||
|
|||||||
@@ -5,7 +5,8 @@
|
|||||||
package cocoainit
|
package cocoainit
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#cgo CFLAGS: -xobjective-c -fmodules -fobjc-arc
|
#cgo CFLAGS: -xobjective-c -fobjc-arc
|
||||||
|
#cgo LDFLAGS: -framework Foundation
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
static inline void activate_cocoa_multithreading() {
|
static inline void activate_cocoa_multithreading() {
|
||||||
|
|||||||
Reference in New Issue
Block a user