Skip to content
This repository was archived by the owner on Feb 21, 2026. It is now read-only.

Commit 2798a3d

Browse files
committed
update docs
1 parent beced4f commit 2798a3d

2 files changed

Lines changed: 40 additions & 4 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,13 @@ if(MSVC)
4343
/wd4305
4444
)
4545
target_link_options(${PROJECT_NAME} PRIVATE /NODEFAULTLIB)
46-
message("MSVC set")
4746
else()
4847
target_compile_options(${PROJECT_NAME} PRIVATE -O2 -ffp-contract=off)
4948
target_link_options(${PROJECT_NAME} PRIVATE -nostdlib)
50-
message("GCC/Clang set")
5149
endif()
5250

5351
target_include_directories(${PROJECT_NAME} PRIVATE include/common)
52+
target_include_directories(${PROJECT_NAME} INTERFACE include/public)
5453

5554
if(WIN32)
5655
target_include_directories(${PROJECT_NAME} PRIVATE include/win32)
@@ -62,6 +61,5 @@ option(BUILD_TESTS "Build tests" OFF)
6261

6362
if(BUILD_TESTS)
6463
add_executable(dmath_test tests/main.c)
65-
target_include_directories(dmath_test PRIVATE include/public)
6664
target_link_libraries(dmath_test dmath)
6765
endif()

README.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,41 @@
11
# dmath
22

3-
Deterministic Math Library for C11 Based on Musl
3+
`dmath` is a deterministic math library for game projects that running on standard mobile and desktop platforms. `dmath` is a drop-in replacement for the math library in C11. It is based on [musl-libc v1.2.5](https://musl.libc.org/) with modifications to ensure that all floating-point operations are deterministic across different platforms and compilers. Although musl-libc is primarily designed for Linux, `dmath` can be used on various platforms, including Windows and MacOS. [pocketpy](https://github.com/pocketpy/pocketpy) uses `dmath` as its math library when compiled with `-DPK_ENABLE_DETERMINISM=ON`.
4+
5+
> `dmath` is not designed for embedded systems.
6+
7+
## Installation
8+
9+
Clone this repo or add it as a submodule to your project directory.
10+
Then add the following line to your `CMakeLists.txt`:
11+
12+
```cmake
13+
add_subdirectory(<path_to_dmath_repo>)
14+
15+
target_link_libraries(<your_target> dmath)
16+
```
17+
18+
## Tested Platforms
19+
20+
We have tested `dmath` on the following platforms and configurations.
21+
22+
| Job | OS | Arch | Compiler |
23+
| ---------------------- | ------------ | ------- | -------- |
24+
| build_ubuntu | Ubuntu 22.04 | x86_64 | gcc |
25+
| | | | clang |
26+
| build_ubuntu_multiarch | Ubuntu 22.04 | x86 | gcc |
27+
| | | | clang |
28+
| | | aarch64 | gcc |
29+
| | | | clang |
30+
| | | armv7 | gcc |
31+
| | | | clang |
32+
| build_macos | MacOS 14 | x86_64 | clang |
33+
| build_win32 | Windows 2022 | x86_64 | cl |
34+
35+
## References
36+
37+
https://box2d.org/posts/2024/08/determinism/
38+
39+
## License
40+
41+
MIT License

0 commit comments

Comments
 (0)