1
0

Initial commit

This commit is contained in:
2023-04-13 15:21:21 +08:00
commit f4e7319a44
7 changed files with 148 additions and 0 deletions

14
.clang-format Normal file
View File

@@ -0,0 +1,14 @@
---
BasedOnStyle: Google
ColumnLimit: 120
AccessModifierOffset: -4
AlignAfterOpenBracket: false
IndentWidth: 4
BreakBeforeBraces: Attach
CommentPragmas: '^[^ ]'
IncludeBlocks: Regroup
PointerAlignment: Left
SortIncludes: Never
IndentCaseLabels : false
Standard: Cpp11
...

4
.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
*.o
*.exe
/build
/cDrive.*

16
.vscode/c_cpp_properties.json vendored Normal file
View File

@@ -0,0 +1,16 @@
{
"configurations": [
{
"name": "MinGW64",
"includePath": [
"${workspaceFolder}/include",
"C:\\MinGW64\\include",
"C:\\MinGW64\\x86_64-w64-mingw32\\include"
],
"compilerPath": "C:\\MinGW64\\bin\\gcc.exe",
"cStandard": "c11",
"cppStandard": "c++17"
}
],
"version": 4
}

33
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,33 @@
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) 启动",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/cDrive.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "为 gdb 启用整齐打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "将反汇编风格设置为 Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
}
]
}

43
CMakeLists.txt Normal file
View File

@@ -0,0 +1,43 @@
cmake_minimum_required(VERSION 3.15)
include(FetchContent)
FetchContent_Declare(spdlog
URL https://github.com/gabime/spdlog/archive/v1.11.0.tar.gz
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
)
FetchContent_MakeAvailable(spdlog)
FetchContent_Declare(mbedtls
URL https://github.com/Mbed-TLS/mbedtls/archive/v2.28.3.tar.gz
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
)
set(ENABLE_PROGRAMS OFF CACHE INTERNAL "" FORCE)
set(ENABLE_TESTING OFF CACHE INTERNAL "" FORCE)
FetchContent_MakeAvailable(mbedtls)
find_package(CURL)
if (NOT CURL_FOUND)
FetchContent_Declare(curl
URL https://curl.se/download/curl-8.5.0.tar.xz
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
)
set(CURL_USE_MBEDTLS ON)
set(HTTP_ONLY ON)
set(BUILD_CURL_EXE OFF)
set(BUILD_TESTING OFF)
set(BUILD_SHARED_LIBS OFF)
set(CURL_DISABLE_PROGRESS_METER ON CACHE INTERNAL "" FORCE)
FetchContent_MakeAvailable(curl)
endif ()
find_library(qrcodegen_FOUND qrcodegen)
if (qrcodegen_FOUND)
message(STATUS "found qrcodegen")
endif ()
project(clist)
file(GLOB_RECURSE MAIN_SRC "${CMAKE_SOURCE_DIR}/src/*.cpp")
add_executable(${PROJECT_NAME} ${MAIN_SRC})
target_include_directories(${PROJECT_NAME} PRIVATE include)
target_link_libraries(${PROJECT_NAME} PRIVATE spdlog mbedtls qrcodegen CURL::libcurl)

25
Makefile Normal file
View File

@@ -0,0 +1,25 @@
TARGET = cDrive
SRCS := src src/drive
VPATH := $(foreach dir,$(SRCS),$(CURDIR)/$(dir))
CFILES := $(foreach dir,$(SRCS),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SRCS),$(notdir $(wildcard $(dir)/*.cpp)))
OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o)
INCLUDES := -I$(CURDIR)/include
CFLAGS := -g -Wall $(INCLUDES) `curl-config --cflags`
CXXFLAGS := $(CFLAGS) -fno-rtti -std=c++17
LDFLAGS := `curl-config --libs` -lqrcodegen -lmbedcrypto
.PHONY: all
all: $(TARGET)
$(TARGET): $(OFILES)
$(CXX) -o $@ $^ $(LDFLAGS)
run: all
@./$(TARGET)
clean:
$(RM) -fr $(BUILD) $(TARGET)

13
README.md Normal file
View File

@@ -0,0 +1,13 @@
# clist
Cloud drive explorer for C/C++
## Build On Debian
* Debian `apt-get install libcurl4-openssl-dev libspdlog-dev libqrcodegen-dev libmbedtls-dev`
## Build On Windows
```bash
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
```