Merge pull request #26 from fireblade-engine/fix/arch-wasm32

Add web assembly support
This commit is contained in:
Christian Treffs 2020-08-11 22:38:24 +02:00 committed by GitHub
commit efaece0155
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 10 deletions

View File

@ -43,4 +43,16 @@ jobs:
- name: Test - name: Test
run: swift test --skip-update --parallel --enable-test-discovery run: swift test --skip-update --parallel --enable-test-discovery
- name: Build Release - name: Build Release
run: swift build -c release run: swift build -c release
webAssembly:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Swift version
run: swift --version
- name: Build
uses: swiftwasm/swiftwasm-action@master
with:
shell-action: swift build --triple wasm32-unknown-wasi

View File

@ -5,6 +5,7 @@
[![swift version](https://img.shields.io/badge/swift-5.1+-brightgreen.svg)](https://swift.org) [![swift version](https://img.shields.io/badge/swift-5.1+-brightgreen.svg)](https://swift.org)
[![platforms](https://img.shields.io/badge/platforms-%20macOS%20|%20iOS%20|%20tvOS%20|%20watchOS-brightgreen.svg)](#) [![platforms](https://img.shields.io/badge/platforms-%20macOS%20|%20iOS%20|%20tvOS%20|%20watchOS-brightgreen.svg)](#)
[![platforms](https://img.shields.io/badge/platforms-linux-brightgreen.svg)](#) [![platforms](https://img.shields.io/badge/platforms-linux-brightgreen.svg)](#)
[![platforms](https://img.shields.io/badge/platforms-WebAssembly-brightgreen.svg)](https://github.com/swiftwasm/swift#swiftwasm)
[![codecov](https://codecov.io/gh/fireblade-engine/ecs/branch/master/graph/badge.svg)](https://codecov.io/gh/fireblade-engine/ecs) [![codecov](https://codecov.io/gh/fireblade-engine/ecs/branch/master/graph/badge.svg)](https://codecov.io/gh/fireblade-engine/ecs)
[![documentation](https://github.com/fireblade-engine/ecs/workflows/Documentation/badge.svg)](https://github.com/fireblade-engine/ecs/wiki) [![documentation](https://github.com/fireblade-engine/ecs/workflows/Documentation/badge.svg)](https://github.com/fireblade-engine/ecs/wiki)

View File

@ -6,15 +6,8 @@
// //
#if canImport(Foundation) #if canImport(Foundation)
import class Foundation.JSONEncoder import Foundation
import class Foundation.JSONDecoder
import class Foundation.PropertyListEncoder
import class Foundation.PropertyListDecoder
extension JSONEncoder: TopLevelEncoder { } extension JSONEncoder: TopLevelEncoder { }
extension JSONDecoder: TopLevelDecoder { } extension JSONDecoder: TopLevelDecoder { }
extension PropertyListEncoder: TopLevelEncoder { }
extension PropertyListDecoder: TopLevelDecoder { }
#endif #endif

View File

@ -7,7 +7,7 @@
#if arch(x86_64) || arch(arm64) || arch(powerpc64) || arch(powerpc64le) || arch(s390x) // 64 bit #if arch(x86_64) || arch(arm64) || arch(powerpc64) || arch(powerpc64le) || arch(s390x) // 64 bit
private let kFibA: UInt = 0x9e3779b97f4a7c15 // = 11400714819323198485 aka Fibonacci Hash a value for 2^64; calculate by: 2^64 / (golden ratio) private let kFibA: UInt = 0x9e3779b97f4a7c15 // = 11400714819323198485 aka Fibonacci Hash a value for 2^64; calculate by: 2^64 / (golden ratio)
#elseif arch(i386) || arch(arm) || os(watchOS) // 32 bit #elseif arch(i386) || arch(arm) || os(watchOS) || arch(wasm32) // 32 bit
private let kFibA: UInt = 0x9e3779b9 // = 2654435769 aka Fibonacci Hash a value for 2^32; calculate by: 2^32 / (golden ratio) private let kFibA: UInt = 0x9e3779b9 // = 2654435769 aka Fibonacci Hash a value for 2^32; calculate by: 2^32 / (golden ratio)
#else #else
#error("unsupported architecture") #error("unsupported architecture")