[Doc] Add readme for C and C# directory (#1452)

add docs
This commit is contained in:
chenjian
2023-02-27 21:02:57 +08:00
committed by GitHub
parent 266ae046f2
commit 16c48203e3
4 changed files with 160 additions and 0 deletions

39
c_api/README.md Normal file
View File

@@ -0,0 +1,39 @@
# C API implementation
This directory is the implementation of FastDeploy C SDK, which provides solutions for scenarios where users need C API.
## How to compile and install
When compiling the fastdeploy library, turn on the compile option --WITH_CAPI=ON to start compiling for this directory. The compiled C library and fastdeploy library are in the same dynamic library file, such as libfastdeploy.a under Linux. For example, to compile the CPU version of fastdeploy and compile the C API into the library, you can use the following command
```bash
git clone https://github.com/PaddlePaddle/FastDeploy.git
cd FastDeploy
mkdir build && cd build
cmake .. -DENABLE_ORT_BACKEND=ON \
-DENABLE_PADDLE_BACKEND=ON \
-DENABLE_OPENVINO_BACKEND=ON \
-DCMAKE_INSTALL_PREFIX=${PWD}/compiled_fastdeploy_sdk \
-DENABLE_VISION=ON \
-DWITH_CAPI=ON \
-DOPENCV_DIRECTORY=/usr/lib/x86_64-linux-gnu/cmake/opencv4 \
-DENABLE_TEXT=ON
make -j12
make install
```
For more details about compiling the fastdeploy library, please refer to the documentation
- [FastDeploy installation](../docs/en/build_and_install/README.md)
## How to use
The header files of the provided C API can be used. If it is manually compiled and installed, such as the above command, after `make install`, the header files will be in the directory ${PWD}/compiled_fastdeploy_sdk/include/fastdeploy_capi/. If it is a downloaded precompiled library, after decompression, include/fastdeploy_capi/ is the header file of the C API. For usage examples, please refer to the use cases under examples
- [paddleclas](../examples/vision/classification/paddleclas/c/README.md)
- [paddledetection](../examples/vision/detection/paddledetection/c/README.md)
- [pp-ocrv2](../examples/vision/ocr/PP-OCRv2/c/README.md)
- [paddleseg](../examples/vision/segmentation/paddleseg/cpu-gpu/c/README.md)
## Other documents
- [How to Develop C API for a New Model](../docs/en/faq/develop_c_api_for_a_new_model.md)
- [Vision Results](../docs/api/vision_results/README.md)

39
c_api/README_CN.md Normal file
View File

@@ -0,0 +1,39 @@
# C API实现
该目录下为FastDeploy C SDK的接口实现为用户需要C API的场景提供解决方案。
## 如何编译安装
在编译fastdeploy库的时候打开编译选项 --WITH_CAPI=ON即可开启对于该目录的编译。编译后的C库和fastdeploy库在同一个动态库文件中如linux下为libfastdeploy.a。比如编译CPU版本的fastdeploy并且将C API一同编入库可以使用如下命令
```bash
git clone https://github.com/PaddlePaddle/FastDeploy.git
cd FastDeploy
mkdir build && cd build
cmake .. -DENABLE_ORT_BACKEND=ON \
-DENABLE_PADDLE_BACKEND=ON \
-DENABLE_OPENVINO_BACKEND=ON \
-DCMAKE_INSTALL_PREFIX=${PWD}/compiled_fastdeploy_sdk \
-DENABLE_VISION=ON \
-DWITH_CAPI=ON \
-DOPENCV_DIRECTORY=/usr/lib/x86_64-linux-gnu/cmake/opencv4 \
-DENABLE_TEXT=ON
make -j12
make install
```
关于编译fastdeploy库的更多详情信息可以参考文档
- [FastDeploy安装](../docs/cn/build_and_install/README.md)
## 如何使用
因为提供的C API的头文件即可进行使用如果是手动编译安装比如上述命令`make install`之后,头文件将会在目录${PWD}/compiled_fastdeploy_sdk/include/fastdeploy_capi/下。如果是下载的预编译好的库解压缩之后include/fastdeploy_capi/下即是C API的头文件。关于使用示例可以参考examples下的用例
- [paddleclas](../examples/vision/classification/paddleclas/c/README_CN.md)
- [paddledetection](../examples/vision/detection/paddledetection/c/README_CN.md)
- [pp-ocrv2](../examples/vision/ocr/PP-OCRv2/c/README_CN.md)
- [paddleseg](../examples/vision/segmentation/paddleseg/cpu-gpu/c/README_CN.md)
## 其它文档
- [如何给新模型增加C API](../docs/cn/faq/develop_c_api_for_a_new_model.md)
- [Vision Results](../docs/api/vision_results/README_CN.md)