Skip to content

Commit

Permalink
Add Swift Package Manager and Linux support
Browse files Browse the repository at this point in the history
  • Loading branch information
harlanhaskins authored and nicklockwood committed May 8, 2018
1 parent a841991 commit 462b643
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
.build/
xcuserdata/
project.xcworkspace/
project.xcworkspace/
22 changes: 22 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// swift-tools-version:4.1

import PackageDescription

let package = Package(
name: "VectorMath",
products: [
.library(
name: "VectorMath",
targets: ["VectorMath"]),
],
dependencies: [],
targets: [
.target(
name: "VectorMath",
dependencies: [],
path: "VectorMath"),
.testTarget(
name: "VectorMathTests",
dependencies: ["VectorMath"]),
]
)
4 changes: 4 additions & 0 deletions Tests/VectorMathTests/VectorMathTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
import QuartzCore
import XCTest

#if SWIFT_PACKAGE
@testable import VectorMath
#endif

class Vector2Tests: XCTestCase {

func testRotatedBy() {
Expand Down
4 changes: 4 additions & 0 deletions VectorMath/VectorMath+Quartz.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
// 3. This notice may not be removed or altered from any source distribution.
//

#if canImport(QuartzCore)

import QuartzCore

// MARK: SceneKit extensions
Expand Down Expand Up @@ -110,3 +112,5 @@ public extension Matrix4 {
)
}
}

#endif
4 changes: 4 additions & 0 deletions VectorMath/VectorMath+SceneKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
// 3. This notice may not be removed or altered from any source distribution.
//

#if canImport(SceneKit)

#if os(iOS) || os(tvOS)
typealias SCNFloat = Float
#else
Expand Down Expand Up @@ -108,3 +110,5 @@ public extension Quaternion {
self.init(x: Scalar(q.x), y: Scalar(q.y), z: Scalar(q.z), w: Scalar(q.w))
}
}

#endif

0 comments on commit 462b643

Please sign in to comment.