Search code examples
c++flutterzoom-sdkflutter-windows

Can't import header file from zoom sdk in flutter windows


I want to integrate the zoom meeting windows sdk into my Flutter plugin. But I can't import header file from zoom sdk.

For the test I wanted to use only zoom_sdk.h and try to initialize zoom. But when I try to build the project, I get an error: fatal error C1083: include/zoom_sdk.h: No such file or directory.

I placed the zoom_sdk.h file in the include windows folder of the flutter project. After import it in the flutter_zoom_sdk_plugin.cpp file, which is located in the root of the windows folder: #include <include/zoom_sdk.h>

My CMakeLists.txt file:

cmake_minimum_required(VERSION 3.14)

# Project-level configuration.
set(PROJECT_NAME "flutter_zoom_sdk")
project(${PROJECT_NAME} LANGUAGES CXX)

# This value is used when generating builds using this plugin, so it must
# not be changed
set(PLUGIN_NAME "${PROJECT_NAME}_plugin")

# Any new source files that you add to the plugin should be added here.
list(APPEND PLUGIN_SOURCES
  "flutter_zoom_sdk_plugin.cpp"
  "flutter_zoom_sdk_plugin.h"
)

link_directories("${PROJECT_SOURCE_DIR}/lib/")

# Define the plugin library target. Its name must not be changed (see comment
# on PLUGIN_NAME above).
add_library(${PLUGIN_NAME} SHARED
  "include/flutter_zoom_sdk/flutter_zoom_sdk_plugin_c_api.h"
  "flutter_zoom_sdk_plugin_c_api.cpp"
  "include/zoom_sdk.h"
  ${PLUGIN_SOURCES}
)

# 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)

# Source include directories and library dependencies. Add any plugin-specific
# dependencies here.
target_include_directories(${PLUGIN_NAME} INTERFACE
  "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_link_libraries(${PLUGIN_NAME} PRIVATE flutter flutter_wrapper_plugin)

# List of absolute paths to libraries that should be bundled with the plugin.
# This list could contain prebuilt libraries, or libraries created by an
# external build triggered from this build file.
set(flutter_zoom_sdk_bundled_libraries
  "${PROJECT_SOURCE_DIR}/bin/"
  PARENT_SCOPE
)

This is the contents of the windows folder:

This is the contents of the windows folder:

Any ideas what I'm doing wrong?


Solution

  • The problem was in CMakeLists.

    Here is the corrected CMakeLists:

    cmake_minimum_required(VERSION 3.14)
    
    # Project-level configuration.
    set(PROJECT_NAME "flutter_zoom_sdk")
    project(${PROJECT_NAME} LANGUAGES CXX)
    
    # This value is used when generating builds using this plugin, so it must
    # not be changed
    set(PLUGIN_NAME "${PROJECT_NAME}_plugin")
    
    # Any new source files that you add to the plugin should be added here.
    list(APPEND PLUGIN_SOURCES
      "flutter_zoom_sdk_plugin.cpp"
      "flutter_zoom_sdk_plugin.h"
    )
    
    # Define the plugin library target. Its name must not be changed (see comment
    # on PLUGIN_NAME above).
    add_library(${PLUGIN_NAME} SHARED
      "include/flutter_zoom_sdk/flutter_zoom_sdk_plugin_c_api.h"
      "flutter_zoom_sdk_plugin_c_api.cpp"
      ${PLUGIN_SOURCES}
    )
    
    # 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)
    
    find_library(SDK_LOCATION NAMES sdk HINTS "${PROJECT_SOURCE_DIR}/lib")
    
    # Source include directories and library dependencies. Add any plugin-specific
    # dependencies here.
    target_include_directories(${PLUGIN_NAME} PUBLIC
            "${PROJECT_SOURCE_DIR}/h"
            "${PROJECT_SOURCE_DIR}/include")
    target_link_libraries(${PLUGIN_NAME} PRIVATE flutter flutter_wrapper_plugin ${SDK_LOCATION})
    
    # List of absolute paths to libraries that should be bundled with the plugin.
    # This list could contain prebuilt libraries, or libraries created by an
    # external build triggered from this build file.
    set(flutter_zoom_sdk_bundled_libraries
      "${PROJECT_SOURCE_DIR}/bin/"
      PARENT_SCOPE
    )