SWIFTPM_MODULE_BUNDLE now seems to work for ObjC++
This commit is contained in:
parent
aa33f717c3
commit
b499d9b985
|
@ -1,15 +0,0 @@
|
|||
// Copyright © 2021 Audulus LLC. All rights reserved.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// Accessing SWIFTPM_MODULE_BUNDLE from ObjC++ doesn't work for some reason.
|
||||
/// See https://forums.swift.org/t/undefined-symbol-package-module-swiftpm-module-bundle/45773
|
||||
@interface vgerBundleHelper : NSObject
|
||||
|
||||
+ (NSBundle*) moduleBundle;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -1,17 +0,0 @@
|
|||
// Copyright © 2021 Audulus LLC. All rights reserved.
|
||||
|
||||
#import "vgerBundleHelper.h"
|
||||
|
||||
@implementation vgerBundleHelper
|
||||
|
||||
+ (NSBundle*) moduleBundle {
|
||||
#ifdef SWIFTPM_MODULE_BUNDLE
|
||||
NSBundle* bundle = SWIFTPM_MODULE_BUNDLE;
|
||||
#else
|
||||
NSBundle* bundle = [NSBundle mainBundle];
|
||||
#endif
|
||||
assert(bundle);
|
||||
return bundle;
|
||||
}
|
||||
|
||||
@end
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
#import "vgerGlyphCache.h"
|
||||
#import "vgerTextureManager.h"
|
||||
#import "vgerBundleHelper.h"
|
||||
#include <vector>
|
||||
|
||||
@interface vgerGlyphCache() {
|
||||
|
@ -19,9 +18,8 @@
|
|||
if (self) {
|
||||
mgr = [[vgerTextureManager alloc] initWithDevice:device pixelFormat:MTLPixelFormatA8Unorm];
|
||||
|
||||
auto bundle = [vgerBundleHelper moduleBundle];
|
||||
auto bundle = SWIFTPM_MODULE_BUNDLE;
|
||||
assert(bundle);
|
||||
|
||||
auto fontURL = [bundle URLForResource:@"Anodina-Regular" withExtension:@"ttf" subdirectory:@"fonts"];
|
||||
|
||||
auto fd = CTFontManagerCreateFontDescriptorsFromURL( (__bridge CFURLRef) fontURL);
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
// Copyright © 2021 Audulus LLC. All rights reserved.
|
||||
|
||||
#import "vgerGlyphPathCache.h"
|
||||
#import "vgerBundleHelper.h"
|
||||
#import "sdf.h"
|
||||
|
||||
using namespace simd;
|
||||
|
||||
vgerGlyphPathCache::vgerGlyphPathCache() {
|
||||
|
||||
auto bundle = [vgerBundleHelper moduleBundle];
|
||||
auto bundle = SWIFTPM_MODULE_BUNDLE;
|
||||
assert(bundle);
|
||||
|
||||
auto fontURL = [bundle URLForResource:@"Anodina-Regular" withExtension:@"ttf" subdirectory:@"fonts"];
|
||||
|
||||
auto fd = CTFontManagerCreateFontDescriptorsFromURL( (__bridge CFURLRef) fontURL);
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
// Copyright © 2021 Audulus LLC. All rights reserved.
|
||||
|
||||
#import "vgerRenderer.h"
|
||||
#import "vgerBundleHelper.h"
|
||||
#import "paint.h"
|
||||
#import "prim.h"
|
||||
|
||||
static id<MTLLibrary> GetMetalLibrary(id<MTLDevice> device) {
|
||||
|
||||
auto bundle = [vgerBundleHelper moduleBundle];
|
||||
auto bundle = SWIFTPM_MODULE_BUNDLE;
|
||||
assert(bundle);
|
||||
|
||||
auto libraryURL = [bundle URLForResource:@"default" withExtension:@"metallib"];
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
// Copyright © 2021 Audulus LLC. All rights reserved.
|
||||
|
||||
#import "vgerTileRenderer.h"
|
||||
#import "vgerBundleHelper.h"
|
||||
#import "commands.h"
|
||||
|
||||
static id<MTLLibrary> GetMetalLibrary(id<MTLDevice> device) {
|
||||
|
||||
auto bundle = [vgerBundleHelper moduleBundle];
|
||||
auto bundle = SWIFTPM_MODULE_BUNDLE;
|
||||
assert(bundle);
|
||||
|
||||
auto libraryURL = [bundle URLForResource:@"default" withExtension:@"metallib"];
|
||||
|
|
Loading…
Reference in New Issue