1- cmake_minimum_required (VERSION  3.11)
1+ # The Flutter tooling requires that developers have CMake 3.10 or later 
2+ # installed. You should not increase this version, as doing so will cause 
3+ # the plugin to fail to compile for some customers of the plugin. 
4+ cmake_minimum_required (VERSION  3.10)
5+ 
6+ # Project-level configuration. 
27set (PROJECT_NAME  "objectbox_flutter_libs" )
38project (${PROJECT_NAME}  LANGUAGES CXX)
49
510# This value is used when generating builds using this plugin, so it must 
6- # not be changed 
11+ # not be changed.  
712set (PLUGIN_NAME "objectbox_flutter_libs_plugin" )
813
14+ # Define the plugin library target. Its name must not be changed (see comment 
15+ # on PLUGIN_NAME above). 
16+ # 
17+ # Any new source files that you add to the plugin should be added here. 
918add_library (${PLUGIN_NAME}  SHARED
1019  "objectbox_flutter_libs_plugin.cc" 
1120)
21+ 
22+ # Apply a standard set of build settings that are configured in the 
23+ # application-level CMakeLists.txt. This can be removed for plugins that want 
24+ # full control over build settings. 
1225apply_standard_settings(${PLUGIN_NAME} )
26+ 
27+ # Symbols are hidden by default to reduce the chance of accidental conflicts 
28+ # between plugins. This should not be removed; any symbols that should be 
29+ # exported should be explicitly exported with the FLUTTER_PLUGIN_EXPORT macro. 
1330set_target_properties (${PLUGIN_NAME}  PROPERTIES
1431  CXX_VISIBILITY_PRESET hidden)
1532target_compile_definitions (${PLUGIN_NAME}  PRIVATE  FLUTTER_PLUGIN_IMPL)
33+ 
34+ # Source include directories and library dependencies. Add any plugin-specific 
35+ # dependencies here. 
1636target_include_directories (${PLUGIN_NAME}  INTERFACE 
1737  "${CMAKE_CURRENT_SOURCE_DIR} /include" )
1838target_link_libraries (${PLUGIN_NAME}  PRIVATE  flutter)
1939target_link_libraries (${PLUGIN_NAME}  PRIVATE  PkgConfig::GTK)
2040
21- # List of absolute paths to libraries that should be bundled with the plugin 
22- set (objectbox_flutter_libs_bundled_libraries
23-   "" 
24-   PARENT_SCOPE
25- )
26- 
2741# ---------------------------------------------------------------------- 
42+ # Download and add objectbox-c prebuilt library. 
2843
2944set (OBJECTBOX_VERSION 0.18.0)
3045
@@ -48,15 +63,15 @@ if(NOT objectbox-download_POPULATED)
4863  FetchContent_Populate(objectbox-download)
4964endif ()
5065
66+ # ---------------------------------------------------------------------- 
67+ 
68+ # List of absolute paths to libraries that should be bundled with the plugin. 
69+ # This list could contain prebuilt libraries, or libraries created by an 
70+ # external build triggered from this build file. 
71+ 
72+ # Note: do not link the ObjectBox C library; the Dart library looks for it in a lib subfolder 
73+ # where flutter build puts it when added below. 
5174set (objectbox_flutter_libs_bundled_libraries
5275    "${objectbox-download_SOURCE_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX} objectbox${CMAKE_SHARED_LIBRARY_SUFFIX} " 
5376    PARENT_SCOPE
5477)
55- 
56- add_library (objectbox SHARED IMPORTED  GLOBAL )
57- set_target_properties (objectbox PROPERTIES
58-     IMPORTED_LOCATION  ${objectbox-download_SOURCE_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX} objectbox${CMAKE_SHARED_LIBRARY_SUFFIX} 
59-     IMPORTED_IMPLIB  ${objectbox-download_SOURCE_DIR}/lib/${CMAKE_IMPORT_LIBRARY_PREFIX} objectbox${CMAKE_IMPORT_LIBRARY_SUFFIX} 
60- )
61- 
62- target_link_libraries (${PLUGIN_NAME}  PRIVATE  objectbox)
0 commit comments