no message
This commit is contained in:
parent
67bf71c998
commit
b7c04d16b3
2
.gitignore
vendored
2
.gitignore
vendored
@ -8,3 +8,5 @@ build/
|
||||
.metadata
|
||||
.idea/encodings.xml
|
||||
.idea/other.xml
|
||||
windows/openlib/
|
||||
windows/third_party/
|
||||
|
2
windows/.gitignore
vendored
2
windows/.gitignore
vendored
@ -7,8 +7,6 @@ flutter/
|
||||
*.sln.docstates
|
||||
|
||||
# Visual Studio build-related files.
|
||||
x64/
|
||||
x86/
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
|
@ -12,6 +12,92 @@ project(${PROJECT_NAME} LANGUAGES CXX)
|
||||
# versions of CMake.
|
||||
cmake_policy(VERSION 3.14...3.25)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 定义一个函数用于下载和解压SDK
|
||||
# 参数:
|
||||
# DOWNLOAD_URL - 下载URL
|
||||
# TARGET_DIR - 目标目录
|
||||
function(download_and_extract_sdk)
|
||||
# 解析参数
|
||||
set(oneValueArgs DOWNLOAD_URL TARGET_DIR)
|
||||
cmake_parse_arguments(PARSE_ARGV 0 ARG "" "${oneValueArgs}" "")
|
||||
|
||||
if(NOT ARG_DOWNLOAD_URL OR NOT ARG_TARGET_DIR)
|
||||
message(FATAL_ERROR "DOWNLOAD_URL and TARGET_DIR must be specified")
|
||||
endif()
|
||||
|
||||
# 从URL中提取文件名
|
||||
set(SPLIT "download=")
|
||||
string(LENGTH ${SPLIT} SPLIT_LENGTH)
|
||||
string(LENGTH ${ARG_DOWNLOAD_URL} URL_LENGTH)
|
||||
string(FIND ${ARG_DOWNLOAD_URL} ${SPLIT} POS)
|
||||
|
||||
if(POS GREATER_EQUAL 0)
|
||||
math(EXPR SPLIT_POS "${POS}+${SPLIT_LENGTH}")
|
||||
string(SUBSTRING ${ARG_DOWNLOAD_URL} ${SPLIT_POS} ${URL_LENGTH} FILE_NAME)
|
||||
else()
|
||||
# 如果没有找到分割字符串,使用默认文件名
|
||||
set(FILE_NAME "sdk_package.tar.gz")
|
||||
endif()
|
||||
|
||||
# 设置完整文件路径
|
||||
set(FULL_PATH "${ARG_TARGET_DIR}/${FILE_NAME}")
|
||||
|
||||
# 检查文件是否存在且大小不为0
|
||||
if(EXISTS "${FULL_PATH}")
|
||||
file(SIZE "${FULL_PATH}" FILE_SIZE)
|
||||
if(NOT ${FILE_SIZE})
|
||||
file(REMOVE_RECURSE "${FULL_PATH}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# 下载和解压
|
||||
if(NOT EXISTS "${FULL_PATH}")
|
||||
file(MAKE_DIRECTORY ${ARG_TARGET_DIR})
|
||||
message("[download_sdk]: 开始从 ${ARG_DOWNLOAD_URL} 下载SDK")
|
||||
|
||||
# 下载文件
|
||||
file(DOWNLOAD ${ARG_DOWNLOAD_URL} ${FULL_PATH}
|
||||
STATUS DOWNLOAD_STATUS
|
||||
LOG DOWNLOAD_LOG)
|
||||
|
||||
list(GET DOWNLOAD_STATUS 0 STATUS_CODE)
|
||||
if(NOT STATUS_CODE EQUAL 0)
|
||||
message(FATAL_ERROR "[download_sdk]: 下载失败: ${DOWNLOAD_STATUS}, 日志: ${DOWNLOAD_LOG}")
|
||||
endif()
|
||||
|
||||
message("[download_sdk]: 下载完成")
|
||||
else()
|
||||
message("[download_sdk]: SDK包已存在,跳过下载")
|
||||
endif()
|
||||
|
||||
message("[download_sdk]: 开始解压 ${FILE_NAME}")
|
||||
file(ARCHIVE_EXTRACT
|
||||
INPUT ${FULL_PATH}
|
||||
DESTINATION ${ARG_TARGET_DIR})
|
||||
message("[download_sdk]: 解压完成")
|
||||
endfunction()
|
||||
|
||||
# third_party
|
||||
set(ALOG_SDK_URL "http://192.168.77.132:8081/repository/mvn2-group/com/alog/1.0/alog-1.0.zip?download=alog-1.0.zip")
|
||||
|
||||
download_and_extract_sdk(
|
||||
DOWNLOAD_URL ${ALOG_SDK_URL}
|
||||
TARGET_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party
|
||||
)
|
||||
|
||||
# openim
|
||||
set(OPENIM_SDK_URL "http://192.168.77.132:8081/repository/mvn2-group/com/openim_pc/1.0.0/openim_pc-1.0.0.zip?download=openim_pc-1.0.0.zip")
|
||||
|
||||
download_and_extract_sdk(
|
||||
DOWNLOAD_URL ${OPENIM_SDK_URL}
|
||||
TARGET_DIR ${CMAKE_CURRENT_SOURCE_DIR}/openlib
|
||||
)
|
||||
# This value is used when generating builds using this plugin, so it must
|
||||
# not be changed
|
||||
set(PLUGIN_NAME "flutter_openim_sdk_plugin")
|
||||
|
Loading…
x
Reference in New Issue
Block a user