File tree 7 files changed +110
-12
lines changed
7 files changed +110
-12
lines changed Original file line number Diff line number Diff line change 32
32
run : swift build -v
33
33
- name : Run tests
34
34
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 9
9
#if NOSIMD
10
10
11
11
#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
15
15
#endif
16
+
16
17
@frozen
17
18
public struct Vector2f {
18
19
public var x : Float = 0.0
Original file line number Diff line number Diff line change 9
9
#if NOSIMD
10
10
11
11
#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
15
15
#endif
16
16
17
17
@frozen
Original file line number Diff line number Diff line change 9
9
10
10
#if (os(OSX) || os(iOS) || os(tvOS) || os(watchOS))
11
11
import Darwin
12
- #else
12
+ #elseif os(Linux) || os(Android)
13
13
import Glibc
14
14
#endif
15
15
Original file line number Diff line number Diff line change 8
8
9
9
#if (os(OSX) || os(iOS) || os(tvOS) || os(watchOS))
10
10
import Darwin
11
- #else
11
+ #elseif os(Linux) || os(Android)
12
12
import Glibc
13
13
#endif
14
14
Original file line number Diff line number Diff line change 2
2
// License: https://github.com/SwiftGFX/SwiftMath#license-bsd-2-clause
3
3
//
4
4
5
- #if !(os(OSX) || os(iOS) || os(tvOS) || os(watchOS))
6
-
5
+ #if os(Linux) || os(Android)
7
6
import 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
8
62
63
+
64
+ #if (os(Linux) || os(Android) || os(Windows))
65
+
9
66
@inline ( __always)
10
67
internal func __sincospif( _ a: Float , _ sina: inout Float , _ cosa: inout Float ) {
11
68
sina = sin ( a * Float. pi)
@@ -28,7 +85,7 @@ internal func __tanpif(_ a: Float) -> Float {
28
85
return tan ( a * Float. pi)
29
86
}
30
87
31
- #else
88
+ #elseif (os(OSX) || os(iOS) || os(tvOS) || os(watchOS))
32
89
33
90
import Darwin
34
91
Original file line number Diff line number Diff line change 10
10
11
11
#if (os(OSX) || os(iOS) || os(tvOS) || os(watchOS))
12
12
import Darwin
13
- #else
13
+ #elseif os(Linux) || os(Android)
14
14
import Glibc
15
15
import SwiftGlibc
16
16
@@ -21,6 +21,16 @@ internal func arc4random() -> UInt32 {
21
21
internal func arc4random_uniform( _ val: UInt32 ) -> UInt32 {
22
22
return UInt32 ( random ( ) ) % val
23
23
}
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
+ }
24
34
#endif
25
35
26
36
// each type has its own random
You can’t perform that action at this time.
0 commit comments