Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/utils/credential #15

Closed
wants to merge 18 commits into from
Closed
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
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
branches:
- main
- dev
- feat/utils/qrc-decoder
permissions:
contents: write
jobs:
Expand Down
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,35 @@
# CMake build directory
build/
out/

# IDE settings
.vscode/settings.json
.idea
.vs

# clangd cache
.cache/

# vcpkg installed
vcpkg_installed/

# debug data
demo/main.cc

# log file
*.log

# executable
*.exe

# compile product
*.o
*.obj

# static lib
*.lib
*.a

# shared lib
*.dll
*.so
43 changes: 31 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,32 +1,51 @@
cmake_minimum_required(VERSION 3.20)

# Be sure it is built as Release Mode
# if (NOT CMAKE_BUILD_TYPE)
# set(CMAKE_BUILD_TYPE Release)
# endif()
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_TOOLCHAIN_FILE $ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake)

add_subdirectory(utils/NetWork)

project(qmapi LANGUAGES CXX)
file(GLOB_RECURSE QQMUSIC_API_SOURCE CONFIGURE_DEPENDS src/*.cc include/*.h)
find_package(CURL REQUIRED)
find_package(ZLIB REQUIRED)
find_package(jsoncpp REQUIRED)
add_subdirectory(utils)

add_library(qmapi SHARED ${QQMUSIC_API_SOURCE})
target_include_directories(
qmapi PUBLIC
include
)
target_link_libraries(
qmapi PUBLIC
qmutils
ZLIB::ZLIB
CURL::libcurl
jsoncpp_lib
)

if (NOT DEFINED QQMUSIC_API_BUILD_TYPE)
message(FATAL_ERROR "==>QQMUSIC_API_BUILD_TYPE not set...")
elseif(${QQMUSIC_API_BUILD_TYPE} STREQUAL "DEMO")
message("==>Building Demo...")
project(demo LANGUAGES CXX)
set(CMAKE_TOOLCHAIN_FILE ${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake)
add_executable(demo demo/main.cc)
add_library(qqmusic-api SHARED ${QQMUSIC_API_SOURCE})
target_include_directories(
demo PUBLIC
include
)
target_link_libraries(
demo PUBLIC
qmapi
)
elseif(${QQMUSIC_API_BUILD_TYPE} STREQUAL "SHARED_LIB")
message("==>Building as shared library...")
add_library(qqmusic-api SHARED ${QQMUSIC_API_SOURCE})
elseif(${QQMUSIC_API_BUILD_TYPE} STREQUAL "STATIC_LIB")
message("==>Building as static library...")
add_library(qqmusic-api STATIC ${QQMUSIC_API_SOURCE})
else ()
message(FATAL_ERROR "==>QQMUSIC_API_BUILD_TYPE set error...")
endif()
21 changes: 21 additions & 0 deletions LICENCE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 aurora0x27

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
74 changes: 0 additions & 74 deletions build/CMakeCache.txt

This file was deleted.

21 changes: 0 additions & 21 deletions build/CMakeFiles/VerifyGlobs.cmake

This file was deleted.

1 change: 0 additions & 1 deletion build/CMakeFiles/cmake.check_cache

This file was deleted.

1 change: 0 additions & 1 deletion build/CMakeFiles/cmake.verify_globs

This file was deleted.

7 changes: 7 additions & 0 deletions demo/main.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <stdio.h>

int main(int argc, char** argv)
{
printf("hello\n");
return 0;
}
3 changes: 3 additions & 0 deletions docs/Api/main_module/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 主要的API函数

本章节介绍向外暴露的API接口函数
3 changes: 3 additions & 0 deletions docs/Api/utils/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# *工具函数

本章节讲解工具函数, 仅使用API不用阅读此章节. 本章节涉及API库的整体架构和内部原理
59 changes: 59 additions & 0 deletions docs/Contributing/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# 开发者注意事项

## 编码规范

主要采用[linux kernel](https://docs.kernel.org/translations/zh_CN/process/coding-style.html)的规范,
但是统一使用4个空格作为缩进, 注释使用统一的单行注释.

## 开发环境

使用`git`下载仓库后, `cmake -B build -DQQMUSIC_API_BUILD_TYPE=DEMO && cmake --build build`, 此时会构建与api库动态链接的
可执行文件, 可以利用`demo/main.cc`进行调试(该文件在`.gitignore`中, 更改不会被提交, 专门用于调试)


关于curl库, 请参考[everything curl](https://everything.curl.dev/)文档

## api接口规范

- 所有的入参和返回参数当作函数参数, 返回值需要设置成`qqmusic/error.h`中的`error`枚举类,
代表报错信息, 函数原型举例:

```cpp
qqmusic::result get_song_list(std::string url, std::string& res_json);
```

## 提交规范

从`issue`新建分支时请基于`dev`分支构建. 一个分支对应一个`issue`, 只完成`issue`规定的任务.
分支名称遵循一下规则:

```
branch_type/module/issue
```

1. **主分支(Main Branch)**
– 主分支通常是master或者main,用于存储稳定、可发布的代码

2. **开发分支(Develop Branch)**
– 必须是可编译的代码, 其他开发分支从`dev`分支派生

3. **特性分支(Feature Branch)**
– 从主分支创建的特性分支命名通常以feat/开头, 后接特性的简短描述, 例如: `feat/ui/new-login-page`

4. **修复分支(Bugfix Branch)**
– 从主分支创建的修复分支命名通常以fix/开头, 后接修复的问题的简短描述, 例如: `bugfix/backend/fix-login-issue`

5. **热修复分支(Hotfix Branch)**
– 从主分支创建的热修复分支命名通常以hfix/开头, 后接修复的问题的简短描述, 例如: `hfix/security/fix-security-issue`

编写代码的过程中尽量多`commit`, 便于回滚, 并且时常更新`dev`分支的内容保持最新, 可以使用以下命令

```
git pull --rebase origin dev
```

任务完成后需要合并进入`dev`分支, 并关闭`issue`.

提交规范: [约定式提交规范](https://www.conventionalcommits.org/zh-hans/v1.0.0/)

请在各人的分支中进行操作, 不要自行合并, 进行第一次代码提交后就可以向`dev`分支提出合并请求.
4 changes: 4 additions & 0 deletions docs/css/font.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
:root {
--md-text-font: "JetBrains Mono", "LXGW WenKai Screen";
--md-code-font: "JetBrains Mono", "Noto Serif SC";
}
Loading