Skip to content

Commit

Permalink
add FetchContent installation method description to README
Browse files Browse the repository at this point in the history
  • Loading branch information
bachue committed Aug 22, 2024
1 parent 8435926 commit 71fc70b
Showing 1 changed file with 29 additions and 11 deletions.
40 changes: 29 additions & 11 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,24 @@ C-SDK 使用 [cURL](http://curl.haxx.se/) 进行网络相关操作。无论是

如果在项目构建过程中出现环境相关的编译错误和链接错误,请确认这些选项是否都已经正确配置,以及所依赖的库是否都已经正确的安装。

#### 通过 CMake 编译

如果想在 CMake 项目里使用 C-SDK,可以直接在 CMake 里导入 C-SDK:

```cmake
INCLUDE(FetchContent)
FetchContent_Declare(
qiniu
GIT_REPOSITORY https://github.com/qiniu/c-sdk.git
GIT_TAG v7.8.0
)
FetchContent_MakeAvailable(qiniu)
FIND_PACKAGE(CURL REQUIRED)
FIND_PACKAGE(OpenSSL REQUIRED)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE qiniu m)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE ${CURL_LIBRARIES})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE ${OPENSSL_LIBRARIES})
```

<a name="appkey"></a>

Expand Down Expand Up @@ -169,7 +187,7 @@ typedef struct _Qiniu_Error {
typedef struct _Qiniu_RS_StatRet {
const char* hash;
const char* mimeType;
Qiniu_Int64 fsize;
Qiniu_Int64 fsize;
Qiniu_Int64 putTime;
} Qiniu_RS_StatRet;
```
Expand Down Expand Up @@ -427,7 +445,7 @@ void stat(Qiniu_Client* client, const char* bucket, const char* key)
typedef struct _Qiniu_RS_StatRet {
const char* hash;
const char* mimeType;
Qiniu_Int64 fsize;
Qiniu_Int64 fsize;
Qiniu_Int64 putTime;
} Qiniu_RS_StatRet;
```
Expand Down Expand Up @@ -456,8 +474,8 @@ void delete(Qiniu_Client* client, const char* bucket, const char* key)
复制和移动操作,需要指定源路径和目标路径。

```{c}
void copy(Qiniu_Client* client,
const char* bucketSrc, const char* keySrc,
void copy(Qiniu_Client* client,
const char* bucketSrc, const char* keySrc,
const char* bucketDest, const char* keyDest)
{
Qiniu_Error err = Qiniu_RS_Copy(client, bucketSrc, keySrc, bucketDest, keyDest);
Expand All @@ -470,8 +488,8 @@ void copy(Qiniu_Client* client,
```

```{c}
void move(Qiniu_Client* client,
const char* bucketSrc, const char* keySrc,
void move(Qiniu_Client* client,
const char* bucketSrc, const char* keySrc,
const char* bucketDest, const char* keyDest)
{
Qiniu_Error err = Qiniu_RS_Move(client, bucketSrc, keySrc, bucketDest, keyDest);
Expand All @@ -494,7 +512,7 @@ void move(Qiniu_Client* client,
调用`Qiniu_RS_BatchStat`可以批量查看多个文件的属性信息。

```{c}
void batchStat(Qiniu_Client* client,
void batchStat(Qiniu_Client* client,
Qiniu_RS_EntryPath* entries, Qiniu_ItemCount entryCount)
{
Qiniu_RS_BatchStatRet* rets = calloc(entryCount, sizeof(Qiniu_RS_BatchStatRet));
Expand Down Expand Up @@ -551,7 +569,7 @@ typedef struct _Qiniu_RS_BatchStatRet {
typedef struct _Qiniu_RS_StatRet {
const char* hash;
const char* mimeType;
Qiniu_Int64 fsize;
Qiniu_Int64 fsize;
Qiniu_Int64 putTime;
} Qiniu_RS_StatRet;
```
Expand All @@ -563,7 +581,7 @@ typedef struct _Qiniu_RS_StatRet {
调用`Qiniu_RS_BatchDelete`可以批量删除多个文件。

```{c}
void batchDelete(Qiniu_Client* client,
void batchDelete(Qiniu_Client* client,
Qiniu_RS_EntryPath* entries, Qiniu_ItemCount entryCount)
{
Qiniu_RS_BatchItemRet* rets = calloc(entryCount, sizeof(Qiniu_RS_BatchItemRet));
Expand Down Expand Up @@ -604,7 +622,7 @@ typedef struct _Qiniu_RS_BatchItemRet {
调用`Qiniu_RS_BatchCopy`可以批量复制多个文件。

```{c}
void batchCopy(Qiniu_Client* client,
void batchCopy(Qiniu_Client* client,
Qiniu_RS_EntryPathPair* entryPairs, Qiniu_ItemCount entryCount)
{
Qiniu_RS_BatchItemRet* rets = calloc(entryCount, sizeof(Qiniu_RS_BatchItemRet));
Expand Down Expand Up @@ -644,7 +662,7 @@ typedef struct _Qiniu_RS_EntryPathPair {
批量移动和批量复制很类似,唯一的区别就是调用`Qiniu_RS_BatchMove`

```{c}
void batchMove(Qiniu_Client* client,
void batchMove(Qiniu_Client* client,
Qiniu_RS_EntryPathPair* entryPairs, Qiniu_ItemCount entryCount)
{
Qiniu_RS_BatchItemRet* rets = calloc(entryCount, sizeof(Qiniu_RS_BatchItemRet));
Expand Down

0 comments on commit 71fc70b

Please sign in to comment.