main 0.0.27
cpdl 2 months ago
parent 67bf71c998
commit b7c04d16b3
  1. 2
      .gitignore
  2. 2
      windows/.gitignore
  3. 86
      windows/CMakeLists.txt

2
.gitignore vendored

@ -8,3 +8,5 @@ build/
.metadata .metadata
.idea/encodings.xml .idea/encodings.xml
.idea/other.xml .idea/other.xml
windows/openlib/
windows/third_party/

@ -7,8 +7,6 @@ flutter/
*.sln.docstates *.sln.docstates
# Visual Studio build-related files. # Visual Studio build-related files.
x64/
x86/
# Visual Studio cache files # Visual Studio cache files
# files ending in .cache can be ignored # files ending in .cache can be ignored

@ -12,6 +12,92 @@ project(${PROJECT_NAME} LANGUAGES CXX)
# versions of CMake. # versions of CMake.
cmake_policy(VERSION 3.14...3.25) 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 # This value is used when generating builds using this plugin, so it must
# not be changed # not be changed
set(PLUGIN_NAME "flutter_openim_sdk_plugin") set(PLUGIN_NAME "flutter_openim_sdk_plugin")

Loading…
Cancel
Save