Skip to content

Commit bf19a4e

Browse files
committed
Got initial Swift Package Manager support working for Mac, Linux is still non-functional.
1 parent 32875d8 commit bf19a4e

35 files changed

+328
-330
lines changed

Package.swift

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// swift-tools-version:4.0
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
#if os(macOS)
7+
let platformDepedencies: [Package.Dependency] = []
8+
let platformExcludes = ["iOS", "Linux", "Operations/Shaders"]
9+
#elseif os(iOS)
10+
let platformDepedencies: [Package.Dependency] = []
11+
let platformExcludes = ["Linux", "Mac", "Operations/Shaders"]
12+
#elseif os(Linux)
13+
// TODO: Add back in RPi support
14+
let platformDepedencies: [Package.Dependency] = [.package(url: "https://github.com/BradLarson/COpenGL.git", from: "1.0.2"), .package(url: "https://github.com/BradLarson/CFreeGLUT.git", from: "1.0.1"), .package(url: "https://github.com/BradLarson/CVideo4Linux.git", from: "1.0.2")]
15+
let platformExcludes = ["iOS", "Mac", "Operations/Shaders", "Linux/RPiRenderWindow.swift", "Linux/OpenGLContext-RPi.swift", "Linux/V4LSupplement"]
16+
#endif
17+
18+
19+
let package = Package(
20+
name: "GPUImage",
21+
products: [
22+
.library(
23+
name: "GPUImage",
24+
targets: ["GPUImage"]),
25+
],
26+
dependencies: platformDepedencies,
27+
targets: [
28+
.target(
29+
name: "GPUImage",
30+
path: "framework/Source",
31+
exclude: platformExcludes),
32+
]
33+
)

framework/GPUImage.xcodeproj/project.pbxproj

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@
379379
BC1E12FD1C9F5283008F844F /* OpenGLContext_Shared.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = OpenGLContext_Shared.swift; path = Source/OpenGLContext_Shared.swift; sourceTree = "<group>"; };
380380
BC1E13281C9F6282008F844F /* PictureInput.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PictureInput.swift; path = Source/Mac/PictureInput.swift; sourceTree = "<group>"; };
381381
BC2C48031CB80E860085E4BC /* Crop.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Crop.swift; path = Source/Operations/Crop.swift; sourceTree = "<group>"; };
382-
BC4C85ED1C9F042900FD95D8 /* ConvertedShaders_GL.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ConvertedShaders_GL.swift; path = Source/Operations/Shaders/ConvertedShaders_GL.swift; sourceTree = SOURCE_ROOT; };
382+
BC4C85ED1C9F042900FD95D8 /* ConvertedShaders_GL.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ConvertedShaders_GL.swift; path = Source/Operations/ConvertedShaders_GL.swift; sourceTree = SOURCE_ROOT; };
383383
BC4C85F01C9F054100FD95D8 /* Luminance_GL.fsh */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.glsl; name = Luminance_GL.fsh; path = Source/Operations/Shaders/Luminance_GL.fsh; sourceTree = "<group>"; };
384384
BC4C85F11C9F05EB00FD95D8 /* Luminance.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Luminance.swift; path = Source/Operations/Luminance.swift; sourceTree = "<group>"; };
385385
BC4C85F71C9F167B00FD95D8 /* Saturation_GL.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; name = Saturation_GL.fsh; path = Source/Operations/Shaders/Saturation_GL.fsh; sourceTree = "<group>"; };
@@ -582,7 +582,7 @@
582582
BC9E35491E524DC100B8604F /* Crosshair_GLES.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; name = Crosshair_GLES.fsh; path = Source/Operations/Shaders/Crosshair_GLES.fsh; sourceTree = "<group>"; };
583583
BC9E354B1E524DD400B8604F /* Line_GLES.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; name = Line_GLES.fsh; path = Source/Operations/Shaders/Line_GLES.fsh; sourceTree = "<group>"; };
584584
BC9E354D1E524E0300B8604F /* Circle_GLES.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; name = Circle_GLES.fsh; path = Source/Operations/Shaders/Circle_GLES.fsh; sourceTree = "<group>"; };
585-
BC9E35531E52521F00B8604F /* ConvertedShaders_GLES.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ConvertedShaders_GLES.swift; path = Source/Operations/Shaders/ConvertedShaders_GLES.swift; sourceTree = SOURCE_ROOT; };
585+
BC9E35531E52521F00B8604F /* ConvertedShaders_GLES.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ConvertedShaders_GLES.swift; path = Source/Operations/ConvertedShaders_GLES.swift; sourceTree = SOURCE_ROOT; };
586586
BC9E355C1E5252E900B8604F /* Passthrough_GLES.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; name = Passthrough_GLES.fsh; path = Source/Operations/Shaders/Passthrough_GLES.fsh; sourceTree = "<group>"; };
587587
BCA4E22F1CC31276007B51BA /* Solarize.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Solarize.swift; path = Source/Operations/Solarize.swift; sourceTree = "<group>"; };
588588
BCA4E2311CC312EF007B51BA /* Solarize_GL.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; name = Solarize_GL.fsh; path = Source/Operations/Shaders/Solarize_GL.fsh; sourceTree = "<group>"; };
@@ -1316,6 +1316,7 @@
13161316
developmentRegion = English;
13171317
hasScannedForEncodings = 0;
13181318
knownRegions = (
1319+
English,
13191320
en,
13201321
);
13211322
mainGroup = BC6E7CA11C39A9D8006DF678;
@@ -1799,7 +1800,7 @@
17991800
SDKROOT = macosx;
18001801
SKIP_INSTALL = YES;
18011802
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
1802-
SWIFT_VERSION = 4.0;
1803+
SWIFT_VERSION = 4.2;
18031804
VERSIONING_SYSTEM = "apple-generic";
18041805
VERSION_INFO_PREFIX = "";
18051806
};
@@ -1851,7 +1852,7 @@
18511852
MACOSX_DEPLOYMENT_TARGET = 10.9;
18521853
SDKROOT = macosx;
18531854
SKIP_INSTALL = YES;
1854-
SWIFT_VERSION = 4.0;
1855+
SWIFT_VERSION = 4.2;
18551856
VERSIONING_SYSTEM = "apple-generic";
18561857
VERSION_INFO_PREFIX = "";
18571858
};

framework/Package.swift

Lines changed: 0 additions & 51 deletions
This file was deleted.

framework/Source/FillMode.swift

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
#if os(Linux)
22
import Glibc
3-
#if GLES
4-
import COpenGLES.gles2
5-
#else
6-
import COpenGL
73
#endif
8-
#else
9-
#if GLES
10-
import OpenGLES
11-
#else
12-
import OpenGL.GL3
4+
5+
#if canImport(OpenGL)
6+
import OpenGL.GL3
7+
#endif
8+
9+
#if canImport(OpenGLES)
10+
import OpenGLES
1311
#endif
12+
13+
#if canImport(COpenGL)
14+
import COpenGL
1415
#endif
1516

1617

framework/Source/Framebuffer.swift

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
#if os(Linux)
22
import Glibc
3-
#if GLES
4-
import COpenGLES.gles2
5-
let GL_BGRA = GL_RGBA // A hack: Raspberry Pi needs this or framebuffer creation fails
6-
#else
7-
import COpenGL
83
#endif
9-
#else
10-
#if GLES
11-
import OpenGLES
12-
#else
13-
import OpenGL.GL3
4+
5+
#if canImport(OpenGL)
6+
import OpenGL.GL3
7+
#endif
8+
9+
#if canImport(OpenGLES)
10+
import OpenGLES
1411
#endif
12+
13+
#if canImport(COpenGLES)
14+
import COpenGLES.gles2
15+
let GL_BGRA = GL_RGBA // A hack: Raspberry Pi needs this or framebuffer creation fails
16+
#endif
17+
18+
#if canImport(COpenGL)
19+
import COpenGL
1520
#endif
1621

1722
import Foundation

framework/Source/FramebufferCache.swift

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
#if os(Linux)
2-
#if GLES
3-
import COpenGLES.gles2
4-
#else
5-
import COpenGL
1+
#if canImport(OpenGL)
2+
import OpenGL.GL3
63
#endif
7-
#else
8-
#if GLES
9-
import OpenGLES
10-
#else
11-
import OpenGL.GL3
4+
5+
#if canImport(OpenGLES)
6+
import OpenGLES
7+
#endif
8+
9+
#if canImport(COpenGLES)
10+
import COpenGLES.gles2
1211
#endif
12+
13+
#if canImport(COpenGL)
14+
import COpenGL
1315
#endif
1416

1517
// TODO: Add mechanism to purge framebuffers on low memory
File renamed without changes.
File renamed without changes.
File renamed without changes.

framework/Source/Mac/MovieOutput.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class MovieOutput: ImageConsumer, AudioEncodingTarget {
2727
return assetWriterVideoInput.transform
2828
}
2929
set {
30-
assetWriterVideoInput.transform = transform
30+
assetWriterVideoInput.transform = newValue
3131
}
3232
}
3333

@@ -193,14 +193,14 @@ public class MovieOutput: ImageConsumer, AudioEncodingTarget {
193193

194194

195195
public extension Timestamp {
196-
public init(_ time:CMTime) {
196+
init(_ time:CMTime) {
197197
self.value = time.value
198198
self.timescale = time.timescale
199199
self.flags = TimestampFlags(rawValue:time.flags.rawValue)
200200
self.epoch = time.epoch
201201
}
202202

203-
public var asCMTime:CMTime {
203+
var asCMTime:CMTime {
204204
get {
205205
return CMTimeMakeWithEpoch(value, timescale, epoch)
206206
}

0 commit comments

Comments
 (0)