Important
Currently the contribution guidelines are a work in progress. Please check back later for more information.
First off, thanks for taking the time to contribute! ❤️
All types of contributions are encouraged and valued. See the Table of Contents for different ways to help and details about how this project handles them. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for us maintainers and smooth out the experience for all involved. The community looks forward to your contributions. 🎉
If you enjoy this project but don’t have the time or ability to contribute code, you can still show your support in the following ways:
- Star the repository
- Mention this project in your own project's documentation
- Share this project on social media or at community meetups
- I Have a Question
- I Want To Contribute
- How to manually build CCMath with the command line
- Additional Notes
If you want to ask a question, we assume that you have read the available Documentation.
Before you ask a question, it is best to search for existing Issues that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first.
If you then still feel the need to ask a question and need clarification, we recommend the following:
- Open an Issue.
- Provide as much context as you can about what you're running into.
- Provide project and platform versions (nodejs, npm, etc), depending on what seems relevant.
We will then take care of the issue as soon as possible.
Legal Notice
By contributing to this project, you agree that:
- You have authored 100% of the content, or the content is compatible with the project’s license and is marked as such
- You have the rights necessary to share the content
- The content may be provided under the project’s license
Before any code can be written, consider these core tenets of CCMath as you work on the project.
- Code should be evaluable at compile time when possible and great effort should be taken to comply with this (e.g.,
constexpr
andstatic_assert
). - Match the behavior of the standard library as closely as possible, with no compromises on accuracy.
- Strive for performance comparable to (or no worse than half the speed of) the standard library.
- Ensure code can work with
static_assert
. - Favor generic solutions over platform-specific ones, when possible.
- Mimic the behavior of compilers we support (particularly relevant for
ccm::fpclassify
). - Provide comprehensive tests covering all edge cases for any new code.
- Document thoroughly with Doxygen, ensuring clarity and completeness.
- Follow the same API layout as the standard library. Refer to cppreference for guidance on `'s api.
If you’re ready to make your first contribution to CCMath, here’s a basic workflow you can follow:
- Fork and Clone
- Fork the CCMath repository on GitHub to your personal account.
- Clone your fork locally:
git clone https://github.com/<your-username>/ccmath.git cd ccmath
- Check Out the
dev
Branch
- We recommend making changes off of the
dev
branch:git checkout dev
- Set Up Your Environment
- Make sure you have the prerequisites installed (CMake, Ninja, Git, and a compatible compiler).
- Install any other dependencies specific to your platform (for example, using
apt
,brew
, orchoco
).
- Create a Feature Branch
- Create a new branch for your proposed changes:
git checkout -b feature/my-new-feature
- Implement Your Changes
- Edit or add source/header files under
ccmath/
. - Remember the Core Tenets of CCMath—aim for constexpr-friendly, standards-compliant, well-documented, and well-tested code.
- Build and Test Locally
- Use the provided CMake Presets to configure, build, and test:
cmake --preset=ninja-gcc-debug cmake --build --preset=build-ninja-gcc-debug ctest --preset=test-ninja-gcc-debug --output-on-failure
- If you encounter any build or test failures, consult the project’s Issues or open a new one if needed.
- Document Your Code
- Add or update Doxygen comments where appropriate to ensure comprehensive coverage of new or modified functions.
- If applicable, include references or code examples in docstrings.
- Commit and Push
- Once your changes pass locally, commit them with a meaningful message:
git add . git commit -m "Implement new math function with tests"
- Push your branch to your fork:
git push -u origin feature/my-new-feature
- Open a Pull Request
- On GitHub, open a Pull Request (PR) from your branch to
Rinzii/ccmath
’sdev
branch. - Provide a clear title and description of your changes.
- Describe any related issue references (if applicable) and how you tested your changes.
- Code Review
- A maintainer will review your PR. If changes are requested, address them and push updates to the same feature branch.
- Once everything is approved, your PR will be merged into
dev
.
That’s it! Thank you for contributing to CCMath. If you have any questions or run into any problems, don’t hesitate to open an issue or add a comment in your PR. We appreciate your help in making CCMath a robust, efficient, and user-friendly math library.
- CMake 3.18+
- Git
- Ninja (for Linux & macOS
- Clang or GCC (for Linux & macOS)
- Visual Studio 22 (for Windows)
Step 1: Clone the repository
git clone https://github.com/Rinzii/ccmath.git
Step 2: (recommended) Check out the dev branch
git checkout dev
- Pick a preset for your compiler and configuration.
- Examples (see
CMakePresets.json
for the full list):ninja-gcc-debug
ninja-gcc-release
ninja-clang-debug
ninja-clang-release
ninja-clang-libcpp-relwithdebinfo
- If you need a specific C++ standard, pass
-DCMAKE_CXX_STANDARD=17
(or 20, etc.) after specifying the preset.
- Configure using one of the presets (example shown uses GCC Debug with C++17):
cmake --preset=ninja-gcc-debug -DCMAKE_CXX_STANDARD=17
- Build the project
Or, if you prefer a single step after configuring:
cmake --preset=ninja-gcc-debug -DCMAKE_CXX_STANDARD=17
cmake --preset=ninja-gcc-debug -DCMAKE_CXX_STANDARD=17
You can also specify --config Debug
or --config Release
if needed
4. Run the tests
ctest --preset=test-ninja-gcc-debug --output-on-failure
Or, if you prefer a one-liner after configuring and building:
ctest -C Debug --output-on-failure
(Ensure you built a Debug config if you’re testing Debug.)
- Choose a preset, for example:
vs22-debug
vs22-release
vs22-clang-debug
- Configure:
cmake --preset=vs22-debug -DCMAKE_CXX_STANDARD=17
- Build using the corresponding build preset:
Or, if you prefer a single step after configuring:
cmake --build --preset=vs22-debug
# In the same directory where you ran cmake --preset=... cmake --build . --config Debug
- Run the tests
Or, if you prefer a one-liner after configuring and building:
ctest --preset=test-vs22-debug --output-on-failure
ctest -C Debug --output-on-failure
- The exact preset names may differ in your local
CMakePresets.json
. Check that file for the list of available presets. - Presets for coverage, sanitizer builds, or specialized compilers like Intel may also be available (for example,
ninja-intel-relwithdebinfo
orninja-gcc-ccache-debug
). - If you run into issues, confirm that your CMake, Ninja, and compiler versions are current and supported.
- See our Contribution Guidelines for more detailed information on contributing and troubleshooting.