1if(ENABLE_GITEE) 2 set(REQ_URL "https://gitee.com/mirrors/sqlite/repository/archive/version-3.36.0.tar.gz") 3 set(SHA256 "a0989fc6e890ac1b1b28661490636617154da064b6bfe6c71100d23a9e7298fd") 4else() 5 set(REQ_URL "https://github.com/sqlite/sqlite/archive/version-3.36.0.tar.gz") 6 set(SHA256 "a0989fc6e890ac1b1b28661490636617154da064b6bfe6c71100d23a9e7298fd") 7endif() 8 9 10if(WIN32) 11 if(MSVC) 12 mindspore_add_pkg(sqlite 13 VER 3.36.0 14 LIBS sqlite3 15 URL https://sqlite.org/2021/sqlite-amalgamation-3360000.zip 16 SHA256 999826fe4c871f18919fdb8ed7ec9dd8217180854dd1fe21eea96aed36186729 17 PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/sqlite/sqlite.windows.msvc.patch001 18 CMAKE_OPTION " " 19 ) 20 else() 21 mindspore_add_pkg(sqlite 22 VER 3.36.0 23 LIBS sqlite3 24 URL https://sqlite.org/2021/sqlite-amalgamation-3360000.zip 25 SHA256 999826fe4c871f18919fdb8ed7ec9dd8217180854dd1fe21eea96aed36186729 26 PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/sqlite/sqlite.windows.patch002 27 CMAKE_OPTION " " 28 ) 29 endif() 30else() 31 set(sqlite_USE_STATIC_LIBS ON) 32 set(sqlite_CXXFLAGS) 33 if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") 34 set(sqlite_CFLAGS "-fstack-protector-all -Wno-uninitialized -Wno-unused-parameter -fPIC -D_FORTIFY_SOURCE=2 \ 35 -O2") 36 else() 37 set(sqlite_CFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter -fPIC \ 38 -D_FORTIFY_SOURCE=2 -O2") 39 set(sqlite_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack") 40 endif() 41 mindspore_add_pkg(sqlite 42 VER 3.36.0 43 LIBS sqlite3 44 URL ${REQ_URL} 45 SHA256 ${SHA256} 46 PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/sqlite/CVE-2022-35737.patch 47 PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/sqlite/CVE-2021-36690.patch 48 PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/sqlite/CVE-2023-7104.patch 49 CONFIGURE_COMMAND ./configure --enable-shared=no --disable-tcl --disable-editline --enable-json1) 50endif() 51 52include_directories(${sqlite_INC}) 53add_library(mindspore::sqlite ALIAS sqlite::sqlite3) 54