File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3232 run : swift build -v
3333 - name : Run tests
3434 run : swift test -v
35+
36+ build-windows :
37+
38+ runs-on : windows-latest
39+
40+ steps :
41+ - uses : actions/checkout@v2
42+ - uses : seanmiddleditch/gha-setup-vsdevenv@master
43+
44+ - name : Install swift-DEVELOPMENT-SNAPSHOT-2020-11-17-a
45+ run : |
46+ Install-Binary -Url "https://swift.org/builds/development/windows10/swift-DEVELOPMENT-SNAPSHOT-2020-11-17-a/swift-DEVELOPMENT-SNAPSHOT-2020-11-17-a-windows10.exe" -Name "installer.exe" -ArgumentList ("-q")
47+ - name : Set Environment Variables
48+ run : |
49+ echo "SDKROOT=C:\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
50+ echo "DEVELOPER_DIR=C:\Library\Developer" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
51+ - name : Adjust Paths
52+ run : |
53+ echo "C:\Library\Swift-development\bin;C:\Library\icu-67\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
54+ echo "C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
55+ - name : Install Supporting Files
56+ run : |
57+ Copy-Item "$env:SDKROOT\usr\share\ucrt.modulemap" -destination "$env:UniversalCRTSdkDir\Include\$env:UCRTVersion\ucrt\module.modulemap"
58+ Copy-Item "$env:SDKROOT\usr\share\visualc.modulemap" -destination "$env:VCToolsInstallDir\include\module.modulemap"
59+ Copy-Item "$env:SDKROOT\usr\share\visualc.apinotes" -destination "$env:VCToolsInstallDir\include\visualc.apinotes"
60+ Copy-Item "$env:SDKROOT\usr\share\winsdk.modulemap" -destination "$env:UniversalCRTSdkDir\Include\$env:UCRTVersion\um\module.modulemap"
61+ - name : Build
62+ run : swift build -v
63+ - name : Run tests
64+ run : swift test -v
Original file line number Diff line number Diff line change 99#if NOSIMD
1010
1111#if (os(OSX) || os(iOS) || os(tvOS) || os(watchOS))
12- import Darwin
13- #else
14- import Glibc
12+ import Darwin
13+ #elseif os(Linux) || os(Android)
14+ import Glibc
1515#endif
16+
1617 @frozen
1718 public struct Vector2f {
1819 public var x : Float = 0.0
Original file line number Diff line number Diff line change 99#if NOSIMD
1010
1111#if (os(OSX) || os(iOS) || os(tvOS) || os(watchOS))
12- import Darwin
13- #else
14- import Glibc
12+ import Darwin
13+ #elseif os(Linux) || os(Android)
14+ import Glibc
1515#endif
1616
1717@frozen
Original file line number Diff line number Diff line change 99
1010#if (os(OSX) || os(iOS) || os(tvOS) || os(watchOS))
1111import Darwin
12- #else
12+ #elseif os(Linux) || os(Android)
1313import Glibc
1414#endif
1515
Original file line number Diff line number Diff line change 88
99#if (os(OSX) || os(iOS) || os(tvOS) || os(watchOS))
1010import Darwin
11- #else
11+ #elseif os(Linux) || os(Android)
1212import Glibc
1313#endif
1414
Original file line number Diff line number Diff line change 22// License: https://github.com/SwiftGFX/SwiftMath#license-bsd-2-clause
33//
44
5- #if !(os(OSX) || os(iOS) || os(tvOS) || os(watchOS))
6-
5+ #if os(Linux) || os(Android)
76import Glibc
7+ #elseif os(Windows)
8+
9+ import ucrt
10+
11+ @inline ( __always)
12+ internal func sin( _ a: Float ) -> Float {
13+ return ucrt. sinf ( a)
14+ }
15+
16+ @inline ( __always)
17+ internal func sin( _ a: Double ) -> Double {
18+ return ucrt. sin ( a)
19+ }
20+
21+ @inline ( __always)
22+ internal func cos( _ a: Float ) -> Float {
23+ return ucrt. cosf ( a)
24+ }
25+
26+ @inline ( __always)
27+ internal func cos( _ a: Double ) -> Double {
28+ return ucrt. cos ( a)
29+ }
30+
31+ @inline ( __always)
32+ internal func tan( _ a: Float ) -> Float {
33+ return ucrt. tanf ( a)
34+ }
35+
36+ @inline ( __always)
37+ internal func tan( _ a: Double ) -> Double {
38+ return ucrt. tan ( a)
39+ }
40+
41+ @inline ( __always)
42+ internal func sqrtf( _ a: Float ) -> Float {
43+ return ucrt. sqrtf ( a)
44+ }
45+
46+ @inline ( __always)
47+ internal func sqrt( _ a: Float ) -> Float {
48+ return ucrt. sqrtf ( a)
49+ }
50+
51+ @inline ( __always)
52+ internal func sqrt( _ a: Double ) -> Double {
53+ return ucrt. sqrt ( a)
54+ }
55+
56+ @inline ( __always)
57+ internal func powf( _ a: Float , _ b: Float ) -> Float {
58+ return ucrt. powf ( a, b)
59+ }
60+
61+ #endif
862
63+
64+ #if (os(Linux) || os(Android) || os(Windows))
65+
966@inline ( __always)
1067internal func __sincospif( _ a: Float , _ sina: inout Float , _ cosa: inout Float ) {
1168 sina = sin ( a * Float. pi)
@@ -28,7 +85,7 @@ internal func __tanpif(_ a: Float) -> Float {
2885 return tan ( a * Float. pi)
2986}
3087
31- #else
88+ #elseif (os(OSX) || os(iOS) || os(tvOS) || os(watchOS))
3289
3390import Darwin
3491
Original file line number Diff line number Diff line change 1010
1111#if (os(OSX) || os(iOS) || os(tvOS) || os(watchOS))
1212import Darwin
13- #else
13+ #elseif os(Linux) || os(Android)
1414import Glibc
1515import SwiftGlibc
1616
@@ -21,6 +21,16 @@ internal func arc4random() -> UInt32 {
2121internal func arc4random_uniform( _ val: UInt32 ) -> UInt32 {
2222 return UInt32 ( random ( ) ) % val
2323}
24+
25+ #elseif os(Windows)
26+
27+ internal func arc4random( ) -> UInt32 {
28+ return UInt32 . random ( in: UInt32 . min... UInt32 . max)
29+ }
30+
31+ internal func arc4random_uniform( _ val: UInt32 ) -> UInt32 {
32+ return UInt32 . random ( in: 0 ... val)
33+ }
2434#endif
2535
2636// each type has its own random
You can’t perform that action at this time.
0 commit comments