Prechádzať zdrojové kódy

Added emscripten CI + unit tests (#1200)

* Bumped GCC version to 12 and Clang version to 15 for CI on Linux
* Ensured we're building with the correct number of threads
Jorrit Rouwe 1 rok pred
rodič
commit
80233f8092

+ 70 - 32
.github/workflows/build.yml

@@ -12,6 +12,11 @@ on:
       - 'Docs/**'
       - '**.md'
 
+env:
+  EMSCRIPTEN_VERSION: 3.1.62
+  UBUNTU_CLANG_VERSION: clang++-15
+  UBUNTU_GCC_VERSION: g++-12
+
 jobs:
   linux-clang:
     runs-on: ubuntu-latest
@@ -20,18 +25,19 @@ jobs:
         fail-fast: false
         matrix:
             build_type: [Debug, Release, Distribution, ReleaseASAN, ReleaseUBSAN]
-            clang_version: [clang++-13, clang++-14]
             double_precision: [No, Yes]
 
     steps:
     - name: Checkout Code
       uses: actions/checkout@v4
     - name: Configure CMake
-      run: cmake -B ${{github.workspace}}/Build/Linux_${{matrix.build_type}}_${{matrix.clang_version}} -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_CXX_COMPILER=${{matrix.clang_version}} -DDOUBLE_PRECISION=${{matrix.double_precision}} Build
+      run: |
+        cd ${{github.workspace}}/Build/
+        ./cmake_linux_clang_gcc.sh ${{matrix.build_type}} ${{env.UBUNTU_CLANG_VERSION}} -DDOUBLE_PRECISION=${{matrix.double_precision}}
     - name: Build
-      run: cmake --build ${{github.workspace}}/Build/Linux_${{matrix.build_type}}_${{matrix.clang_version}} -j 2
+      run: cmake --build ${{github.workspace}}/Build/Linux_${{matrix.build_type}} -j $(nproc)
     - name: Test
-      working-directory: ${{github.workspace}}/Build/Linux_${{matrix.build_type}}_${{matrix.clang_version}}
+      working-directory: ${{github.workspace}}/Build/Linux_${{matrix.build_type}}
       run: ctest --output-on-failure --verbose
 
   linux-clang-so:
@@ -41,17 +47,18 @@ jobs:
         fail-fast: false
         matrix:
             build_type: [Debug, Release, Distribution]
-            clang_version: [clang++-14]
 
     steps:
     - name: Checkout Code
       uses: actions/checkout@v4
     - name: Configure CMake
-      run: cmake -B ${{github.workspace}}/Build/Linux_${{matrix.build_type}}_${{matrix.clang_version}} -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_CXX_COMPILER=${{matrix.clang_version}} -DBUILD_SHARED_LIBS=Yes Build
+      run: |
+        cd ${{github.workspace}}/Build/
+        ./cmake_linux_clang_gcc.sh ${{matrix.build_type}} ${{env.UBUNTU_CLANG_VERSION}} -DBUILD_SHARED_LIBS=YES
     - name: Build
-      run: cmake --build ${{github.workspace}}/Build/Linux_${{matrix.build_type}}_${{matrix.clang_version}} -j 2
+      run: cmake --build ${{github.workspace}}/Build/Linux_${{matrix.build_type}} -j $(nproc)
     - name: Test
-      working-directory: ${{github.workspace}}/Build/Linux_${{matrix.build_type}}_${{matrix.clang_version}}
+      working-directory: ${{github.workspace}}/Build/Linux_${{matrix.build_type}}
       run: ctest --output-on-failure --verbose
 
   linux-clang-32-bit:
@@ -61,7 +68,6 @@ jobs:
         fail-fast: false
         matrix:
             build_type: [Debug, Release, Distribution]
-            clang_version: [clang++-14]
 
     steps:
     - name: Checkout Code
@@ -71,11 +77,13 @@ jobs:
     - name: Install G++-Multilib
       run: sudo apt -y install g++-multilib
     - name: Configure CMake
-      run: cmake -B ${{github.workspace}}/Build/Linux_${{matrix.build_type}}_${{matrix.clang_version}} -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_CXX_COMPILER=${{matrix.clang_version}} -DCMAKE_CXX_FLAGS=-m32 -DUSE_SSE4_1=OFF -DUSE_SSE4_2=OFF -DUSE_AVX=OFF -DUSE_AVX2=OFF -DUSE_AVX512=OFF -DUSE_LZCNT=OFF -DUSE_TZCNT=OFF -DUSE_F16C=OFF -DUSE_FMADD=OFF Build
+      run: |
+        cd ${{github.workspace}}/Build/
+        ./cmake_linux_clang_gcc.sh ${{matrix.build_type}} ${{env.UBUNTU_CLANG_VERSION}} -DCMAKE_CXX_FLAGS=-m32 -DUSE_SSE4_1=OFF -DUSE_SSE4_2=OFF -DUSE_AVX=OFF -DUSE_AVX2=OFF -DUSE_AVX512=OFF -DUSE_LZCNT=OFF -DUSE_TZCNT=OFF -DUSE_F16C=OFF -DUSE_FMADD=OFF
     - name: Build
-      run: cmake --build ${{github.workspace}}/Build/Linux_${{matrix.build_type}}_${{matrix.clang_version}} -j 2
+      run: cmake --build ${{github.workspace}}/Build/Linux_${{matrix.build_type}} -j $(nproc)
     - name: Test
-      working-directory: ${{github.workspace}}/Build/Linux_${{matrix.build_type}}_${{matrix.clang_version}}
+      working-directory: ${{github.workspace}}/Build/Linux_${{matrix.build_type}}
       run: ctest --output-on-failure --verbose
 
   linux-clang-use-std-vector:
@@ -85,18 +93,19 @@ jobs:
         fail-fast: false
         matrix:
             build_type: [Debug, ReleaseASAN]
-            clang_version: [clang++-14]
             double_precision: [Yes]
 
     steps:
     - name: Checkout Code
       uses: actions/checkout@v4
     - name: Configure CMake
-      run: cmake -B ${{github.workspace}}/Build/Linux_${{matrix.build_type}}_${{matrix.clang_version}} -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_CXX_COMPILER=${{matrix.clang_version}} -DDOUBLE_PRECISION=${{matrix.double_precision}} -DUSE_STD_VECTOR=ON Build
+      run: |
+        cd ${{github.workspace}}/Build/
+        ./cmake_linux_clang_gcc.sh ${{matrix.build_type}} ${{env.UBUNTU_CLANG_VERSION}} -DDOUBLE_PRECISION=${{matrix.double_precision}} -DUSE_STD_VECTOR=ON
     - name: Build
-      run: cmake --build ${{github.workspace}}/Build/Linux_${{matrix.build_type}}_${{matrix.clang_version}} -j 2
+      run: cmake --build ${{github.workspace}}/Build/Linux_${{matrix.build_type}} -j $(nproc)
     - name: Test
-      working-directory: ${{github.workspace}}/Build/Linux_${{matrix.build_type}}_${{matrix.clang_version}}
+      working-directory: ${{github.workspace}}/Build/Linux_${{matrix.build_type}}
       run: ctest --output-on-failure --verbose
 
   linux-gcc:
@@ -106,17 +115,18 @@ jobs:
         fail-fast: false
         matrix:
             build_type: [Debug, Release, Distribution]
-            clang_version: [g++]
 
     steps:
     - name: Checkout Code
       uses: actions/checkout@v4
     - name: Configure CMake
-      run: cmake -B ${{github.workspace}}/Build/Linux_${{matrix.build_type}}_${{matrix.clang_version}} -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_CXX_COMPILER=${{matrix.clang_version}} Build
+      run: |
+        cd ${{github.workspace}}/Build/
+        ./cmake_linux_clang_gcc.sh ${{matrix.build_type}} ${{env.UBUNTU_GCC_VERSION}}
     - name: Build
-      run: cmake --build ${{github.workspace}}/Build/Linux_${{matrix.build_type}}_${{matrix.clang_version}} -j 2
+      run: cmake --build ${{github.workspace}}/Build/Linux_${{matrix.build_type}} -j $(nproc)
     - name: Test
-      working-directory: ${{github.workspace}}/Build/Linux_${{matrix.build_type}}_${{matrix.clang_version}}
+      working-directory: ${{github.workspace}}/Build/Linux_${{matrix.build_type}}
       run: ctest --output-on-failure --verbose
 
   linux-gcc-so:
@@ -126,17 +136,18 @@ jobs:
         fail-fast: false
         matrix:
             build_type: [Debug, Release, Distribution]
-            clang_version: [g++]
 
     steps:
     - name: Checkout Code
       uses: actions/checkout@v4
     - name: Configure CMake
-      run: cmake -B ${{github.workspace}}/Build/Linux_${{matrix.build_type}}_${{matrix.clang_version}} -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_CXX_COMPILER=${{matrix.clang_version}} -DBUILD_SHARED_LIBS=Yes Build
+      run: |
+        cd ${{github.workspace}}/Build/
+        ./cmake_linux_clang_gcc.sh ${{matrix.build_type}} ${{env.UBUNTU_GCC_VERSION}} -DBUILD_SHARED_LIBS=Yes
     - name: Build
-      run: cmake --build ${{github.workspace}}/Build/Linux_${{matrix.build_type}}_${{matrix.clang_version}} -j 2
+      run: cmake --build ${{github.workspace}}/Build/Linux_${{matrix.build_type}} -j $(nproc)
     - name: Test
-      working-directory: ${{github.workspace}}/Build/Linux_${{matrix.build_type}}_${{matrix.clang_version}}
+      working-directory: ${{github.workspace}}/Build/Linux_${{matrix.build_type}}
       run: ctest --output-on-failure --verbose
 
   msys2_mingw_gcc:
@@ -160,11 +171,13 @@ jobs:
         install: mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake
         update: true
     - name: Configure CMake
-      run: cmake -B Build/MSYS2_MinGW_GCC -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=${{matrix.build_type}} Build
+      run: |
+        cd Build
+        ./cmake_linux_mingw.sh ${{matrix.build_type}}
     - name: Build
-      run: cmake --build Build/MSYS2_MinGW_GCC -j 2
+      run: cmake --build Build/MinGW_${{matrix.build_type}} -j $(nproc)
     - name: Test
-      working-directory: Build/MSYS2_MinGW_GCC
+      working-directory: Build/MinGW_${{matrix.build_type}}
       run: ctest --output-on-failure --verbose
       
   msvc_cl:
@@ -317,18 +330,16 @@ jobs:
         fail-fast: false
         matrix:
             build_type: [Debug, Release, Distribution]
-            clang_version: [clang++]
 
     steps:
     - name: Checkout Code
       uses: actions/checkout@v4
     - name: Configure CMake
-      # github macos-latest runs on a 2013 Ivy Bridge CPU so doesn't have AVX2, LZCNT, TZCNT or FMADD
-      run: cmake -B ${{github.workspace}}/Build/MacOS_${{matrix.build_type}}_${{matrix.clang_version}} -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_CXX_COMPILER=${{matrix.clang_version}} -DUSE_AVX2=OFF -DUSE_AVX512=OFF -DUSE_LZCNT=OFF -DUSE_TZCNT=OFF -DUSE_FMADD=OFF Build
+      run: cmake -B ${{github.workspace}}/Build/MacOS_${{matrix.build_type}} -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_CXX_COMPILER=clang++ Build
     - name: Build
-      run: cmake --build ${{github.workspace}}/Build/MacOS_${{matrix.build_type}}_${{matrix.clang_version}} -j 2
+      run: cmake --build ${{github.workspace}}/Build/MacOS_${{matrix.build_type}} -j $(nproc)
     - name: Test
-      working-directory: ${{github.workspace}}/Build/MacOS_${{matrix.build_type}}_${{matrix.clang_version}}
+      working-directory: ${{github.workspace}}/Build/MacOS_${{matrix.build_type}}
       run: ctest --output-on-failure --verbose
 
   android:
@@ -362,3 +373,30 @@ jobs:
       run: cmake -B ${{github.workspace}}/Build/XCode_iOS -DTARGET_HELLO_WORLD=OFF -DTARGET_PERFORMANCE_TEST=OFF -DCMAKE_SYSTEM_NAME=iOS -GXcode Build
     - name: Build
       run: cmake --build ${{github.workspace}}/Build/XCode_iOS -- -sdk iphonesimulator -arch x86_64
+
+  emscripten:
+    runs-on: ubuntu-latest
+    name: Emscripten
+
+    steps:
+    - name: Checkout Code
+      uses: actions/checkout@v4
+    - name: Setup emsdk
+      uses: mymindstorm/setup-emsdk@v14
+      with:
+        version: ${{env.EMSCRIPTEN_VERSION}}
+    - name: Verify emsdk
+      run: emcc -v
+    - name: Setup Node.js 18.x
+      uses: actions/setup-node@v4
+      with:
+        node-version: 18.x
+    - name: Configure CMake
+      run: |
+          cd ${{github.workspace}}/Build/
+          ./cmake_linux_emscripten.sh Distribution -DTARGET_HELLO_WORLD=OFF -DTARGET_PERFORMANCE_TEST=OFF
+    - name: Build
+      run: cmake --build ${{github.workspace}}/Build/WASM_Distribution -j $(nproc)      
+    - name: Test
+      working-directory: ${{github.workspace}}/Build/WASM_Distribution
+      run: node UnitTests.js

+ 4 - 4
.github/workflows/determinism_check.yml

@@ -27,7 +27,7 @@ jobs:
     - name: Configure CMake
       run: cmake -B ${{github.workspace}}/Build/Linux_Distribution -DCMAKE_BUILD_TYPE=Distribution -DCMAKE_CXX_COMPILER=clang++ Build -DCROSS_PLATFORM_DETERMINISTIC=ON -DTARGET_VIEWER=OFF -DTARGET_SAMPLES=OFF -DTARGET_HELLO_WORLD=OFF -DTARGET_UNIT_TESTS=ON
     - name: Build
-      run: cmake --build ${{github.workspace}}/Build/Linux_Distribution
+      run: cmake --build ${{github.workspace}}/Build/Linux_Distribution -j $(nproc)
     - name: Unit Tests
       working-directory: ${{github.workspace}}/Build/Linux_Distribution
       run: ctest --output-on-failure --verbose
@@ -95,7 +95,7 @@ jobs:
     - name: Configure CMake
       run: cmake -B ${{github.workspace}}/Build/Linux_Distribution -DCMAKE_BUILD_TYPE=Distribution Build -DCROSS_PLATFORM_DETERMINISTIC=ON -DTARGET_VIEWER=OFF -DTARGET_SAMPLES=OFF -DTARGET_HELLO_WORLD=OFF -DTARGET_UNIT_TESTS=ON -DUSE_AVX2=OFF -DUSE_AVX512=OFF -DUSE_LZCNT=OFF -DUSE_TZCNT=OFF
     - name: Build
-      run: cmake --build ${{github.workspace}}/Build/Linux_Distribution
+      run: cmake --build ${{github.workspace}}/Build/Linux_Distribution -j $(nproc)
     - name: Unit Tests
       working-directory: ${{github.workspace}}/Build/Linux_Distribution
       run: ctest --output-on-failure --verbose
@@ -119,7 +119,7 @@ jobs:
     - name: Configure CMake
       run: cmake -B ${{github.workspace}}/Build/Linux_Distribution -DCMAKE_BUILD_TYPE=Distribution -DCMAKE_CXX_COMPILER=clang++ Build -DCROSS_PLATFORM_DETERMINISTIC=ON -DCROSS_COMPILE_ARM=ON -DTARGET_VIEWER=OFF -DTARGET_SAMPLES=OFF -DTARGET_HELLO_WORLD=OFF -DTARGET_UNIT_TESTS=ON
     - name: Build
-      run: cmake --build ${{github.workspace}}/Build/Linux_Distribution
+      run: cmake --build ${{github.workspace}}/Build/Linux_Distribution -j $(nproc)
     - name: Unit Tests
       working-directory: ${{github.workspace}}/Build/Linux_Distribution
       run: qemu-aarch64 -L /usr/aarch64-linux-gnu/ ./UnitTests
@@ -143,7 +143,7 @@ jobs:
     - name: Configure CMake
       run: cmake -B ${{github.workspace}}/Build/Linux_Distribution -DCMAKE_BUILD_TYPE=Distribution -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++-12 Build -DCROSS_PLATFORM_DETERMINISTIC=ON -DCROSS_COMPILE_ARM=ON -DTARGET_VIEWER=OFF -DTARGET_SAMPLES=OFF -DTARGET_HELLO_WORLD=OFF -DTARGET_UNIT_TESTS=ON
     - name: Build
-      run: cmake --build ${{github.workspace}}/Build/Linux_Distribution
+      run: cmake --build ${{github.workspace}}/Build/Linux_Distribution -j $(nproc)
     - name: Unit Tests
       working-directory: ${{github.workspace}}/Build/Linux_Distribution
       run: qemu-aarch64 -L /usr/aarch64-linux-gnu/ ./UnitTests

+ 2 - 2
.github/workflows/sonar-cloud.yml

@@ -44,11 +44,11 @@ jobs:
             ./cmake_linux_clang_gcc.sh ReleaseCoverage clang++-${{ env.CLANG_VERSION }}
       - name: Run build-wrapper
         run: |
-          build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build ${{github.workspace}}/Build/Linux_ReleaseCoverage
+          build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build ${{github.workspace}}/Build/Linux_ReleaseCoverage -j $(nproc)
       - name: Run unit tests and create coverage report
         run: |
           cd ${{github.workspace}}/Build/Linux_ReleaseCoverage/
-          cmake --build . --target test
+          cmake --build . --target test -j $(nproc)
           llvm-profdata-${{ env.CLANG_VERSION }} merge -sparse default.profraw -o default.profdata
           llvm-cov-${{ env.CLANG_VERSION }} show -format=text UnitTests -instr-profile=default.profdata > coverage.txt
       - name: Run sonar-scanner

+ 1 - 0
Build/.gitignore

@@ -1,4 +1,5 @@
 /Linux*
+/WASM*
 /VS20*
 /XCode*
 /MinGW*

+ 0 - 5
Build/CMakeLists.txt

@@ -209,11 +209,6 @@ else()
 	set(CMAKE_CXX_FLAGS_RELEASEASAN "-fsanitize=address")
 	set(CMAKE_CXX_FLAGS_RELEASEUBSAN "-fsanitize=undefined,implicit-conversion,float-divide-by-zero,local-bounds -fno-sanitize-recover=all")
 	set(CMAKE_CXX_FLAGS_RELEASECOVERAGE "-O0 -DJPH_NO_FORCE_INLINE -fprofile-instr-generate -fcoverage-mapping")
-
-	# Set linker flags
-	if (NOT ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows"))
-		set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread")
-	endif()
 endif()
 
 # Set linker flags

+ 1 - 1
Build/cmake_linux_clang_gcc.sh

@@ -25,4 +25,4 @@ echo Generating Makefile for build type \"$BUILD_TYPE\" and compiler \"$COMPILER
 
 cmake -S . -B $BUILD_DIR -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_CXX_COMPILER=$COMPILER "${@}"
 
-echo Compile by running \"make -j 8 \&\& ./UnitTests\" in folder \"$BUILD_DIR\"
+echo Compile by running \"make -j $(nproc) \&\& ./UnitTests\" in folder \"$BUILD_DIR\"

+ 19 - 0
Build/cmake_linux_emscripten.sh

@@ -0,0 +1,19 @@
+#!/bin/sh
+
+if [ -z $1 ]
+then
+	BUILD_TYPE=Debug
+else
+	BUILD_TYPE=$1
+	shift
+fi
+
+BUILD_DIR=WASM_$BUILD_TYPE
+
+echo Usage: ./cmake_linux_emscripten.sh [Configuration]
+echo "Possible configurations: Debug (default), Release, Distribution"
+echo Generating Makefile for build type \"$BUILD_TYPE\" in folder \"$BUILD_DIR\"
+
+cmake -S . -B $BUILD_DIR -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_TOOLCHAIN_FILE=${EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake "${@}"
+
+echo Compile by running \"make -j $(nproc) \&\& node UnitTests.js\" in folder \"$BUILD_DIR\"

+ 1 - 1
Build/cmake_linux_mingw.sh

@@ -16,4 +16,4 @@ echo Generating Makefile for build type \"$BUILD_TYPE\" in folder \"$BUILD_DIR\"
 
 cmake -S . -B $BUILD_DIR -DCMAKE_TOOLCHAIN_FILE=mingw-w64-x86_64.cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE "${@}"
 
-echo Compile by running \"cmake --build $BUILD_DIR -j 8\"
+echo Compile by running \"cmake --build $BUILD_DIR -j $(nproc)\"

+ 1 - 1
Build/cmake_windows_mingw.sh

@@ -16,4 +16,4 @@ echo Generating Makefile for build type \"$BUILD_TYPE\" in folder \"$BUILD_DIR\"
 
 cmake -S . -B $BUILD_DIR -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=$BUILD_TYPE "${@}"
 
-echo Compile by running \"cmake --build $BUILD_DIR -j 8\"
+echo Compile by running \"cmake --build $BUILD_DIR -j $(nproc)\"

+ 11 - 0
Jolt/Jolt.cmake

@@ -665,3 +665,14 @@ else()
 		EMIT_X86_INSTRUCTION_SET_DEFINITIONS()
 	endif()
 endif()
+
+# On Unix flavors we need the pthread library
+if (NOT ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows"))
+	target_compile_options(Jolt PUBLIC -pthread)
+endif()
+
+if (EMSCRIPTEN)
+	# We need more than the default 64KB stack and 16MB memory
+	# Also disable warning: running limited binaryen optimizations because DWARF info requested (or indirectly required)
+	target_link_options(Jolt PUBLIC -sSTACK_SIZE=1048576 -sINITIAL_MEMORY=67108864 -Wno-limited-postlink-optimizations)
+endif()

+ 4 - 0
UnitTests/Core/FPFlushDenormalsTest.cpp

@@ -6,6 +6,8 @@
 #include <Jolt/Core/FPFlushDenormals.h>
 #include <atomic>
 
+#ifndef JPH_CPU_WASM
+
 // Implemented as a global atomic so the compiler can't optimize it to a constant
 extern atomic<float> TestFltMin;
 atomic<float> TestFltMin = FLT_MIN;
@@ -38,3 +40,5 @@ TEST_SUITE("FlushDenormalsTests")
 		TestFltMin = 1.0f;
 	}
 }
+
+#endif // JPH_CPU_WASM

+ 6 - 1
UnitTests/Core/JobSystemTest.cpp

@@ -12,7 +12,12 @@ TEST_SUITE("JobSystemTest")
 		// Create job system
 		const int cMaxJobs = 128;
 		const int cMaxBarriers = 10;
-		const int cMaxThreads = 10;
+		#ifdef JPH_CPU_WASM
+			// At the moment, the WASM unit tests fail when using multiple threads because the thread pool is not working
+			const int cMaxThreads = 0;
+		#else
+			const int cMaxThreads = 10;
+		#endif
 		JobSystemThreadPool system(cMaxJobs, cMaxBarriers, cMaxThreads);
 
 		// Create array of zeros

+ 5 - 0
UnitTests/PhysicsTestContext.cpp

@@ -20,7 +20,12 @@ PhysicsTestContext::PhysicsTestContext(float inDeltaTime, int inCollisionSteps,
 #else
 	mTempAllocator(new TempAllocatorImpl(4 * 1024 * 1024)),
 #endif
+#ifdef JPH_CPU_WASM
+	// At the moment, the WASM unit tests fail when using multiple threads because the thread pool is not working
+	mJobSystem(new JobSystemThreadPool(cMaxPhysicsJobs, cMaxPhysicsBarriers, 0)),
+#else
 	mJobSystem(new JobSystemThreadPool(cMaxPhysicsJobs, cMaxPhysicsBarriers, inWorkerThreads)),
+#endif
 	mDeltaTime(inDeltaTime),
 	mCollisionSteps(inCollisionSteps)
 {