fasiondog 1 год назад
Родитель
Сommit
23b9cdf5b7
1 измененных файлов с 6 добавлено и 0 удалено
  1. 6 0
      packages/s/sqlite3/xmake.lua

+ 6 - 0
packages/s/sqlite3/xmake.lua

@@ -42,6 +42,7 @@ package("sqlite3")
     add_configs("dbstat_vtab",      { description = "Enable the dbstat virtual table.", default = true, type = "boolean"})
     add_configs("math_functions",   { description = "Enable the built-in SQL math functions.", default = true, type = "boolean"})
     add_configs("rtree",            { description = "Enable R-Tree.", default = false, type = "boolean"})
+    add_configs("safe_mode",        { description = "Use thread safe mode in 0 (single thread) | 1 (serialize) | 2 (mutli thread).", default = "1", type = "string", values = {"0", "1", "2"}})
 
     if is_plat("macosx", "linux", "bsd") then
         add_syslinks("pthread", "dl")
@@ -58,6 +59,7 @@ package("sqlite3")
             option("dbstat_vtab", {default = false, defines = "SQLITE_ENABLE_DBSTAT_VTAB"})
             option("math_functions", {default = false, defines = "SQLITE_ENABLE_MATH_FUNCTIONS"})
             option("rtree", {default = false, defines = "SQLITE_ENABLE_RTREE"})
+            option("safe_mode", {default = "1"})
 
             target("sqlite3")
                 set_kind("$(kind)")
@@ -65,6 +67,10 @@ package("sqlite3")
                 add_headerfiles("sqlite3.h", "sqlite3ext.h")
                 add_options("explain_comments", "dbpage_vtab", "stmt_vtab", "dbstat_vtab", "math_functions", "rtree")
 
+                if has_config("safe_mode") then
+                    add_defines("SQLITE_THREADSAFE=" .. get_config("safe_mode"))
+                end
+
                 if is_kind("shared") and is_plat("windows") then
                     add_defines("SQLITE_API=__declspec(dllexport)")
                 end