[Kst] branches/work/kst/portto4/kst
Peter Kümmel
syntheticpp at gmx.net
Sat Feb 19 13:17:18 CET 2011
SVN commit 1221599 by kuemmel:
reintroduce build dir, simplify plugin search paths
M +22 -18 cmake/CMakeLists.txt
M +2 -1 cmake/config.h.cmake
M +7 -4 cmake/modules/KstMacros.cmake
M +2 -2 config.h
M +3 -0 src/libkst/dataplugin.h
M +27 -30 src/libkst/datasourcepluginmanager.cpp
M +4 -20 src/libkstmath/dataobject.cpp
--- branches/work/kst/portto4/kst/cmake/CMakeLists.txt #1221598:1221599
@@ -6,6 +6,7 @@
include(KstMacros)
get_filename_component(kst_dir ${CMAKE_SOURCE_DIR}/.. ABSOLUTE)
+get_filename_component(kst_build_dir ${CMAKE_BINARY_DIR}/build ABSOLUTE)
set(kst_version_major 2)
@@ -17,7 +18,7 @@
kst_option_init()
-kst_option(release "Build release version" OFF all)
+kst_option(release "Build release version: optimize for speed, don't embedded debug symbols" OFF all)
kst_option(merge_files "Merge files to speedup build about factor 5" OFF all)
kst_option(merge_rebuild "Rebuild generated files from merged files build" OFF all)
kst_option(verbose "Make verbose CMake run and Makefiles" OFF all)
@@ -110,16 +111,29 @@
if(kst_install_prefix)
set(CMAKE_INSTALL_PREFIX ${kst_install_prefix} CACHE PATH "User's choice for install prefix" FORCE)
set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+else()
+ set(kst_install_prefix INSTALLED)
+ set(CMAKE_INSTALL_PREFIX ${kst_install_prefix} CACHE PATH "Kst's default install prefix" FORCE)
endif()
-if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
- set(CMAKE_INSTALL_PREFIX INSTALLED CACHE PATH "Kst's default install prefix" FORCE)
-endif()
if(NOT kst_install_libdir)
set(kst_install_libdir lib)
endif()
+if(NOT kst_install_plugins)
+ set(kst_install_plugins ${kst_install_libdir}/${kst_binary_name}/plugins)
+endif()
+if(kst_rpath)
+ # the RPATH to be used when installing
+ set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${kst_install_libdir}")
+endif()
+
+#path to install the .desktop files
+set(kst_install_plugin_desktop_file_path share/services/kst)
+
+
+
if(NOT kst_console)
set(kst_win32 WIN32)
set(kst_qtmain_library ${QT_QTMAIN_LIBRARY})
@@ -139,20 +153,7 @@
-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
-set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
-set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
-if(kst_rpath)
- # the RPATH to be used when installing
- set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
-endif()
-
-
-#path to install the .desktop files
-set(kst_install_plugin_desktop_file_path share/services/kst)
-
-
if(MSVC)
add_definitions(-D_USE_MATH_DEFINES)
endif()
@@ -180,7 +181,10 @@
message(STATUS)
message(STATUS "Version : ${kst_version}")
message(STATUS "Path to source : ${kst_dir}")
-message(STATUS "Installation path: ${CMAKE_INSTALL_PREFIX}")
+message(STATUS "Installation :")
+message(STATUS " ${kst_install_prefix}/bin")
+message(STATUS " ${kst_install_prefix}/${kst_install_libdir}")
+message(STATUS " ${kst_install_prefix}/${kst_install_plugins}")
message(STATUS)
message(STATUS "Options:")
kst_option_list_all()
--- branches/work/kst/portto4/kst/cmake/config.h.cmake #1221598:1221599
@@ -7,7 +7,8 @@
//#define QT_NO_KEYWORDS
#define KSTVERSION "${kst_version}"
-#define INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}"
+#define KST_INSTALL_LIBDIR "${kst_install_libdir}"
+#define KST_INSTALL_PLUGINS "${kst_install_plugins}"
#endif
--- branches/work/kst/portto4/kst/cmake/modules/KstMacros.cmake #1221598:1221599
@@ -70,6 +70,7 @@
macro(kst_add_executable)
+ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${kst_build_dir}/bin)
include_directories(${kst_${kst_name}_folder} ${CMAKE_CURRENT_BINARY_DIR})
add_executable(${kst_name} ${ARGN} ${kst_${kst_name}_sources} ${kst_${kst_name}_headers} ${kst_${kst_name}_info_files})
target_link_libraries(${kst_name} ${kst_qtmain_library})
@@ -87,6 +88,8 @@
macro(kst_add_library type)
+ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${kst_build_dir}/bin)
+ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${kst_build_dir}/${kst_install_libdir})
include_directories(${kst_${kst_name}_folder} ${CMAKE_CURRENT_BINARY_DIR})
string(TOUPPER BUILD_${kst_name} _build_macro)
add_definitions(-D${_build_macro})
@@ -126,11 +129,11 @@
macro(kst_init_plugin dir)
- set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/plugins)
if(APPLE AND NOT CMAKE_GENERATOR STREQUAL Xcode)
- set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/${kst_binary_name}.app/Contents/plugins)
+ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${kst_build_dir}/bin/${kst_binary_name}.app/Contents/plugins)
else()
- set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/plugins)
+ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${kst_build_dir}/${kst_install_plugins})
+ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${kst_build_dir}/${kst_install_plugins})
endif()
include_directories(${CMAKE_BINARY_DIR}/${dir})
kst_include_directories(kstcore kstmath kstwidgets)
@@ -150,7 +153,7 @@
add_library(${kst_name} MODULE ${kst_${kst_name}_sources} ${kst_${kst_name}_headers})
kst_link(kstcore kstmath kstwidgets)
if(NOT APPLE)
- install(TARGETS ${kst_name} LIBRARY DESTINATION plugins)
+ install(TARGETS ${kst_name} LIBRARY DESTINATION ${kst_install_plugins})
kst_find_install_desktop_file(${kst_plugin_dir}/${folder}/${name})
endif()
add_dependencies(${kst_binary_name} ${kst_name})
--- branches/work/kst/portto4/kst/config.h #1221598:1221599
@@ -7,7 +7,7 @@
//#define QT_NO_KEYWORDS
#define KSTVERSION "2.0.3"
-#define INSTALL_LIBDIR "INSTALLED"
+#define KST_INSTALL_LIBDIR "lib"
+#define KST_INSTALL_PLUGINS "lib/kst2/plugins"
-
#endif
--- branches/work/kst/portto4/kst/src/libkst/dataplugin.h #1221598:1221599
@@ -26,6 +26,9 @@
class DataSource;
class DataSourceConfigWidget;
+
+KSTCORE_EXPORT QStringList pluginSearchPaths();
+
class PluginInterface : public Shared {
public:
PluginInterface() {}
--- branches/work/kst/portto4/kst/src/libkst/datasourcepluginmanager.cpp #1221598:1221599
@@ -46,6 +46,32 @@
using namespace Kst;
+QStringList Kst::pluginSearchPaths()
+{
+ QStringList pluginPaths;
+
+ QDir rootDir = QApplication::applicationDirPath();
+ rootDir.cdUp();
+ QString path = rootDir.canonicalPath() + "/";
+ path += QLatin1String(KST_INSTALL_PLUGINS);
+ pluginPaths << path;
+
+ rootDir.cdUp();
+ path = rootDir.canonicalPath() + "/";
+ path += QLatin1String(KST_INSTALL_PLUGINS);
+ pluginPaths << path + QLatin1String("/Release");
+ pluginPaths << path + QLatin1String("/Debug");
+
+ Debug::self()->log(QString("\nPlugin Search Pathes:"));
+ foreach(const QString& p, pluginPaths) {
+ Debug::self()->log(QString("-> %1").arg(p));
+ }
+
+ return pluginPaths;
+}
+
+
+
QSettings DataSourcePluginManager::settingsObject("kst", "data");
QMap<QString,QString> DataSourcePluginManager::url_map;
@@ -136,36 +162,7 @@
}
}
- QStringList pluginPaths;
- pluginPaths << QLibraryInfo::location(QLibraryInfo::PluginsPath);
- pluginPaths << QString(qApp->applicationDirPath()).replace("bin", "plugins");
-
- QDir rootDir = QApplication::applicationDirPath();
- rootDir.cdUp();
- QString pluginPath = rootDir.canonicalPath();
- pluginPath += QDir::separator();
- pluginPath += QLatin1String(INSTALL_LIBDIR);
- pluginPath += QDir::separator();
- pluginPath += QLatin1String("kst");
- pluginPaths << pluginPath;
-
- pluginPath = rootDir.canonicalPath();
- pluginPath += QDir::separator();
-
-#ifdef Q_OS_MACX
- pluginPaths << pluginPath + QLatin1String("PlugIns");
- pluginPaths << pluginPath + QLatin1String("../PlugIns/Release");
- pluginPaths << pluginPath + QLatin1String("../PlugIns/Debug");
-#endif
-
-#ifdef Q_OS_WIN
- pluginPaths << pluginPath + QLatin1String("plugins");
- pluginPaths << pluginPath + QLatin1String("../plugins/Release");
- pluginPaths << pluginPath + QLatin1String("../plugins/Debug");
-#endif
-
- Debug::self()->log(QString("\nPlugin Search Pathes: \n%1").arg(pluginPaths.join("\n")));
-
+ QStringList pluginPaths = pluginSearchPaths();
foreach (const QString& pluginPath, pluginPaths) {
QDir d(pluginPath);
foreach (QString fileName, d.entryList(QDir::Files)) {
--- branches/work/kst/portto4/kst/src/libkstmath/dataobject.cpp #1221598:1221599
@@ -45,6 +45,8 @@
QMap<QString,QString> DataObject::url_map;
+
+
void DataObject::init() {
initPlugins();
}
@@ -181,34 +183,16 @@
}
}
- QStringList pluginPaths;
- pluginPaths << QLibraryInfo::location(QLibraryInfo::PluginsPath);
- pluginPaths << QString(qApp->applicationDirPath()).replace("bin", "plugin");
-
- QDir rootDir = QApplication::applicationDirPath();
- rootDir.cdUp();
- QString pluginPath = rootDir.canonicalPath();
- pluginPath += QDir::separator();
- pluginPath += QLatin1String(INSTALL_LIBDIR);
- pluginPath += QDir::separator();
- pluginPath += QLatin1String("kst");
- pluginPaths << pluginPath;
-
- pluginPath = rootDir.canonicalPath();
- pluginPath += QDir::separator();
- pluginPath += QLatin1String("PlugIns");
- pluginPaths << pluginPath;
-
+ QStringList pluginPaths = pluginSearchPaths();
foreach (QString pluginPath, pluginPaths) {
QDir d(pluginPath);
- Debug::self()->log(i18n("Path: ") + pluginPath);
foreach (QString fileName, d.entryList(QDir::Files)) {
QPluginLoader loader(d.absoluteFilePath(fileName));
QObject *plugin = loader.instance();
if (plugin) {
if (DataObjectPluginInterface *dataObjectPlugin = dynamic_cast<DataObjectPluginInterface*>(plugin)) {
tmpList.append(dataObjectPlugin);
- Debug::self()->log(i18n("Loaded: ") + fileName);
+ Debug::self()->log(QString("Plugin loaded: %1").arg(fileName));
}
}
}
More information about the Kst
mailing list