summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@gmail.com>2012-10-08 14:38:16 +0200
committerMatthias Vogelgesang <matthias.vogelgesang@gmail.com>2012-10-08 14:38:16 +0200
commitb3dbedeec78a55802565a3824ab52188e8b9bd4d (patch)
tree7529d8a8ce0a65ed94195631787c4cab6279709a /src
parentd58bbe683873d043f50c8261f4588d7941e9cb8c (diff)
downloaduca-b3dbedeec78a55802565a3824ab52188e8b9bd4d.tar.gz
uca-b3dbedeec78a55802565a3824ab52188e8b9bd4d.tar.bz2
uca-b3dbedeec78a55802565a3824ab52188e8b9bd4d.tar.xz
uca-b3dbedeec78a55802565a3824ab52188e8b9bd4d.zip
Generate introspection files
Unfortunately, the gir tools recognize anything with $PREFIX_new_$SUFFIX as some kind of constructor. This means that we have to rename uca_plugin_manager_new_camera() to uca_plugin_manager_get_camera().
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt57
-rw-r--r--src/uca-plugin-manager.c13
-rw-r--r--src/uca-plugin-manager.h2
3 files changed, 64 insertions, 8 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 4bf5820..dd2f464 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -37,6 +37,9 @@ add_custom_command(
# --- Configure ---------------------------------------------------------------
+find_program(INTROSPECTION_SCANNER "g-ir-scanner")
+find_program(INTROSPECTION_COMPILER "g-ir-compiler")
+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/config.h)
@@ -67,7 +70,51 @@ set_target_properties(uca PROPERTIES
target_link_libraries(uca ${UCA_DEPS})
+# --- Build introspection files -----------------------------------------------
+
+if (INTROSPECTION_SCANNER AND INTROSPECTION_COMPILER)
+ option(WITH_GIR "Build introspection files" ON)
+
+ if (WITH_GIR)
+ set(GIR_PREFIX "Uca-${UCA_ABI_VERSION}")
+ set(GIR_XML "${GIR_PREFIX}.gir")
+ set(GIR_TYPELIB "${GIR_PREFIX}.typelib")
+ set(_gir_input)
+
+ foreach(_src ${uca_SRCS} ${uca_HDRS})
+ list(APPEND _gir_input "${CMAKE_CURRENT_SOURCE_DIR}/${_src}")
+ endforeach()
+
+ add_custom_command(OUTPUT ${GIR_XML}
+ COMMAND ${INTROSPECTION_SCANNER}
+ --namespace=Uca
+ --nsversion=${UCA_ABI_VERSION}
+ --library=uca
+ --no-libtool
+ --include=GObject-2.0
+ --include=GModule-2.0
+ --output ${GIR_XML}
+ --warn-all
+ ${_gir_input}
+ DEPENDS ${uca_SRCS}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+
+ add_custom_command(OUTPUT ${GIR_TYPELIB}
+ COMMAND ${INTROSPECTION_COMPILER}
+ -o ${GIR_TYPELIB}
+ ${GIR_XML}
+ DEPENDS ${GIR_XML}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+
+ add_custom_target(gir ALL DEPENDS ${GIR_XML} ${GIR_TYPELIB})
+ add_dependencies(gir uca)
+
+ endif()
+endif()
+
+
# --- Build documentation -----------------------------------------------------
+
pkg_check_modules(GTK_DOC gtk-doc)
if(GTK_DOC_FOUND)
@@ -170,6 +217,16 @@ install(FILES ${uca_HDRS}
DESTINATION include/uca
COMPONENT headers)
+if(WITH_GIR)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${GIR_XML}
+ DESTINATION share/gir-1.0
+ COMPONENT libraries)
+
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${GIR_TYPELIB}
+ DESTINATION ${LIB_INSTALL_DIR}/girepository-1.0
+ COMPONENT libraries)
+endif()
+
# --- Generate package description --------------------------------------------
diff --git a/src/uca-plugin-manager.c b/src/uca-plugin-manager.c
index 5678e83..cb7e518 100644
--- a/src/uca-plugin-manager.c
+++ b/src/uca-plugin-manager.c
@@ -49,9 +49,7 @@ uca_plugin_manager_error_quark (void)
* uca_plugin_manager_new:
* @config: (allow-none): A #UcaConfiguration object or %NULL.
*
- * Create a plugin manager object to instantiate filter objects. When a config
- * object is passed to the constructor, its search-path property is added to the
- * internal search paths.
+ * Create a plugin manager object to instantiate camera objects.
*
* Return value: A new plugin manager object.
*/
@@ -147,9 +145,10 @@ list_free_full (GList *list)
*
* @manager: A #UcaPluginManager
*
- * Return: A list with strings of available camera names. You have to free the
- * individual strings with g_list_foreach(list, (GFunc) g_free, NULL) and the
- * list itself with g_list_free.
+ * Returns: (element-type utf8) (transfer full): A list with strings of
+ * available camera names. You have to free the individual strings with
+ * g_list_foreach(list, (GFunc) g_free, NULL) and the list itself with
+ * g_list_free.
*/
GList *
uca_plugin_manager_get_available_cameras (UcaPluginManager *manager)
@@ -201,7 +200,7 @@ find_camera_module_path (GList *search_paths, const gchar *name)
* @error: Location for a #GError
*/
UcaCamera *
-uca_plugin_manager_new_camera (UcaPluginManager *manager,
+uca_plugin_manager_get_camera (UcaPluginManager *manager,
const gchar *name,
GError **error)
{
diff --git a/src/uca-plugin-manager.h b/src/uca-plugin-manager.h
index 9291857..6c3ab4e 100644
--- a/src/uca-plugin-manager.h
+++ b/src/uca-plugin-manager.h
@@ -55,7 +55,7 @@ void uca_plugin_manager_add_path (UcaPluginManager *manager
const gchar *path);
GList *uca_plugin_manager_get_available_cameras
(UcaPluginManager *manager);
-UcaCamera *uca_plugin_manager_new_camera (UcaPluginManager *manager,
+UcaCamera *uca_plugin_manager_get_camera (UcaPluginManager *manager,
const gchar *name,
GError **error);
GType uca_plugin_manager_get_type (void);