@@ -16,15 +16,14 @@ add_library(${PLUGIN_NAME} SHARED
16
16
"amplify_db_common_plugin.cpp"
17
17
)
18
18
19
- ###
19
+ # ##
20
20
# Below here, keep in sync with: https://github.com/simolus3/sqlite3.dart/blob/main/sqlite3_flutter_libs/windows/CMakeLists.txt
21
- ###
21
+ # ##
22
22
23
23
# Essentially, the idea of this build script is to compile a sqlite3.dll
24
24
# and make Fluter bundle that with the final app.
25
25
# It looks like we can't avoid building a sqlite3_flutter_libs.dll too,
26
26
# but that's not on me.
27
-
28
27
apply_standard_settings (${PLUGIN_NAME} )
29
28
set_target_properties (${PLUGIN_NAME} PROPERTIES
30
29
CXX_VISIBILITY_PRESET hidden )
@@ -33,12 +32,14 @@ target_include_directories(${PLUGIN_NAME} INTERFACE
33
32
"${CMAKE_CURRENT_SOURCE_DIR} /include" )
34
33
target_link_libraries (${PLUGIN_NAME} PRIVATE flutter flutter_wrapper_plugin )
35
34
36
- # Include FetchContent for sqlite3 if not already available.
37
35
include (FetchContent )
38
36
39
37
# Only add the sqlite3 library if it hasn't been defined already.
40
- if (NOT TARGET sqlite3 )
41
- if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0" )
38
+ if (NOT TARGET sqlite3 )
39
+ if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0" )
40
+ # cmake 3.24.0 added the `DOWNLOAD_EXTRACT_TIMESTAMP` and prints an ugly warning when
41
+ # the default is used, so override it to the recommended behavior.
42
+ # We can't really ask users to use a cmake that recent, so there's this if here.
42
43
FetchContent_Declare (
43
44
sqlite3
44
45
URL https://sqlite.org/2023/sqlite-autoconf-3430000.tar.gz
@@ -55,8 +56,7 @@ if (NOT TARGET sqlite3)
55
56
56
57
# Define the sqlite3 library only if it wasn't already defined.
57
58
add_library (sqlite3 SHARED "sqlite3_flutter.c" )
58
-
59
- # Configure sqlite3 compilation options.
59
+
60
60
target_include_directories (sqlite3 PRIVATE "${sqlite3_SOURCE_DIR} " )
61
61
target_compile_options (sqlite3 PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O2>" "/w" )
62
62
@@ -83,18 +83,16 @@ if (NOT TARGET sqlite3)
83
83
SQLITE_HAVE_LOCALTIME_R
84
84
SQLITE_HAVE_LOCALTIME_S
85
85
)
86
-
87
- # Create an alias for this version of sqlite3 for your plugin's use .
86
+
87
+ # Create an alias for this version of sqlite3.
88
88
add_library (sqlite3_amplify_db_common ALIAS sqlite3 )
89
89
else ()
90
- # If sqlite3 already exists, create an alias for your plugin to avoid duplication.
90
+ # If sqlite3 already exists, create an alias for amplify plugin to avoid duplication.
91
91
add_library (sqlite3_amplify_db_common ALIAS sqlite3 )
92
92
endif ()
93
93
94
- # Link your plugin to the sqlite3 alias.
95
94
target_link_libraries (${PLUGIN_NAME} PRIVATE sqlite3_amplify_db_common )
96
95
97
- # Ensure sqlite3 actually gets built.
98
96
add_dependencies (${PLUGIN_NAME} sqlite3_amplify_db_common )
99
97
100
98
# List of absolute paths to libraries that should be bundled with the plugin.
0 commit comments