Test whether sqlite3 has the FTS3 at compile time, and use the static sqlite3 module if not
This commit is contained in:
parent
88be9986f1
commit
a1fbd65f68
|
@ -126,6 +126,28 @@ if(ENABLE_VISUALISATIONS)
|
||||||
add_subdirectory(3rdparty/libprojectm)
|
add_subdirectory(3rdparty/libprojectm)
|
||||||
endif(ENABLE_VISUALISATIONS)
|
endif(ENABLE_VISUALISATIONS)
|
||||||
|
|
||||||
|
# Test whether libsqlite3 is available and if FTS3 is enabled in it
|
||||||
|
if(WIN32 OR APPLE)
|
||||||
|
option(STATIC_SQLITE "Compile and use a static sqlite3 library" ON)
|
||||||
|
else(WIN32 OR APPLE)
|
||||||
|
try_run(FTS_TEST_RUN FTS_TEST_COMPILE
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/sqlite3_fts_test
|
||||||
|
${CMAKE_SOURCE_DIR}/cmake/sqlite3_fts_test.cpp
|
||||||
|
CMAKE_FLAGS "-DLINK_LIBRARIES:STRING=sqlite3")
|
||||||
|
if(NOT FTS_TEST_COMPILE OR FTS_TEST_RUN EQUAL 1 OR FTS_TEST_RUN STREQUAL "FAILED_TO_RUN")
|
||||||
|
option(STATIC_SQLITE "Compile and use a static sqlite3 library" ON)
|
||||||
|
else(NOT FTS_TEST_COMPILE OR FTS_TEST_RUN EQUAL 1 OR FTS_TEST_RUN STREQUAL "FAILED_TO_RUN")
|
||||||
|
option(STATIC_SQLITE "Compile and use a static sqlite3 library" OFF)
|
||||||
|
endif(NOT FTS_TEST_COMPILE OR FTS_TEST_RUN EQUAL 1 OR FTS_TEST_RUN STREQUAL "FAILED_TO_RUN")
|
||||||
|
endif(WIN32 OR APPLE)
|
||||||
|
|
||||||
|
set(HAVE_STATIC_SQLITE ${STATIC_SQLITE})
|
||||||
|
if(STATIC_SQLITE)
|
||||||
|
message(STATUS "Building static qsqlite plugin")
|
||||||
|
add_definitions(-DQT_STATICPLUGIN)
|
||||||
|
add_subdirectory(3rdparty/qsqlite)
|
||||||
|
endif(STATIC_SQLITE)
|
||||||
|
|
||||||
# Subdirectories
|
# Subdirectories
|
||||||
add_subdirectory(3rdparty/qtsingleapplication)
|
add_subdirectory(3rdparty/qtsingleapplication)
|
||||||
add_subdirectory(3rdparty/qtiocompressor)
|
add_subdirectory(3rdparty/qtiocompressor)
|
||||||
|
@ -138,12 +160,6 @@ add_subdirectory(tests)
|
||||||
add_subdirectory(dist)
|
add_subdirectory(dist)
|
||||||
add_subdirectory(debian)
|
add_subdirectory(debian)
|
||||||
|
|
||||||
if (WIN32 OR APPLE)
|
|
||||||
message(STATUS "Building static qsqlite plugin")
|
|
||||||
add_definitions(-DQT_STATICPLUGIN)
|
|
||||||
add_subdirectory(3rdparty/qsqlite)
|
|
||||||
endif(WIN32 OR APPLE)
|
|
||||||
|
|
||||||
# Uninstall support
|
# Uninstall support
|
||||||
configure_file(
|
configure_file(
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
/* This file is part of Clementine.
|
||||||
|
|
||||||
|
Clementine is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
Clementine is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sqlite3.h>
|
||||||
|
|
||||||
|
int main(int argc, char** argv) {
|
||||||
|
sqlite3* db;
|
||||||
|
|
||||||
|
int ret = sqlite3_open(":memory:", &db);
|
||||||
|
if (ret)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
char* error = 0;
|
||||||
|
ret = sqlite3_exec(db, "CREATE VIRTUAL TABLE foo USING fts3()", 0, 0, &error);
|
||||||
|
if (ret != SQLITE_OK)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -523,10 +523,10 @@ else (APPLE)
|
||||||
endif (APPLE)
|
endif (APPLE)
|
||||||
|
|
||||||
# Link against the qsqlite plugin on windows and mac
|
# Link against the qsqlite plugin on windows and mac
|
||||||
if(WIN32 OR APPLE)
|
if(HAVE_STATIC_SQLITE)
|
||||||
set(3RDPARTY_SQLITE_LIBRARY qsqlite)
|
set(3RDPARTY_SQLITE_LIBRARY qsqlite)
|
||||||
target_link_libraries(clementine_lib qsqlite)
|
target_link_libraries(clementine_lib qsqlite)
|
||||||
endif(WIN32 OR APPLE)
|
endif(HAVE_STATIC_SQLITE)
|
||||||
|
|
||||||
add_dependencies(clementine_lib qtsingleapplication)
|
add_dependencies(clementine_lib qtsingleapplication)
|
||||||
|
|
||||||
|
|
|
@ -36,4 +36,6 @@
|
||||||
#cmakedefine HAVE_LIBXINE
|
#cmakedefine HAVE_LIBXINE
|
||||||
#cmakedefine HAVE_QT_PHONON
|
#cmakedefine HAVE_QT_PHONON
|
||||||
|
|
||||||
|
#cmakedefine HAVE_STATIC_SQLITE
|
||||||
|
|
||||||
#endif // CONFIG_H_IN
|
#endif // CONFIG_H_IN
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include "database.h"
|
#include "database.h"
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
@ -215,7 +216,7 @@ void Database::StaticInit() {
|
||||||
sFTSTokenizer->xNext = &Database::FTSNext;
|
sFTSTokenizer->xNext = &Database::FTSNext;
|
||||||
sFTSTokenizer->xClose = &Database::FTSClose;
|
sFTSTokenizer->xClose = &Database::FTSClose;
|
||||||
|
|
||||||
#ifndef Q_WS_X11
|
#ifdef HAVE_STATIC_SQLITE
|
||||||
// We statically link libqsqlite.dll on windows and mac so these symbols are already
|
// We statically link libqsqlite.dll on windows and mac so these symbols are already
|
||||||
// available
|
// available
|
||||||
_sqlite3_create_function = sqlite3_create_function;
|
_sqlite3_create_function = sqlite3_create_function;
|
||||||
|
@ -226,7 +227,7 @@ void Database::StaticInit() {
|
||||||
_sqlite3_user_data = sqlite3_user_data;
|
_sqlite3_user_data = sqlite3_user_data;
|
||||||
sLoadedSqliteSymbols = true;
|
sLoadedSqliteSymbols = true;
|
||||||
return;
|
return;
|
||||||
#else // Q_WS_X11
|
#else // HAVE_STATIC_SQLITE
|
||||||
QString plugin_path = QLibraryInfo::location(QLibraryInfo::PluginsPath) +
|
QString plugin_path = QLibraryInfo::location(QLibraryInfo::PluginsPath) +
|
||||||
"/sqldrivers/libqsqlite";
|
"/sqldrivers/libqsqlite";
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Load sqlite plugin on windows and mac.
|
// Load sqlite plugin on windows and mac.
|
||||||
#ifndef Q_WS_X11
|
#ifdef HAVE_STATIC_SQLITE
|
||||||
# include <QtPlugin>
|
# include <QtPlugin>
|
||||||
Q_IMPORT_PLUGIN(qsqlite)
|
Q_IMPORT_PLUGIN(qsqlite)
|
||||||
#endif
|
#endif
|
||||||
|
@ -110,7 +110,6 @@ int main(int argc, char *argv[]) {
|
||||||
qRegisterMetaType<GstEnginePipeline*>("GstEnginePipeline*");
|
qRegisterMetaType<GstEnginePipeline*>("GstEnginePipeline*");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
lastfm::ws::ApiKey = LastFMService::kApiKey;
|
lastfm::ws::ApiKey = LastFMService::kApiKey;
|
||||||
lastfm::ws::SharedSecret = LastFMService::kSecret;
|
lastfm::ws::SharedSecret = LastFMService::kSecret;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue