This is an automated email from the ASF dual-hosted git repository.

xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git


The following commit(s) were added to refs/heads/main by this push:
     new 9f5f3ce008 docs(bindings/c): update docs for CMake replacing (#5186)
9f5f3ce008 is described below

commit 9f5f3ce00812b0a07e7648fac66bc4a01c1048d9
Author: Twice <[email protected]>
AuthorDate: Wed Oct 16 13:44:13 2024 +0800

    docs(bindings/c): update docs for CMake replacing (#5186)
---
 bindings/c/CMakeLists.txt  |  4 ++--
 bindings/c/CONTRIBUTING.md | 12 ++++++++----
 bindings/c/README.md       | 31 +++++++++++--------------------
 3 files changed, 21 insertions(+), 26 deletions(-)

diff --git a/bindings/c/CMakeLists.txt b/bindings/c/CMakeLists.txt
index 3c5a54019f..a6fe41ebd4 100644
--- a/bindings/c/CMakeLists.txt
+++ b/bindings/c/CMakeLists.txt
@@ -49,8 +49,8 @@ if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
     set(CARGO_DIST_DIR "${PROJECT_SOURCE_DIR}/target/release")
 endif()
 
-set(OPENDAL_STATIC_LIB "${CARGO_DIST_DIR}/libopendal_c.a")
-set(OPENDAL_SHARED_LIB "${CARGO_DIST_DIR}/libopendal_c.so")
+set(OPENDAL_STATIC_LIB 
"${CARGO_DIST_DIR}/libopendal_c${CMAKE_STATIC_LIBRARY_SUFFIX}")
+set(OPENDAL_SHARED_LIB 
"${CARGO_DIST_DIR}/libopendal_c${CMAKE_SHARED_LIBRARY_SUFFIX}")
 message(NOTICE "-- OpenDAL C static lib: ${OPENDAL_STATIC_LIB}")
 message(NOTICE "-- OpenDAL C shared lib: ${OPENDAL_SHARED_LIB}")
 
diff --git a/bindings/c/CONTRIBUTING.md b/bindings/c/CONTRIBUTING.md
index 2fa5659c27..1d2e914de0 100644
--- a/bindings/c/CONTRIBUTING.md
+++ b/bindings/c/CONTRIBUTING.md
@@ -22,7 +22,7 @@ The fastest way is:
 
 To build OpenDAL C binding, the following is all you need:
 
-- **A C++ compiler** that supports **c++14**, _e.g._ clang++ and g++
+- A compiler that supports **C11** and **C++14**, _e.g._ clang and gcc
 
 - To format the code, you need to install **clang-format**
 
@@ -55,7 +55,9 @@ sudo ln -s /usr/lib/libgtest_main.a 
/usr/local/lib/libgtest_main.a
 To build the library and header file.
 
 ```shell
-make build
+mkdir build && cd build
+cmake ..
+make
 ```
 
 - The header file `opendal.h` is under `./include`
@@ -64,7 +66,8 @@ make build
 To clean the build results.
 
 ```shell
-make clean
+cargo clean
+cd build && make clean
 ```
 
 ## Test
@@ -72,7 +75,8 @@ make clean
 To build and run the tests. (Note that you need to install GTest)
 
 ```shell
-make test
+cd build
+make tests && ./tests
 ```
 
 ## Documentation
diff --git a/bindings/c/README.md b/bindings/c/README.md
index 398f1a1f19..19bf72839b 100644
--- a/bindings/c/README.md
+++ b/bindings/c/README.md
@@ -27,7 +27,7 @@ int main()
     };
 
     /* Write this into path "/testpath" */
-    opendal_error *error = opendal_operator_write(op, "/testpath", data);
+    opendal_error *error = opendal_operator_write(op, "/testpath", &data);
     assert(error == NULL);
 
     /* We can read it out, make sure the data is the same */
@@ -56,14 +56,13 @@ For more examples, please refer to `./examples`
 
 To build OpenDAL C binding, the following is all you need:
 
-- **A C++ compiler** that supports **c++14**, _e.g._ clang++ and g++
+- A compiler that supports **C11** and **C++14**, _e.g._ clang and gcc
 
 - To format the code, you need to install **clang-format**
 
   - The `opendal.h` is not formatted by hands when you contribute, please do 
not format the file. **Use `make format` only.**
   - If your contribution is related to the files under `./tests`, you may 
format it before submitting your pull request. But notice that different 
versions of `clang-format` may format the files differently.
 
-- **GTest(Google Test)** need to be installed to build the BDD (Behavior 
Driven Development) tests. To see how to build, check 
[here](https://github.com/google/googletest).
 - (optional) **Doxygen** need to be installed to generate documentations.
 
 For Ubuntu and Debian:
@@ -83,19 +82,6 @@ sudo apt-get install cmake
 
 # install Rust
 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
-
-# If you run the tests, install additional components
-
-# install Valgrind
-sudo apt-get install Valgrind
-
-# install GTest
-cd /usr/src/gtest
-sudo cmake CMakeLists.txt
-sudo make
-sudo cp lib/*.a /usr/lib
-sudo ln -s /usr/lib/libgtest.a /usr/local/lib/libgtest.a
-sudo ln -s /usr/lib/libgtest_main.a /usr/local/lib/libgtest_main.a
 ```
 
 ## Makefile
@@ -103,7 +89,9 @@ sudo ln -s /usr/lib/libgtest_main.a 
/usr/local/lib/libgtest_main.a
 - To **build the library and header file**.
 
   ```sh
-  make build
+  mkdir build && cd build
+  cmake ..
+  make
   ```
 
   - The header file `opendal.h` is under `./include`
@@ -113,19 +101,22 @@ sudo ln -s /usr/lib/libgtest_main.a 
/usr/local/lib/libgtest_main.a
 - To **clean** the build results.
 
   ```sh
-  make clean
+  cargo clean
+  cd build && make clean
   ```
 
 - To build and run the **tests**. (Note that you need to install Valgrind and 
GTest)
 
   ```sh
-  make test
+  cd build
+  make tests && ./tests
   ```
 
 - To build the **examples**
 
   ```sh
-  make examples
+  cd build
+  make basic error_handle
   ```
 
 ## Documentation

Reply via email to