diff --git a/.cargo/config.toml b/.cargo/config.toml index 54e293df..56b19309 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -2,10 +2,20 @@ rustflags = [ # Enabled unstable APIs from web_sys "--cfg=web_sys_unstable_apis", - # Enables features which are required for shared-memory - "-C", "target-feature=+atomics,+bulk-memory,+mutable-globals", - # Enables the possibility to import memory into wasm. - # Without --shared-memory it is not possible to use shared WebAssembly.Memory. - "-C", "link-args=--shared-memory --import-memory", + "-C", "link-args=--import-memory", ] runner = 'wasm-bindgen-test-runner' + +[profile.wasm-dev] +inherits = "dev" +opt-level = 's' +debug = true +debug-assertions = true +overflow-checks = true +panic = 'abort' + +[profile.wasm-release] +inherits = "release" +opt-level = 's' +lto = true +panic = 'abort' diff --git a/.github/actions/cloudflare-deploy/action.yml b/.github/actions/cloudflare-deploy/action.yml index 17d2fd04..c1df346e 100644 --- a/.github/actions/cloudflare-deploy/action.yml +++ b/.github/actions/cloudflare-deploy/action.yml @@ -1,5 +1,5 @@ name: deploy -description: Deploy on maxammann.org +description: Deploy on cloudflare inputs: project: diff --git a/.github/workflows/build-deploy-docs.yml b/.github/workflows/build-deploy-docs.yml index 45945010..da00f7cf 100644 --- a/.github/workflows/build-deploy-docs.yml +++ b/.github/workflows/build-deploy-docs.yml @@ -17,7 +17,7 @@ jobs: - uses: extractions/setup-just@v1 - name: Install toolchain shell: bash - run: just default-toolchain + run: just stable-toolchain - uses: Swatinem/rust-cache@v1 - name: Setup mdBook uses: peaceiris/actions-mdbook@v1 diff --git a/.github/workflows/demo-linux.yml b/.github/workflows/demo-linux.yml index 15dddacc..eb10b84b 100644 --- a/.github/workflows/demo-linux.yml +++ b/.github/workflows/demo-linux.yml @@ -12,14 +12,16 @@ jobs: - uses: extractions/setup-just@v1 - name: Install toolchain shell: bash - run: just default-toolchain + run: | + just stable-toolchain + just stable-targets x86_64-unknown-linux-gnu - uses: Swatinem/rust-cache@v1 - name: Install Dependencies shell: bash run: sudo apt-get install -y libwayland-dev libxkbcommon-dev # Required for winit - name: Build shell: bash - run: cargo build -p maplibre-demo + run: cargo build -p maplibre-demo --release --target x86_64-unknown-linux-gnu - name: Check shell: bash run: just check maplibre-demo x86_64-unknown-linux-gnu @@ -29,4 +31,4 @@ jobs: - uses: actions/upload-artifact@v2 with: name: maplibre-rs - path: target/x86_64-unknown-linux-gnu/debug/maplibre-demo \ No newline at end of file + path: target/x86_64-unknown-linux-gnu/release/maplibre-demo diff --git a/.github/workflows/demo-macos.yml b/.github/workflows/demo-macos.yml index 69ec7eee..56e7ad52 100644 --- a/.github/workflows/demo-macos.yml +++ b/.github/workflows/demo-macos.yml @@ -14,7 +14,9 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install toolchain shell: bash - run: just default-toolchain + run: | + just stable-toolchain + just stable-targets x86_64-apple-darwin - uses: Swatinem/rust-cache@v1 - name: Build shell: bash @@ -29,4 +31,4 @@ jobs: with: name: maplibre-x86_64-apple-darwin-demo path: apple/xcode/build/Build/Products/Debug/*.app - if-no-files-found: error \ No newline at end of file + if-no-files-found: error diff --git a/.github/workflows/demo-windows.yml b/.github/workflows/demo-windows.yml index b2a187b1..5c873cb9 100644 --- a/.github/workflows/demo-windows.yml +++ b/.github/workflows/demo-windows.yml @@ -12,7 +12,9 @@ jobs: - uses: extractions/setup-just@v1 - name: Install toolchain shell: bash - run: just default-toolchain + run: | + just stable-toolchain + just stable-targets x86_64-pc-windows-msvc - uses: Swatinem/rust-cache@v1 - uses: ilammy/msvc-dev-cmd@v1 # Provide access to lib.exe - name: Build @@ -28,4 +30,4 @@ jobs: with: name: maplibre-x86_64-windows-demo path: target/x86_64-pc-windows-msvc/release/maplibre-demo.exe - if-no-files-found: error \ No newline at end of file + if-no-files-found: error diff --git a/.github/workflows/library-android.yml b/.github/workflows/library-android.yml index 99a5c6e8..28744544 100644 --- a/.github/workflows/library-android.yml +++ b/.github/workflows/library-android.yml @@ -12,7 +12,9 @@ jobs: - uses: extractions/setup-just@v1 - name: Install nightly toolchain shell: bash - run: just nightly-toolchain-android + run: | + just nightly-toolchain + just nightly-targets x86_64-linux-android aarch64-linux-android i686-linux-android - uses: Swatinem/rust-cache@v1 - name: Set NDK Version shell: bash @@ -30,15 +32,15 @@ jobs: run: | env "AR_x86_64-linux-android=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar" \ env "CC_x86_64-linux-android=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android30-clang" \ - just check maplibre-android x86_64-linux-android + just nightly-check maplibre-android x86_64-linux-android "" - name: Check aarch64 shell: bash run: | env "AR_aarch64-linux-android=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar" \ env "CC_aarch64-linux-android=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android30-clang" \ - just check maplibre-android aarch64-linux-android + just nightly-check maplibre-android aarch64-linux-android "" # FIXME: Requires cross-compilation #- name: Test # shell: bash # # TODO: Additional test runs for different targets - # run: just test maplibre-android aarch64-linux-android \ No newline at end of file + # run: just test maplibre-android aarch64-linux-android diff --git a/.github/workflows/library-apple.yml b/.github/workflows/library-apple.yml index 36a1c22d..4cbffac7 100644 --- a/.github/workflows/library-apple.yml +++ b/.github/workflows/library-apple.yml @@ -15,7 +15,9 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install toolchain shell: bash - run: just default-toolchain + run: | + just stable-toolchain + just stable-targets x86_64-apple-darwin aarch64-apple-darwin x86_64-apple-ios aarch64-apple-ios aarch64-apple-ios-sim - uses: Swatinem/rust-cache@v1 - name: Build shell: bash diff --git a/.github/workflows/library-web.yml b/.github/workflows/library-web.yml index 390aba83..c4869220 100644 --- a/.github/workflows/library-web.yml +++ b/.github/workflows/library-web.yml @@ -11,70 +11,58 @@ on: deploy: required: true type: boolean + name: + required: true + type: string + webgl: + required: true + type: boolean + multithreaded: + required: true + type: boolean jobs: - library-webgl: - name: Build WebGL + build: + name: Build runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - uses: extractions/setup-just@v1 - name: Install nightly toolchain shell: bash - run: just nightly-toolchain + run: | + just nightly-toolchain + just nightly-targets wasm32-unknown-unknown + - name: Install rust sources (build-std) + if: inputs.multithreaded + shell: bash + run: | + just nightly-install-src + - name: Install wasm-bindgen + shell: bash + run: | + # Install wasm-bindgen with test runner + cargo install wasm-bindgen-cli # We want the latest version, as Cargo uses the latest version of wasm-bindgen - uses: Swatinem/rust-cache@v1 - name: Build lib shell: bash - run: just web-lib build-webgl + run: just web-lib build --release ${{ inputs.webgl && '--webgl' || '' }} ${{ inputs.multithreaded && '--multithreaded' || '' }} - name: Build demo shell: bash run: just web-demo build - name: Check shell: bash - run: just web-check "web-webgl" + run: just nightly-check web wasm32-unknown-unknown ${{ inputs.webgl && 'web-webgl' || '""' }} - name: Test shell: bash - run: | - # Install test runner - cargo install wasm-bindgen-cli # We want the latest version, as Cargo uses the latest version of wasm-bindgen - just web-test "web-webgl" + run: just web-test "web-webgl" - uses: actions/upload-artifact@v2 with: - name: webgl-demo - path: web/demo/dist/ - - library-webgpu: - name: Build WebGPU - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - - uses: extractions/setup-just@v1 - - name: Install nightly toolchain - shell: bash - run: just nightly-toolchain - - uses: Swatinem/rust-cache@v1 - - name: Build lib - shell: bash - run: just web-lib build - - name: Build demo - shell: bash - run: just web-demo build - - name: Check - shell: bash - run: just web-check "" - - name: Test - shell: bash - run: | - # Install test runner - cargo install wasm-bindgen-cli # We want the latest version, as Cargo uses the latest version of wasm-bindgen - just web-test "" - - uses: actions/upload-artifact@v2 - with: - name: webgpu-demo + name: ${{ inputs.name }} path: web/demo/dist/ deploy: - needs: [library-webgl, library-webgpu] + needs: [build] if: inputs.deploy name: Deploy runs-on: ubuntu-20.04 @@ -82,13 +70,10 @@ jobs: - uses: actions/checkout@v2 - uses: actions/download-artifact@v2 with: - name: webgl-demo - path: demo/webgl - - uses: actions/download-artifact@v2 - with: - name: webgpu-demo - path: demo/webgpu + name: ${{ inputs.name }} + path: demo - name: Set HTTP Headers for Cloudflare + if: inputs.multithreaded shell: bash run: | echo "/* @@ -97,7 +82,7 @@ jobs: - name: Deploy uses: ./.github/actions/cloudflare-deploy with: - project: maplibre-rs-demos + project: ${{ inputs.name }} source: demo CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }} CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }} diff --git a/.github/workflows/on_main_push.yml b/.github/workflows/on_main_push.yml index 36fa9083..90e3df34 100644 --- a/.github/workflows/on_main_push.yml +++ b/.github/workflows/on_main_push.yml @@ -24,9 +24,28 @@ jobs: secrets: inherit library-android: uses: ./.github/workflows/library-android.yml - library-web: + library-web-webgl: uses: ./.github/workflows/library-web.yml with: + name: maplibre-rs-demo-webgl + webgl: true + multithreaded: false + deploy: true + secrets: inherit + library-web-webgl-multithreaded: + uses: ./.github/workflows/library-web.yml + with: + name: maplibre-rs-demo-webgl-multithreaded + webgl: true + multithreaded: true + deploy: true + secrets: inherit + library-web-webgpu: + uses: ./.github/workflows/library-web.yml + with: + name: maplibre-rs-demo-webgpu + webgl: false + multithreaded: false deploy: true secrets: inherit library-apple: diff --git a/.github/workflows/on_pull_request.yml b/.github/workflows/on_pull_request.yml index 55d28d34..f9ccd244 100644 --- a/.github/workflows/on_pull_request.yml +++ b/.github/workflows/on_pull_request.yml @@ -19,9 +19,26 @@ jobs: deploy: false library-android: uses: ./.github/workflows/library-android.yml - library-web: + library-web-webgl: uses: ./.github/workflows/library-web.yml with: + name: maplibre-rs-demo-webgl + webgl: true + multithreaded: false + deploy: false + library-web-webgl-multithreaded: + uses: ./.github/workflows/library-web.yml + with: + name: maplibre-rs-demo-webgl-multithreaded + webgl: true + multithreaded: true + deploy: false + library-web-webgpu: + uses: ./.github/workflows/library-web.yml + with: + name: maplibre-rs-demo-webgpu + webgl: false + multithreaded: false deploy: false library-apple: uses: ./.github/workflows/library-apple.yml diff --git a/.github/workflows/run-benchmarks.yml b/.github/workflows/run-benchmarks.yml index 65b09b21..9bfa7fd0 100644 --- a/.github/workflows/run-benchmarks.yml +++ b/.github/workflows/run-benchmarks.yml @@ -12,7 +12,9 @@ jobs: - uses: extractions/setup-just@v1 - name: Install toolchain shell: bash - run: just default-toolchain + run: | + just stable-toolchain + just stable-targets x86_64-unknown-linux-gnu - uses: Swatinem/rust-cache@v1 - name: Install GPU Drivers uses: ./.github/actions/install-driver @@ -20,4 +22,4 @@ jobs: uses: ./.github/actions/download-test-data - name: Benchmark shell: bash - run: WGPU_BACKEND=vulkan just benchmark \ No newline at end of file + run: WGPU_BACKEND=vulkan just benchmark diff --git a/.github/workflows/run-checks.yml b/.github/workflows/run-checks.yml index 52d1ffc4..ac2b6ece 100644 --- a/.github/workflows/run-checks.yml +++ b/.github/workflows/run-checks.yml @@ -12,7 +12,7 @@ jobs: - uses: extractions/setup-just@v1 - name: Install toolchain shell: bash - run: just default-toolchain + run: just stable-toolchain - uses: Swatinem/rust-cache@v1 - name: Format shell: bash diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index a0325207..22ffc8de 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -12,7 +12,9 @@ jobs: - uses: extractions/setup-just@v1 - name: Install toolchain shell: bash - run: just default-toolchain + run: | + just stable-toolchain + just stable-targets x86_64-unknown-linux-gnu - uses: Swatinem/rust-cache@v1 - name: Install GPU Drivers uses: ./.github/actions/install-driver diff --git a/.idea/runConfigurations/Build_WASM.xml b/.idea/runConfigurations/Build_WASM__single_threaded_.xml similarity index 81% rename from .idea/runConfigurations/Build_WASM.xml rename to .idea/runConfigurations/Build_WASM__single_threaded_.xml index 38cb5805..a4862730 100644 --- a/.idea/runConfigurations/Build_WASM.xml +++ b/.idea/runConfigurations/Build_WASM__single_threaded_.xml @@ -1,6 +1,6 @@ - -