Skip to content

Commit

Permalink
Cleanup and fix some issues BradLarson#101
Browse files Browse the repository at this point in the history
Ok This will work but you need to change the project layout which I have done. So the Idea here was to move the macros os checks for excludes out of the package def. 
Then wrap the package in an os check macro that throws an error when used with an unsupported os.

I also added in a providers array to apt-get the Linux package  "libv4l-dev".

Now I got this working but I created a new repo with just the framework folder. Also, I had to add a script as you can not have a mix source package so the Linux folder (module) has c and swift.

Now Don't merge this just yet as the project layout need changing to let this be a Swift Package that swift package manager to install.

So if you message me back on this pull request that you would be happy with a project layout change then I will add that to this pull.
Or the other option is to create a 2nd repo with the contents of the Framework folder and this package.swift file and that can be the repo that swift package manager can work with.
  • Loading branch information
Apps4u authored Dec 21, 2016
1 parent fe4dfc4 commit 42c13ae
Showing 1 changed file with 45 additions and 24 deletions.
69 changes: 45 additions & 24 deletions framework/Package.swift
Original file line number Diff line number Diff line change
@@ -1,30 +1,51 @@
import PackageDescription

/**
Better to create variables for the excludes so you dont have the
package def wrapped with macros .

Also need to trap if os is not support like watch and tv
*/
#if os(macOS)

let excludes = ["iOS", "Linux"]

#elseif os(iOS)

let excludes = ["Linux", "Mac"]

#elseif os(Linux)

let excludes = ["iOS", "Mac"]

#endif


#if os(Linux) || os(macOS) || os(Linux)

let package = Package(
name: "GPUImage",
providers: [
.Apt("libv4l-dev"),
],
targets: [
Target(name: "GPUImage")
],
#if os(OSX)
exclude: [
"iOS",
"Linux"
])
#elseif os(iOS)
exclude: [
"Linux",
"Mac"
])
#elseif os(Linux)
dependencies: [
.Package(url: "./Packages/CVideo4Linux",
majorVersion: 1),
.Package(url: "./Packages/COpenGL",
majorVersion: 1),
.Package(url: "./Packages/CFreeGLUT",
majorVersion: 1),
],
exclude: [
"iOS",
"Mac"
])
dependencies:[],
exclude: excludes
)

#if os(Linux)
package.dependencies.append([
.Package(url: "./Packages/CVideo4Linux", majorVersion: 1),
.Package(url: "./Packages/COpenGL", majorVersion: 1),
.Package(url: "./Packages/CFreeGLUT", majorVersion: 1),
])
#endif


#else

fatalError("Unsupported OS")

#endif

0 comments on commit 42c13ae

Please sign in to comment.