Contributing

Note: This C++ binding follows the Google C++ Style Guide for consistent and maintainable code.

Setup

Using a dev container environment

OpenDAL provides a pre-configured dev container that could be used in GitHub Codespaces, VSCode, JetBrains, JupyterLab. Please pick up your favourite runtime environment.

The fastest way is:

Open in GitHub Codespaces

Bring your own toolbox

To build OpenDAL C++ binding, the following is all you need:

  • C++ toolchain that supports c++17, e.g. clang++ and g++

  • CMake. It is used to generate the build system.

  • Ninja. It is used to build the project. You can also use other build systems supported by CMake, e.g. make, bazel, etc. You just need to make corresponding changes to following commands.

  • To format the code, you need to install clang-format

  • GTest(Google Test). It is used to run the tests. You do NOT need to build it manually.

  • Doxygen. It is used to generate the documentation. To see how to build, check here.

  • Graphviz. It is used to generate the documentation with graphs. To see how to build, check here.

For Ubuntu and Debian:

# install C/C++ toolchain (can be replaced by other toolchains)
sudo apt install build-essential

# install CMake and Ninja
sudo apt install cmake ninja-build

# install clang-format
sudo apt install clang-format

# install Doxygen and Graphviz
sudo apt install doxygen graphviz

For macOS:

# install C/C++ toolchain (can be replaced by other toolchains)
xcode-select --install

# install CMake and Ninja
brew install cmake ninja

# install clang-format
brew install clang-format

# install Doxygen and Graphviz
brew install doxygen graphviz

Build

To build the library and header file.

mkdir build
cd build

# Add -DCMAKE_EXPORT_COMPILE_COMMANDS=1 to generate compile_commands.json for clangd
cmake -DOPENDAL_DEV=ON -GNinja .. 

ninja
  • The header file opendal.hpp is under ./include.
  • The library is under build after building.

To clean the build results.

ninja clean

Test

To run the tests. (Note that you need to install GTest)

ninja test

Documentation

To build the documentation. (Note that you need to install doxygen, graphviz)

ninja docs