Commit 7d46308c authored by jehan's avatar jehan

-use register_factory_sqlite3 to load sqlite soci backend on macOS

parent 70d76d4d
......@@ -137,7 +137,13 @@ find_package(LibXsd REQUIRED)
find_package(Sqlite3 REQUIRED)
find_package(XML2 REQUIRED)
find_package(Soci)
#APPLE platform does not use dlopen for soci backend
if (APPLE)
find_package(Soci REQUIRED COMPONENTS sqlite3)
else()
find_package(Soci REQUIRED)
endif()
find_package(ZLIB)
if(ENABLE_TUNNEL)
......
......@@ -43,6 +43,9 @@ if(ZLIB_FOUND)
endif()
if(SOCI_FOUND)
list(APPEND LIBS ${SOCI_LIBRARIES})
if(APPLE)
list(APPEND LIBS ${SOCI_sqlite3_PLUGIN})
endif()
endif()
if(SQLITE3_FOUND)
list(APPEND LIBS ${SQLITE3_LIBRARIES})
......
......@@ -21,9 +21,9 @@
#include <TargetConditionals.h>
#endif // ifdef __APPLE__
#if (TARGET_OS_IPHONE || defined(__ANDROID__))
#if (__APPLE__ || defined(__ANDROID__))
#include <sqlite3.h>
#endif // if (TARGET_OS_IPHONE || defined(__ANDROID__))
#endif // if (__APPLE__ || defined(__ANDROID__))
#include "abstract-db-p.h"
#include "logger/logger.h"
......@@ -34,7 +34,7 @@ using namespace std;
LINPHONE_BEGIN_NAMESPACE
#if (TARGET_OS_IPHONE || defined(__ANDROID__))
#if (__APPLE__ || defined(__ANDROID__))
// Force static sqlite3 linking for IOS and Android.
extern "C" void register_factory_sqlite3();
......@@ -56,7 +56,7 @@ AbstractDb::AbstractDb (AbstractDbPrivate &p) : Object(p) {}
bool AbstractDb::connect (Backend backend, const string &parameters) {
L_D();
#if (TARGET_OS_IPHONE || defined(__ANDROID__))
#if (__APPLE__ || defined(__ANDROID__))
if (backend == Sqlite3) {
static bool registered = false;
if (!registered) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment