Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bindings/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ else()
endif()
set(CPP_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include ${CARGO_TARGET_DIR}/cxxbridge/opendal-cpp/src)
file(GLOB_RECURSE CPP_SOURCE_FILE src/*.cpp)
file(GLOB_RECURSE CPP_HEADER_FILE include/*.h)
file(GLOB_RECURSE CPP_HEADER_FILE include/*.hpp)

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
add_custom_command(
Expand Down
3 changes: 1 addition & 2 deletions bindings/cpp/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@
# specific language governing permissions and limitations
# under the License.

PROJECT_NAME = "OpenDAL Cpp Binding"
PROJECT_NAME = "OpenDAL-CPP"
PROJECT_BRIEF = "The Cpp binding for Apache OpenDAL"
OUTPUT_DIRECTORY = @CMAKE_CURRENT_BINARY_DIR@/docs_doxygen/
EXCLUDE_SYMBOLS = ""
USE_MDFILE_AS_MAINPAGE = "README.md"

DOXYFILE_ENCODING = UTF-8
CREATE_SUBDIRS = NO
CREATE_SUBDIRS_LEVEL = 8
Expand Down
60 changes: 44 additions & 16 deletions bindings/cpp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

![](https://github.com/apache/incubator-opendal/assets/5351546/87bbf6e5-f19e-449a-b368-3e283016c887)

Documents: [![Documents](https://img.shields.io/badge/opendal-cpp-blue?logo=Apache&logoColor=red)](https://opendal.apache.org/docs/cpp/)

## Example

```cpp
Expand All @@ -16,6 +18,47 @@ int main() {
}
```

More examples can be found [here](../../examples/cpp).

## Using

### CMake

You can use `FetchContent` to add OpenDAL to your project.

```cmake
FetchContent_Declare(
opendal-cpp
GIT_REPOSITORY https://github.com/apache/incubator-opendal.git
GIT_TAG v0.40.0
SOURCE_SUBDIR bindings/cpp
)
FetchContent_MakeAvailable(opendal-cpp)
```

Or you can download the source code and add it to your project.

```shell
mkdir third_party
cd third_party
git clone https://github.com/apache/incubator-opendal.git
git checkout v0.40.0
```

```cmake
add_subdirectory(third_party/incubator-opendal/bindings/cpp)
```

Now you can use OpenDAL in your project.

```cmake
target_link_libraries(your_target opendal_cpp)
```

### Others

Support for more package managers is coming soon!

## Compiling

### Prerequisites
Expand Down Expand Up @@ -56,19 +99,4 @@ make docs
- `OPENDAL_ENABLE_ADDRESS_SANITIZER`: Enable address sanitizer. Default: `OFF`
- `OPENDAL_ENABLE_DOCUMENTATION`: Enable documentation. Default: `OFF`
- `OPENDAL_DOCS_ONLY`: Only build documentation. Default: `OFF`
- `OPENDAL_ENABLE_TESTING`: Enable testing. Default: `OFF`

## Using

### CMake

Because the project repo includes rust core code, we can't use `git submodule` directly to add it. So we recommend using `FetchContent` to add the library.

```cmake
FetchContent_Declare(
opendal-cpp
URL https://github.com/apache/incubator-opendal/releases/download/<newest-tag>/opendal-cpp-<newest-tag>.tar.gz
URL_HASH SHA256=<newest-tag-sha256>
)
FetchContent_MakeAvailable(opendal-cpp)
```
- `OPENDAL_ENABLE_TESTING`: Enable testing. Default: `OFF`