Jorrit Rouwe 4e457165ee Experimental linux armv7a support (#500) 2 anni fa
..
Android 4e457165ee Experimental linux armv7a support (#500) 2 anni fa
iOS 5a50dc65ff Ability to make XCode project for iOS and MacOS (#92) 3 anni fa
.gitignore 8adaf983f4 Add support for MinGW based compilers (#204) 3 anni fa
CMakeLists.txt 8aef496713 Added cmake configuration options (#499) 2 anni fa
README.md 17de06d4e8 Documenting possible LTO errors and making it easier to fix them in a FetchContent project (#422) 2 anni fa
cmake_linux_clang_gcc.sh 564526ad3d Added build to validate determinism between Windows, Linux and MacOS (#189) 3 anni fa
cmake_linux_mingw.sh 8b43fb806d Add MinGW cross compile for Linux (#207) 3 anni fa
cmake_vs2019_cl.bat 686ab6ab85 Initial import 4 anni fa
cmake_vs2019_cl_arm.bat 86a8f27aba ARM version compiles under MSVC2019 (#497) 2 anni fa
cmake_vs2019_cl_arm_32bit.bat 86a8f27aba ARM version compiles under MSVC2019 (#497) 2 anni fa
cmake_vs2019_clang.bat 686ab6ab85 Initial import 4 anni fa
cmake_vs2022_cl.bat 564526ad3d Added build to validate determinism between Windows, Linux and MacOS (#189) 3 anni fa
cmake_vs2022_cl_32bit.bat a830f47833 Add initial support for AVX512 (#185) 3 anni fa
cmake_vs2022_cl_arm.bat 75b5180deb Windows on ARM64 support (#317) 2 anni fa
cmake_vs2022_cl_arm_32bit.bat 69fcdfe02e ARM 32-bit support for Windows (will probably work on Linux/Android too) (#332) 2 anni fa
cmake_vs2022_cl_double.bat a2c1c22059 Supporting double precision positions to enable larger worlds (#344) 2 anni fa
cmake_vs2022_clang.bat a2c1c22059 Supporting double precision positions to enable larger worlds (#344) 2 anni fa
cmake_vs2022_clang_double.bat 02b75b8b7f Added batch file to produce vs clang build with doubles 2 anni fa
cmake_vs2022_uwp.bat 71c7199905 Compiles on Windows UWP and made unit tests work (#118) 3 anni fa
cmake_vs2022_uwp_arm.bat aabe803d40 Ability to build for UWP on ARM (#329) 2 anni fa
cmake_windows_mingw.sh 8b43fb806d Add MinGW cross compile for Linux (#207) 3 anni fa
cmake_xcode_ios.sh 5a50dc65ff Ability to make XCode project for iOS and MacOS (#92) 3 anni fa
cmake_xcode_macos.sh 5a50dc65ff Ability to make XCode project for iOS and MacOS (#92) 3 anni fa
mingw-w64-x86_64.cmake 8b43fb806d Add MinGW cross compile for Linux (#207) 3 anni fa

README.md

Building and Using Jolt Physics

Build Types

Each platform supports multiple build targets

  • Debug - Debug version of the library, turns on asserts
  • Release - Release version of the library, no asserts but includes profiling support and can draw the world and simulation properties
  • ReleaseASAN - As Release but turns on Address Sanitizer (clang only) to find bugs
  • ReleaseUBSAN - As Release but turns on Undefined Behavior Sanitizer (clang only) to find bugs
  • ReleaseCoverage - As Release but turns on Coverage reporting (clang only) to find which areas of the code are not executed
  • Distribution - Shippable version of the library, turns off all debugging support

Includes

The Jolt headers don't include Jolt/Jolt.h. Always include Jolt/Jolt.h before including any other Jolt header. You can use Jolt/Jolt.h in your precompiled header to speed up compilation.

Defines

There are a number of user configurable defines that turn on/off certain features:

  • JPH_PROFILE_ENABLED - Turns on the internal profiler.
  • JPH_EXTERNAL_PROFILE - Turns on the internal profiler but forwards the information to a user defined external system (see Profiler.h).
  • JPH_DEBUG_RENDERER - Adds support to draw lines and triangles, used to be able to debug draw the state of the world.
  • JPH_DISABLE_TEMP_ALLOCATOR - Disables the temporary memory allocator, used mainly to allow ASAN to do its job.
  • JPH_DISABLE_CUSTOM_ALLOCATOR - Disables the ability to override the memory allocator.
  • JPH_FLOATING_POINT_EXCEPTIONS_ENABLED - Turns on division by zero and invalid floating point exception support in order to detect bugs (Windows only).
  • JPH_CROSS_PLATFORM_DETERMINISTIC - Turns on behavior to attempt cross platform determinism. If this is set, JPH_USE_FMADD is ignored.
  • JPH_DOUBLE_PRECISION - Compiles the library so that all positions are stored in doubles instead of floats. This makes larger worlds possible.
  • JPH_USE_SSE4_1 - Enable SSE4.1 CPU instructions (x86/x64 only)
  • JPH_USE_SSE4_2 - Enable SSE4.2 CPU instructions (x86/x64 only)
  • JPH_USE_F16C - Enable half float CPU instructions (x86/x64 only)
  • JPH_USE_LZCNT - Enable the lzcnt CPU instruction (x86/x64 only)
  • JPH_USE_TZCNT - Enable the tzcnt CPU instruction (x86/x64 only)
  • JPH_USE_AVX - Enable AVX CPU instructions (x86/x64 only)
  • JPH_USE_AVX2 - Enable AVX2 CPU instructions (x86/x64 only)
  • JPH_USE_AVX512 - Enable AVX512F+AVX512VL CPU instructions (x86/x64 only)
  • JPH_USE_FMADD - Enable fused multiply add CPU instructions (x86/x64 only)

Logging & Asserting

To override the default trace and assert mechanism install your own custom handlers in Trace and AssertFailed (see IssueReporting.h).

Custom Memory Allocator

To implement your custom memory allocator override Allocate, Free, AlignedAllocate and AlignedFree (see Memory.h).

Building

Windows 10+ (CL - Default compiler)

  • Download Visual Studio 2022 (Community or other edition)
  • Download CMake 3.15+ (https://cmake.org/download/)
  • Run cmake_vs2022_cl.bat
  • Open the resulting project file VS2022_CL\JoltPhysics.sln
  • Compile and run either 'Samples' or 'UnitTests'

Windows 10+ (CL - 32 bit)

  • Download Visual Studio 2022 (Community or other edition)
  • Download CMake 3.15+ (https://cmake.org/download/)
  • Run cmake_vs2022_cl_32bit.bat
  • Open the resulting project file VS2022_CL_32BIT\JoltPhysics.sln
  • Compile and run either 'Samples' or 'UnitTests'

Windows 10+ (Clang compiler)

  • Download Visual Studio 2022 (Community or other edition)
  • Make sure to install "C++ Clang Compiler for Windows 11.0.0+" and "C++ Clang-cl for v142+ build tools (x64/x86)" using the Visual Studio Installer
  • Download CMake 3.15+ (https://cmake.org/download/)
  • Run cmake_vs2022_clang.bat
  • Open the resulting project file VS2022_Clang\JoltPhysics.sln
  • Compile and run either 'Samples' or 'UnitTests'

Windows 10+ (Universal Windows Platform)

  • Download Visual Studio 2022+ (Community or other edition)
  • Make sure to install "Universal Windows Platform development" using the Visual Studio Installer
  • Download CMake 3.15+ (https://cmake.org/download/)
  • Run cmake_vs2022_uwp.bat
  • Open the resulting project file VS2022_UWP\JoltPhysics.sln
  • Compile and run 'UnitTests'

Windows 10+ (MinGW)

  • Follow download instructions for MSYS2 (https://www.msys2.org/)
  • From the MSYS2 MSYS app run: pacman -S --needed mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake
  • From the MSYS2 MINGW x64 app, in the Build folder run: ./cmake_windows_mingw.sh
  • Run: cmake --build MinGW_Debug
  • Run: MinGW_Debug/UnitTests.exe

Linux (Debian flavor, x64 or ARM64)

  • Install clang (apt-get install clang)
  • Install cmake (apt-get install cmake)
  • Run: ./cmake_linux_clang_gcc.sh
  • Go to the Linux_Debug folder
  • Run: make -j 8 && ./UnitTests

Linux (Debian flavor, MinGW Cross Compile)

  • This setup can be used to run samples on Linux using wine and vkd3d. Tested on Ubuntu 22.04
  • Graphics card must support Vulkan and related drivers must be installed
  • Install mingw-w64 (apt-get install mingw-w64)
  • Run: update-alternatives --config x86_64-w64-mingw32-g++ (Select /usr/bin/x86_64-w64-mingw32-g++-posix)
  • Install cmake (apt-get install cmake)
  • Install wine64 (apt-get install wine64)
  • Run: export WINEPATH="/usr/x86_64-w64-mingw32/lib;/usr/lib/gcc/x86_64-w64-mingw32/10-posix" (change it based on your environment)
  • Run: ./cmake_linux_mingw.sh Release (Debug doesn't work)
  • Go to the MinGW_Release folder
  • Run: make -j 8 && wine UnitTests.exe
  • Run: wine Samples.exe

Android

  • Install Android Studio 2020.3.1+ (https://developer.android.com/studio/)
  • Open the 'Android' folder in Android Studio and wait until gradle finishes
  • Select 'Run' / 'Run...' and 'UnitTests'
  • If the screen turns green after a while the unit tests succeeded, when red they failed (see the android log for details)

macOS

  • Install XCode
  • Download CMake 3.23+ (https://cmake.org/download/)
  • Run: ./cmake_xcode_macos.sh
  • This will open XCode with a newly generated project
  • Build and run the project

Note that you can also follow the steps in the 'Linux' section if you wish to build without XCode.

iOS

  • Install XCode
  • Download CMake 3.23+ (https://cmake.org/download/)
  • Run: ./cmake_xcode.ios.sh
  • This will open XCode with a newly generated project
  • Build and run the project (note that this will only work in the simulator as the code signing information is not set up)

Link Errors

If you receive the following error when linking:

/usr/bin/ld: libJolt.a: error adding symbols: file format not recognized

Then you have not enabled interprocedural optimizations (link time optimizations) for your own application. See the INTERPROCEDURAL_OPTIMIZATION option in CMakeLists.txt.

Doxygen on Windows

Documentation can be generated through doxygen: