Skip to content

Commit b9feb4f

Browse files
committed
Added more build instructions
Closes #2139
1 parent b6f0675 commit b9feb4f

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

‎Build/README.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,24 @@ To implement your custom memory allocator override Allocate, Free, Reallocate, A
215215
* A conan package is available [here](https://conan.io/center/recipes/joltphysics).
216216
* A RHEL RPM package is available [here](https://github.com/alkontek/pkgspecs/tree/master/rpm/JoltPhysics).
217217

218+
## Building as a Shared Library
219+
220+
To build Jolt as a shared library, pass `-DJPH_BUILD_SHARED_LIBS=ON` to cmake.
221+
This will turn on the `JPH_SHARED_LIBRARY` define for Jolt and cmake projects linking against Jolt.
222+
It turns on `JPH_BUILD_SHARED_LIBRARY` for Jolt only to force it to build a shared library instead of a static library.
223+
224+
If you're not using cmake to build your project, define `JPH_SHARED_LIBRARY` in your project to cause it to bind to the shared library.
225+
Don't define `JPH_BUILD_SHARED_LIBRARY` in your project.
226+
227+
## Building Your Project Without CMake
228+
229+
When you're not using cmake, be careful to mirror the defines (e.g. `JPH_DOUBLE_PRECISION`, `JPH_DEBUG_RENDERER`, ...) that Jolt was compiled with in your project.
230+
`RegisterTypes` will attempt to verify this and will `Trace` any mismatches and then call `std::abort`. Make sure you override `Trace` to see the error.
231+
232+
Some mismatches can lead to compile errors because function signatures can change based on the defines (see the Errors section).
233+
234+
If you configured cmake to create a `Makefile` you can find the defines by running `make clean` followed by `make -n`. This will print the compiler command. Search for `-DJPH_` and copy those defines into your own project.
235+
218236
## Errors
219237

220238
### Link Error: File Format Not Recognized

0 commit comments

Comments
 (0)