diff options
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | src/CMakeLists.txt | 57 | ||||
-rw-r--r-- | src/uca-plugin-manager.c | 13 | ||||
-rw-r--r-- | src/uca-plugin-manager.h | 2 | ||||
-rw-r--r-- | test/test-mock.c | 4 | ||||
-rw-r--r-- | tools/benchmark.c | 2 | ||||
-rw-r--r-- | tools/gen-doc.c | 2 | ||||
-rw-r--r-- | tools/grab-async.c | 2 | ||||
-rw-r--r-- | tools/grab.c | 2 | ||||
-rw-r--r-- | tools/gui/control.c | 2 | ||||
-rw-r--r-- | tools/perf-overhead.c | 2 |
12 files changed, 74 insertions, 17 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index bb53b40..bef3712 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,7 @@ set(UCA_ENUM_HDRS ${CMAKE_CURRENT_SOURCE_DIR}/src/uca-camera.h ${CMAKE_CURRENT_SOURCE_DIR}/plugins/pco/uca-pco-camera.h) + # --- Common configuration --------------------------------------------------- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/package.sh.in @@ -13,7 +13,7 @@ looks in pre- and user-defined directories for DSOs that match UcaCamera *camera; manager = uca_plugin_manager_new (); - camera = uca_plugin_manager_new_camera (manager, "foo", &error); + camera = uca_plugin_manager_get_camera (manager, "foo", &error); The plugin manager adds a dependency on GModule (pkg-config package `gmodule-2.0`) that is part of GLib. 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); diff --git a/test/test-mock.c b/test/test-mock.c index ca16c59..711364d 100644 --- a/test/test-mock.c +++ b/test/test-mock.c @@ -16,7 +16,7 @@ fixture_setup (Fixture *fixture, gconstpointer data) fixture->manager = uca_plugin_manager_new (); uca_plugin_manager_add_path (fixture->manager, "./src"); - fixture->camera = uca_plugin_manager_new_camera (fixture->manager, "mock", &error); + fixture->camera = uca_plugin_manager_get_camera (fixture->manager, "mock", &error); g_assert (error == NULL); g_assert (fixture->camera); } @@ -39,7 +39,7 @@ static void test_factory (Fixture *fixture, gconstpointer data) { GError *error = NULL; - UcaCamera *camera = uca_plugin_manager_new_camera (fixture->manager, "fox994m3a0yxmy", &error); + UcaCamera *camera = uca_plugin_manager_get_camera (fixture->manager, "fox994m3a0yxmy", &error); g_assert_error (error, UCA_PLUGIN_MANAGER_ERROR, UCA_PLUGIN_MANAGER_ERROR_MODULE_NOT_FOUND); g_assert (camera == NULL); } diff --git a/tools/benchmark.c b/tools/benchmark.c index ef99fd1..bff8b50 100644 --- a/tools/benchmark.c +++ b/tools/benchmark.c @@ -250,7 +250,7 @@ main (int argc, char *argv[]) g_log_set_handler (NULL, G_LOG_LEVEL_MASK, log_handler, log_channel); manager = uca_plugin_manager_new (); - camera = uca_plugin_manager_new_camera (manager, argv[1], &error); + camera = uca_plugin_manager_get_camera (manager, argv[1], &error); if (camera == NULL) { g_error ("Initialization: %s", error->message); diff --git a/tools/gen-doc.c b/tools/gen-doc.c index 86d6ff9..f555a5f 100644 --- a/tools/gen-doc.c +++ b/tools/gen-doc.c @@ -136,7 +136,7 @@ int main(int argc, char *argv[]) } else { name = argv[1]; - camera = uca_plugin_manager_new_camera (manager, name, &error); + camera = uca_plugin_manager_get_camera (manager, name, &error); } if (camera == NULL) { diff --git a/tools/grab-async.c b/tools/grab-async.c index 6132829..2c4bf04 100644 --- a/tools/grab-async.c +++ b/tools/grab-async.c @@ -94,7 +94,7 @@ main(int argc, char *argv[]) } manager = uca_plugin_manager_new (); - camera = uca_plugin_manager_new_camera (manager, argv[1], &error); + camera = uca_plugin_manager_get_camera (manager, argv[1], &error); if (camera == NULL) { g_print("Error during initialization: %s\n", error->message); diff --git a/tools/grab.c b/tools/grab.c index 1f5c917..1518997 100644 --- a/tools/grab.c +++ b/tools/grab.c @@ -75,7 +75,7 @@ int main(int argc, char *argv[]) } manager = uca_plugin_manager_new (); - camera = uca_plugin_manager_new_camera (manager, argv[1], &error); + camera = uca_plugin_manager_get_camera (manager, argv[1], &error); if (camera == NULL) { g_print("Error during initialization: %s\n", error->message); diff --git a/tools/gui/control.c b/tools/gui/control.c index 75b3cde..178c809 100644 --- a/tools/gui/control.c +++ b/tools/gui/control.c @@ -207,7 +207,7 @@ create_main_window (GtkBuilder *builder, const gchar* camera_name) static ThreadData td; GError *error = NULL; - UcaCamera *camera = uca_plugin_manager_new_camera (plugin_manager, camera_name, &error); + UcaCamera *camera = uca_plugin_manager_get_camera (plugin_manager, camera_name, &error); if ((camera == NULL) || (error != NULL)) { g_error ("%s\n", error->message); diff --git a/tools/perf-overhead.c b/tools/perf-overhead.c index f8bdcbd..6735e6f 100644 --- a/tools/perf-overhead.c +++ b/tools/perf-overhead.c @@ -163,7 +163,7 @@ main (int argc, char *argv[]) } manager = uca_plugin_manager_new (); - camera = uca_plugin_manager_new_camera (manager, argv[1], &error); + camera = uca_plugin_manager_get_camera (manager, argv[1], &error); if (camera == NULL) { g_print ("Error during initialization: %s\n", error->message); |