[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kde-workspace] /: Added QJSON as optional dependency in kde-workspace, disabling chrome support in
From: Marco Gulino <marco.gulino () gmail ! com>
Date: 2012-08-31 18:23:14
Message-ID: 20120831182314.4ABA1A60DC () git ! kde ! org
[Download RAW message or body]
Git commit 56e9cf6e7a305caba2a38630109c0486dc1b9cde by Marco Gulino.
Committed on 31/08/2012 at 20:22.
Pushed by gulino into branch 'master'.
Added QJSON as optional dependency in kde-workspace, disabling chrome support in \
Bookmarks Runner if not found
M +2 -0 CMakeLists.txt
A +46 -0 cmake/modules/FindQJSON.cmake
M +22 -11 plasma/generic/runners/bookmarks/CMakeLists.txt
M +2 -0 plasma/generic/runners/bookmarks/browserfactory.cpp
http://commits.kde.org/kde-workspace/56e9cf6e7a305caba2a38630109c0486dc1b9cde
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 781d2c3..30eb084 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -95,6 +95,8 @@ macro_optional_find_package(Akonadi)
macro_log_feature(Akonadi_FOUND "Akonadi" "An extensible cross-desktop storage \
service for PIM data" "http://pim.kde.org/akonadi" FALSE "" "Required to build \
certain Plasma DataEngines (Akonadi, Calendar)") \
macro_optional_find_package(KdepimLibs 4.5.60) macro_log_feature(KdepimLibs_FOUND \
"KDE PIM Libs" "KDE Libraries for PIM" "http://pim.kde.org/" FALSE "4.5.60" "Required \
to build certain Plasma DataEngines (Akonadi, Calendar)") \
+macro_optional_find_package(QJSON) +macro_log_feature(QJSON_FOUND "QJson" "Library \
to manage JSON objects with Qt" "http://qjson.sourceforge.net/" FALSE "" "Required to \
build Chrome/Chromium support for Plasma Bookmarks Runners")
include(ConfigureChecks.cmake)
diff --git a/cmake/modules/FindQJSON.cmake b/cmake/modules/FindQJSON.cmake
new file mode 100644
index 0000000..32e294f
--- /dev/null
+++ b/cmake/modules/FindQJSON.cmake
@@ -0,0 +1,46 @@
+# Find QJSON - JSON handling library for Qt
+#
+# This module defines
+# QJSON_FOUND - whether the qsjon library was found
+# QJSON_LIBRARIES - the qjson library
+# QJSON_INCLUDE_DIR - the include path of the qjson library
+#
+
+if (QJSON_INCLUDE_DIR AND QJSON_LIBRARIES)
+
+ # Already in cache
+ set (QJSON_FOUND TRUE)
+
+else (QJSON_INCLUDE_DIR AND QJSON_LIBRARIES)
+
+ if (NOT WIN32)
+ # use pkg-config to get the values of QJSON_INCLUDE_DIRS
+ # and QJSON_LIBRARY_DIRS to add as hints to the find commands.
+ include (FindPkgConfig)
+ pkg_check_modules (QJSON REQUIRED QJson>=0.5)
+ endif (NOT WIN32)
+
+ find_library (QJSON_LIBRARIES
+ NAMES
+ qjson
+ PATHS
+ ${QJSON_LIBRARY_DIRS}
+ ${LIB_INSTALL_DIR}
+ ${KDE4_LIB_DIR}
+ )
+
+ find_path (QJSON_INCLUDE_DIR
+ NAMES
+ parser.h
+ PATH_SUFFIXES
+ qjson
+ PATHS
+ ${QJSON_INCLUDE_DIRS}
+ ${INCLUDE_INSTALL_DIR}
+ ${KDE4_INCLUDE_DIR}
+ )
+
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(QJSON DEFAULT_MSG QJSON_LIBRARIES \
QJSON_INCLUDE_DIR) +
+endif (QJSON_INCLUDE_DIR AND QJSON_LIBRARIES)
diff --git a/plasma/generic/runners/bookmarks/CMakeLists.txt \
b/plasma/generic/runners/bookmarks/CMakeLists.txt index c339068..f2c6d7f 100644
--- a/plasma/generic/runners/bookmarks/CMakeLists.txt
+++ b/plasma/generic/runners/bookmarks/CMakeLists.txt
@@ -1,25 +1,34 @@
-
########### next target ###############
-find_package(QJSON REQUIRED)
-include_directories(${QJSON_INCLUDE_DIR})
+set(EXTERNAL_LIBS ${KDE4_KIO_LIBS} ${QT_QTSCRIPT_LIBRARY} ${KDE4_PLASMA_LIBS} \
${QT_QTSQL_LIBRARY}) +if(QJSON_FOUND)
+ add_definitions(-DHAVE_QJSON=1)
+ set(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${QJSON_LIBRARIES} )
+ include_directories(${QJSON_INCLUDE_DIR})
+endif(QJSON_FOUND)
set(krunner_bookmarksrunner_SRCS
browserfactory.cpp
bookmarkmatch.cpp
faviconfromblob.cpp
- browsers/chromefindprofile.cpp
- browsers/chrome.cpp
+ favicon.cpp
+ fetchsqlite.cpp
browsers/opera.cpp
bookmarksrunner.cpp
browsers/kdebrowser.cpp
browsers/firefox.cpp
- favicon.cpp
- fetchsqlite.cpp
)
+if(QJSON_FOUND)
+set(krunner_bookmarksrunner_SRCS
+ ${krunner_bookmarksrunner_SRCS}
+ browsers/chromefindprofile.cpp
+ browsers/chrome.cpp
+)
+endif(QJSON_FOUND)
+
+
kde4_add_plugin(krunner_bookmarksrunner ${krunner_bookmarksrunner_SRCS})
-target_link_libraries(krunner_bookmarksrunner ${KDE4_KIO_LIBS} \
${QT_QTSCRIPT_LIBRARY} ${KDE4_PLASMA_LIBS}
- ${QT_QTSQL_LIBRARY} ${QJSON_LIBRARIES})
+target_link_libraries(krunner_bookmarksrunner ${EXTERNAL_LIBS})
install(TARGETS krunner_bookmarksrunner DESTINATION ${PLUGIN_INSTALL_DIR} )
@@ -28,5 +37,7 @@ install(TARGETS krunner_bookmarksrunner DESTINATION \
${PLUGIN_INSTALL_DIR} )
install(FILES plasma-runner-bookmarks.desktop DESTINATION ${SERVICES_INSTALL_DIR})
-
-add_subdirectory(tests)
+# Currently tests include only chrome, so no need to get include them if json is not \
found +if(QJSON_FOUND)
+ add_subdirectory(tests)
+endif(QJSON_FOUND)
diff --git a/plasma/generic/runners/bookmarks/browserfactory.cpp \
b/plasma/generic/runners/bookmarks/browserfactory.cpp index ce2caac..7f29f5e 100644
--- a/plasma/generic/runners/bookmarks/browserfactory.cpp
+++ b/plasma/generic/runners/bookmarks/browserfactory.cpp
@@ -37,10 +37,12 @@ Browser *BrowserFactory::find(const QString& browserName, \
QObject* parent) m_previousBrowser = new Firefox(parent);
} else if (browserName.contains("opera", Qt::CaseInsensitive)) {
m_previousBrowser = new Opera(parent);
+#ifdef HAVE_QJSON
} else if (browserName.contains("chrome", Qt::CaseInsensitive)) {
m_previousBrowser = new Chrome(new FindChromeProfile("google-chrome", \
QDir::homePath(), parent), parent); } else if (browserName.contains("chromium", \
Qt::CaseInsensitive)) {
m_previousBrowser = new Chrome(new FindChromeProfile("chromium", \
QDir::homePath(), parent), parent); +#endif // HAVE_QJSON
} else {
m_previousBrowser = new KDEBrowser(parent);
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic