[Kde-bindings] KDE/kdebindings/csharp/kimono
Arno Rehn
kde at arnorehn.de
Fri Dec 18 18:00:31 UTC 2009
SVN commit 1063519 by arnorehn:
Make Kimono use the new, 'really' modular kde smoke libs.
Use FindPkgConfig.cmake instead of UsePkgConfig.cmake.
CCMAIL: kde-bindings at kde.org
M +14 -13 CMakeLists.txt
M +46 -28 src/kimono.cpp
--- trunk/KDE/kdebindings/csharp/kimono/CMakeLists.txt #1063518:1063519
@@ -1,6 +1,6 @@
PROJECT(kimono)
-INCLUDE(UsePkgConfig)
+find_package(PkgConfig)
SET(SRC_CS ${CMAKE_CURRENT_SOURCE_DIR}/src/Kimono.cs
${CMAKE_CURRENT_SOURCE_DIR}/src/AssemblyInfo.cs
@@ -16,28 +16,29 @@
${CMAKE_CURRENT_SOURCE_DIR}/../qyoto/src ${QT_INCLUDES})
LINK_DIRECTORIES (${LIBRARY_OUTPUT_PATH})
KDE4_ADD_LIBRARY(kimono MODULE ${SRC_KIMONO})
-ADD_DEPENDENCIES(kimono smokekde)
-TARGET_LINK_LIBRARIES(kimono smokekde qyotoshared ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY}
+TARGET_LINK_LIBRARIES(kimono qyotoshared
+ smokekdecore smokekdeui smokekio smokekparts smokekfile smokeknewstuff2 smokeknewstuff3 smokekutils
+ ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY}
${KDE4_KDECORE_LIBS} ${KDE4_KIO_LIBS})
# write FindPackage modules for these
-PKGCONFIG(mono MONO_INCLUDES MONO_LINK_DIR MONO_LINK_FLAGS MONO_CFLAGS)
-PKGCONFIG(glib-2.0 GLIB_INCLUDES GLIB_LINK_DIR GLIB_LINK_FLAGS GLIB_CFLAGS)
+pkg_search_module(MONO mono)
+pkg_search_module(GLIB2 glib-2.0)
# if libmono-dev is not installed, then MONO_INCLUDES is not defined and compiling
# the kimonopluginfactory would fail. So, just disable kimonopluginfactory if the
# MONO_INCLUDES is empty and provide some feedback to the user about it.
-IF (MONO_INCLUDES)
+IF (MONO_FOUND)
SET(SRC_FACTORY src/kimonopluginfactory.cpp)
- LINK_DIRECTORIES(${MONO_LINK_DIR} ${GLIB_LINK_DIR})
- INCLUDE_DIRECTORIES(${MONO_INCLUDES} ${GLIB_INCLUDES})
- ADD_DEFINITIONS(${GLIB_CFLAGS} ${MONO_CFLAGS})
+ LINK_DIRECTORIES(${MONO_LIBRARY_DIRS} ${GLIB2_LIBRARY_DIRS})
+ INCLUDE_DIRECTORIES(${MONO_INCLUDE_DIRS} ${GLIB2_INCLUDE_DIRS})
+ ADD_DEFINITIONS(${GLIB2_CFLAGS} ${MONO_CFLAGS})
KDE4_ADD_PLUGIN(kimonopluginfactory ${SRC_FACTORY})
- TARGET_LINK_LIBRARIES(kimonopluginfactory ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${KDE4_KDECORE_LIBS} ${KDE4_KIO_LIBS} qyotoshared smokeqtcore smokeqtgui ${MONO_LINK_FLAGS})
+ TARGET_LINK_LIBRARIES(kimonopluginfactory ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${KDE4_KDECORE_LIBS} ${KDE4_KIO_LIBS} qyotoshared smokeqtcore smokeqtgui ${MONO_LIBRARIES})
INSTALL(TARGETS kimonopluginfactory DESTINATION ${PLUGIN_INSTALL_DIR})
-ELSE (MONO_INCLUDES)
- MESSAGE(STATUS "Mono includes not found. kimonopluginfactory will not be compiled.")
-ENDIF (MONO_INCLUDES)
+ELSE (MONO_FOUND)
+ MESSAGE(STATUS "Mono not found. kimonopluginfactory will not be compiled.")
+ENDIF (MONO_FOUND)
CSHARP_ADD_LIBRARY(kde-dotnet "${SRC_CS}" REFERENCES qt-dotnet COMPILE_FLAGS /warn:0 /keyfile:${KEYFILE})
ADD_DEPENDENCIES (kde-dotnet qt-dotnet kimono)
--- trunk/KDE/kdebindings/csharp/kimono/src/kimono.cpp #1063518:1063519
@@ -26,7 +26,14 @@
#include <smoke.h>
#include <smoke/qtcore_smoke.h>
-#include <smoke/kde_smoke.h>
+#include <smoke/kdecore_smoke.h>
+#include <smoke/kdeui_smoke.h>
+#include <smoke/kparts_smoke.h>
+#include <smoke/kio_smoke.h>
+#include <smoke/knewstuff2_smoke.h>
+#include <smoke/knewstuff3_smoke.h>
+#include <smoke/kfile_smoke.h>
+#include <smoke/kutils_smoke.h>
#include <QMimeData>
#include <QStringList>
@@ -34,8 +41,6 @@
#include <KPluginFactory>
#include <KUrl>
-QHash<int, char*> classNames;
-
const char *
resolve_classname_KDE(smokeqyoto_object * o)
{
@@ -111,9 +116,9 @@
(*FreeGCHandle)(key);
(*FreeGCHandle)(value);
}
- Smoke::Index id = kde_Smoke->idClass("KUrl").index;
+ Smoke::Index id = kdecore_Smoke->idClass("KUrl").index;
foreach(KUrl url, KUrl::List::fromMimeData(md, (map.size() > 0)? &map : 0)) {
- smokeqyoto_object *o = alloc_smokeqyoto_object(true, kde_Smoke, id, new KUrl(url));
+ smokeqyoto_object *o = alloc_smokeqyoto_object(true, kdecore_Smoke, id, new KUrl(url));
(*addfn)((*CreateInstance)("Kimono.KUrl", o));
}
}
@@ -163,35 +168,48 @@
return (*CreateInstance)(name, obj);
}
-extern Q_DECL_EXPORT void Init_kimono();
+#define INIT_BINDING(module) \
+ static QHash<int,char *> module##_classname; \
+ for (int i = 1; i <= module##_Smoke->numClasses; i++) { \
+ QByteArray name(module##_Smoke->classes[i].className); \
+ name.replace("::", "."); \
+ if ( !name.startsWith("KParts") \
+ && !name.startsWith("Sonnet") \
+ && !name.startsWith("KIO") \
+ && !name.startsWith("KWallet") \
+ && !name.startsWith("KNS") ) \
+ { \
+ name = prefix + name; \
+ } \
+ module##_classname.insert(i, strdup(name.constData())); \
+ } \
+ static Qyoto::Binding module##_binding = Qyoto::Binding(module##_Smoke, &module##_classname); \
+ QyotoModule module = { "Kimono_" #module, resolve_classname_KDE, IsContainedInstanceKDE, &module##_binding }; \
+ qyoto_modules[module##_Smoke] = module;
-static Qyoto::Binding binding;
-
-void
+Q_DECL_EXPORT void
Init_kimono()
{
- init_kde_Smoke();
+ init_kdecore_Smoke();
+ init_kdeui_Smoke();
+ init_kparts_Smoke();
+ init_kio_Smoke();
+ init_knewstuff2_Smoke();
+ init_knewstuff3_Smoke();
+ init_kfile_Smoke();
+ init_kutils_Smoke();
+
QByteArray prefix("Kimono.");
- for (int i = 1; i <= kde_Smoke->numClasses; i++) {
- QByteArray name(kde_Smoke->classes[i].className);
- name.replace("::", ".");
- if ( !name.startsWith("KParts")
- && !name.startsWith("Sonnet")
- && !name.startsWith("KIO")
- && !name.startsWith("KWallet")
- && !name.startsWith("KNS") )
- {
- name = prefix + name;
- }
+ INIT_BINDING(kdecore)
+ INIT_BINDING(kdeui)
+ INIT_BINDING(kparts)
+ INIT_BINDING(kio)
+ INIT_BINDING(knewstuff2)
+ INIT_BINDING(knewstuff3)
+ INIT_BINDING(kfile)
+ INIT_BINDING(kutils)
- classNames.insert(i, strdup(name.constData()));
- }
-
- binding = Qyoto::Binding(kde_Smoke, &classNames);
- QyotoModule module = { "Kimono", resolve_classname_KDE, IsContainedInstanceKDE, &binding };
- qyoto_modules[kde_Smoke] = module;
-
qyoto_install_handlers(KDE_handlers);
}
More information about the Kde-bindings
mailing list