You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
open-im-sdk-flutter-m/windows/CMakeLists.txt

105 lines
4.2 KiB

# The Flutter tooling requires that developers have a version of Visual Studio
# installed that includes CMake 3.14 or later. You should not increase this
# version, as doing so will cause the plugin to fail to compile for some
# customers of the plugin.
cmake_minimum_required(VERSION 3.14)
# Project-level configuration.
set(PROJECT_NAME "flutter_openim_sdk")
project(${PROJECT_NAME} LANGUAGES CXX)
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
# versions of CMake.
cmake_policy(VERSION 3.14...3.25)
# This value is used when generating builds using this plugin, so it must
# not be changed
set(PLUGIN_NAME "flutter_openim_sdk_plugin")
set(PCH_HEADER_FILE ${CMAKE_CURRENT_LIST_DIR}/src/common/stable.h)
# third_party_libs
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/third_party/alog/include")
link_directories("${CMAKE_CURRENT_SOURCE_DIR}/third_party/alog/lib/x64/${CMAKE_BUILD_TYPE}")
FILE(GLOB SELF_TEMP_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/*.cpp src/*.h)
source_group(src FILES ${SELF_TEMP_SRC_FILES})
list(APPEND NIM_CORE_SOURCES ${SELF_TEMP_SRC_FILES})
FILE(GLOB SELF_TEMP_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/common/*.cpp src/common/*.h)
source_group(src/common FILES ${SELF_TEMP_SRC_FILES})
list(APPEND NIM_CORE_SOURCES ${SELF_TEMP_SRC_FILES})
FILE(GLOB SELF_TEMP_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/common/services/*.cpp src/common/services/*.h)
source_group(src/common/services FILES ${SELF_TEMP_SRC_FILES})
list(APPEND NIM_CORE_SOURCES ${SELF_TEMP_SRC_FILES})
FILE(GLOB SELF_TEMP_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/common/utils/*.cpp src/common/utils/*.h src/common/utils/*.hpp)
source_group(src/common/utils FILES ${SELF_TEMP_SRC_FILES})
list(APPEND NIM_CORE_SOURCES ${SELF_TEMP_SRC_FILES})
FILE(GLOB SELF_TEMP_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/utils/*.cpp src/utils/*.h)
source_group(src/utils FILES ${SELF_TEMP_SRC_FILES})
list(APPEND NIM_CORE_SOURCES ${SELF_TEMP_SRC_FILES})
FILE(GLOB SELF_TEMP_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/utils/dump/*.cpp src/utils/dump/*.h)
source_group(src/utils/dump FILES ${SELF_TEMP_SRC_FILES})
list(APPEND NIM_CORE_SOURCES ${SELF_TEMP_SRC_FILES})
# Any new source files that you add to the plugin should be added here.
list(APPEND PLUGIN_SOURCES
${CMAKE_CURRENT_LIST_DIR}/flutter_openim_sdk_plugin.cpp
)
add_library(${PLUGIN_NAME} SHARED
${PLUGIN_SOURCES}
${NIM_CORE_SOURCES}
)
target_precompile_headers(${PLUGIN_NAME} PRIVATE ${PCH_HEADER_FILE})
target_link_libraries(${PLUGIN_NAME} PRIVATE yx_alog)
# Apply a standard set of build settings that are configured in the
# application-level CMakeLists.txt. This can be removed for plugins that want
# full control over build settings.
apply_standard_settings(${PLUGIN_NAME})
# Symbols are hidden by default to reduce the chance of accidental conflicts
# between plugins. This should not be removed; any symbols that should be
# exported should be explicitly exported with the FLUTTER_PLUGIN_EXPORT macro.
set_target_properties(${PLUGIN_NAME} PROPERTIES
CXX_VISIBILITY_PRESET hidden)
target_compile_definitions(${PLUGIN_NAME} PRIVATE FLUTTER_PLUGIN_IMPL)
target_compile_options(${PLUGIN_NAME} PRIVATE /W4 /WX- /wd4100 /wd4267 /wd4189 /wd4244 /wd4996 /bigobj /utf-8)
target_include_directories(${PLUGIN_NAME} PUBLIC
"${CMAKE_CURRENT_LIST_DIR}/include"
"${CMAKE_CURRENT_LIST_DIR}/"
"${CMAKE_CURRENT_LIST_DIR}/openlib/x64/include"
)
target_link_libraries(${PLUGIN_NAME} PRIVATE
flutter
flutter_wrapper_plugin
${CMAKE_CURRENT_LIST_DIR}/openlib/x64/libopenimsdk.lib
)
file(GLOB flutter_openim_sdk_bundled_libraries
"${CMAKE_CURRENT_LIST_DIR}/openlib/x64/*.dll"
)
file(GLOB LIBRARY_FILES "${CMAKE_CURRENT_LIST_DIR}/openlib/x64/*")
foreach(LIB_FILE ${LIBRARY_FILES})
if(LIB_FILE MATCHES "cacert\.pem")
# 添加库文件路径到变量
list(APPEND flutter_openim_sdk_bundled_libraries ${LIB_FILE})
endif()
endforeach()
set(flutter_openim_sdk_bundled_libraries ${flutter_openim_sdk_bundled_libraries} PARENT_SCOPE)
#install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/openlib/libopenimsdk.dll
# DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
#)