From cf94f82c53c74167e5f6e66ffbbf998a2b50853b Mon Sep 17 00:00:00 2001 From: Jochen Keil Date: Wed, 22 May 2013 20:35:45 +0200 Subject: [PATCH 1/8] Initial groundwork for rsvg bindings Add scratch files as a start: merge rsvg.h and rsvg-cairo.h. Concatenate licenses of rsvg.h and rsvg-cairo. Remove unnecessary defines, private structs, unused apis (GIO/GdkPixbuf), etc. Replace deprecated api functions with glib-object functions Add headers for glib.h and librsvg/rsvg.h --- lua/librsvg-helper.h | 42 ++++++++++++++ lua/rsvg.pkg | 128 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 170 insertions(+) create mode 100644 lua/librsvg-helper.h create mode 100644 lua/rsvg.pkg diff --git a/lua/librsvg-helper.h b/lua/librsvg-helper.h new file mode 100644 index 00000000..26916bc2 --- /dev/null +++ b/lua/librsvg-helper.h @@ -0,0 +1,42 @@ +/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*- + * + * Conky, a system monitor, based on torsmo + * + * Please see COPYING for details + * + * Copyright (c) 2005-2012 Brenden Matthews, Philip Kovacs, et. al. + * (see AUTHORS) + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#ifndef _LIBRSVG_HELPER_H_ +#define _LIBRSVG_HELPER_H_ + +#include + +cairo_text_extents_t *create_cairo_text_extents_t(void) { + return calloc(1, sizeof(cairo_text_extents_t)); +} + +cairo_font_extents_t *create_cairo_font_extents_t(void) { + return calloc(1, sizeof(cairo_font_extents_t)); +} + +cairo_matrix_t *create_cairo_matrix_t(void) { + return calloc(1, sizeof(cairo_matrix_t)); +} + +#endif /* _LIBRSVG_HELPER_H_ */ diff --git a/lua/rsvg.pkg b/lua/rsvg.pkg new file mode 100644 index 00000000..10092783 --- /dev/null +++ b/lua/rsvg.pkg @@ -0,0 +1,128 @@ +/* + rsvg.h: SAX-based renderer for SVG files into a GdkPixbuf. + + Copyright (C) 2000 Eazel, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + + Author: Raph Levien + + rsvg-cairo.h: SAX-based renderer for SVG files using cairo + + Copyright (C) 2005 Red Hat, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + + Author: Carl Worth +*/ + +$#include +$#include + +typedef struct _RsvgHandle RsvgHandle; +typedef struct RsvgHandlePrivate RsvgHandlePrivate; +typedef struct _RsvgHandleClass RsvgHandleClass; +typedef struct _RsvgDimensionData RsvgDimensionData; +typedef struct _RsvgPositionData RsvgPositionData; + +/** + * RsvgDimensionData: + * @width: SVG's width, in pixels + * @height: SVG's height, in pixels + * @em: em + * @ex: ex + */ +struct _RsvgDimensionData { + int width; + int height; + gdouble em; + gdouble ex; +}; + +/** + * RsvgPositionData: + * Position of an SVG fragment. + */ +struct _RsvgPositionData { + int x; + int y; +}; + +void rsvg_set_default_dpi (double dpi); +void rsvg_set_default_dpi_x_y (double dpi_x, double dpi_y); + +void rsvg_handle_set_dpi (RsvgHandle * handle, double dpi); +void rsvg_handle_set_dpi_x_y (RsvgHandle * handle, double dpi_x, double dpi_y); + +RsvgHandle *rsvg_handle_new (void); +gboolean rsvg_handle_write (RsvgHandle * handle, const guchar * buf, + gsize count, GError ** error); +gboolean rsvg_handle_close (RsvgHandle * handle, GError ** error); +GdkPixbuf *rsvg_handle_get_pixbuf (RsvgHandle * handle); +GdkPixbuf *rsvg_handle_get_pixbuf_sub (RsvgHandle * handle, const char *id); + +const char *rsvg_handle_get_base_uri (RsvgHandle * handle); +void rsvg_handle_set_base_uri (RsvgHandle * handle, const char *base_uri); + +void rsvg_handle_get_dimensions (RsvgHandle * handle, RsvgDimensionData * dimension_data); + +gboolean rsvg_handle_get_dimensions_sub (RsvgHandle * handle, RsvgDimensionData * dimension_data, const char *id); +gboolean rsvg_handle_get_position_sub (RsvgHandle * handle, RsvgPositionData * position_data, const char *id); + +gboolean rsvg_handle_has_sub (RsvgHandle * handle, const char *id); + +RsvgHandle *rsvg_handle_new_with_flags (RsvgHandleFlags flags); + +void rsvg_handle_set_base_gfile (RsvgHandle *handle, + GFile *base_file); + +gboolean rsvg_handle_read_stream_sync (RsvgHandle *handle, + GInputStream *stream, + GCancellable *cancellable, + GError **error); + +RsvgHandle *rsvg_handle_new_from_gfile_sync (GFile *file, + RsvgHandleFlags flags, + GCancellable *cancellable, + GError **error); + +RsvgHandle *rsvg_handle_new_from_stream_sync (GInputStream *input_stream, + GFile *base_file, + RsvgHandleFlags flags, + GCancellable *cancellable, + GError **error); + +RsvgHandle *rsvg_handle_new_from_data (const guint8 * data, gsize data_len, GError ** error); +RsvgHandle *rsvg_handle_new_from_file (const gchar * file_name, GError ** error); + +gboolean rsvg_handle_render_cairo (RsvgHandle * handle, cairo_t * cr); +gboolean rsvg_handle_render_cairo_sub (RsvgHandle * handle, cairo_t * cr, const char *id); + +void g_type_init(void); +void g_object_unref(gpointer object); From 04c7323cac2e0b1f8ce1f682b58783a26d049987 Mon Sep 17 00:00:00 2001 From: Jochen Keil Date: Wed, 22 May 2013 20:50:11 +0200 Subject: [PATCH 2/8] Replace glib types with primitive types This help tolua++ to recognize them as native types and not as usertypes. --- lua/rsvg.pkg | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lua/rsvg.pkg b/lua/rsvg.pkg index 10092783..4e50dfb6 100644 --- a/lua/rsvg.pkg +++ b/lua/rsvg.pkg @@ -61,8 +61,8 @@ typedef struct _RsvgPositionData RsvgPositionData; struct _RsvgDimensionData { int width; int height; - gdouble em; - gdouble ex; + double em; + double ex; }; /** @@ -81,9 +81,9 @@ void rsvg_handle_set_dpi (RsvgHandle * handle, double dpi); void rsvg_handle_set_dpi_x_y (RsvgHandle * handle, double dpi_x, double dpi_y); RsvgHandle *rsvg_handle_new (void); -gboolean rsvg_handle_write (RsvgHandle * handle, const guchar * buf, - gsize count, GError ** error); -gboolean rsvg_handle_close (RsvgHandle * handle, GError ** error); +int rsvg_handle_write (RsvgHandle * handle, const unsigned char * buf, + unsigned long count, GError ** error); +int rsvg_handle_close (RsvgHandle * handle, GError ** error); GdkPixbuf *rsvg_handle_get_pixbuf (RsvgHandle * handle); GdkPixbuf *rsvg_handle_get_pixbuf_sub (RsvgHandle * handle, const char *id); @@ -92,17 +92,17 @@ void rsvg_handle_set_base_uri (RsvgHandle * handle, const char *base_uri void rsvg_handle_get_dimensions (RsvgHandle * handle, RsvgDimensionData * dimension_data); -gboolean rsvg_handle_get_dimensions_sub (RsvgHandle * handle, RsvgDimensionData * dimension_data, const char *id); -gboolean rsvg_handle_get_position_sub (RsvgHandle * handle, RsvgPositionData * position_data, const char *id); +int rsvg_handle_get_dimensions_sub (RsvgHandle * handle, RsvgDimensionData * dimension_data, const char *id); +int rsvg_handle_get_position_sub (RsvgHandle * handle, RsvgPositionData * position_data, const char *id); -gboolean rsvg_handle_has_sub (RsvgHandle * handle, const char *id); +int rsvg_handle_has_sub (RsvgHandle * handle, const char *id); RsvgHandle *rsvg_handle_new_with_flags (RsvgHandleFlags flags); void rsvg_handle_set_base_gfile (RsvgHandle *handle, GFile *base_file); -gboolean rsvg_handle_read_stream_sync (RsvgHandle *handle, +int rsvg_handle_read_stream_sync (RsvgHandle *handle, GInputStream *stream, GCancellable *cancellable, GError **error); @@ -118,11 +118,11 @@ RsvgHandle *rsvg_handle_new_from_stream_sync (GInputStream *input_stream, GCancellable *cancellable, GError **error); -RsvgHandle *rsvg_handle_new_from_data (const guint8 * data, gsize data_len, GError ** error); -RsvgHandle *rsvg_handle_new_from_file (const gchar * file_name, GError ** error); +RsvgHandle *rsvg_handle_new_from_data (const unsigned char * data, unsigned long data_len, GError ** error); +RsvgHandle *rsvg_handle_new_from_file (const char * file_name, GError ** error); -gboolean rsvg_handle_render_cairo (RsvgHandle * handle, cairo_t * cr); -gboolean rsvg_handle_render_cairo_sub (RsvgHandle * handle, cairo_t * cr, const char *id); +int rsvg_handle_render_cairo (RsvgHandle * handle, cairo_t * cr); +int rsvg_handle_render_cairo_sub (RsvgHandle * handle, cairo_t * cr, const char *id); void g_type_init(void); void g_object_unref(gpointer object); From 4920cb71be565f7e941ba89bb08cabdd1d9c4323 Mon Sep 17 00:00:00 2001 From: Jochen Keil Date: Wed, 22 May 2013 21:10:50 +0200 Subject: [PATCH 3/8] Remove unused GIO/GdkPixbuf interface Conky Lua only uses cairo, so that's everything we need to keep. Anything else is just a source for trouble. --- lua/rsvg.pkg | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/lua/rsvg.pkg b/lua/rsvg.pkg index 4e50dfb6..e283a6b1 100644 --- a/lua/rsvg.pkg +++ b/lua/rsvg.pkg @@ -74,18 +74,10 @@ struct _RsvgPositionData { int y; }; -void rsvg_set_default_dpi (double dpi); -void rsvg_set_default_dpi_x_y (double dpi_x, double dpi_y); - -void rsvg_handle_set_dpi (RsvgHandle * handle, double dpi); -void rsvg_handle_set_dpi_x_y (RsvgHandle * handle, double dpi_x, double dpi_y); - RsvgHandle *rsvg_handle_new (void); int rsvg_handle_write (RsvgHandle * handle, const unsigned char * buf, unsigned long count, GError ** error); int rsvg_handle_close (RsvgHandle * handle, GError ** error); -GdkPixbuf *rsvg_handle_get_pixbuf (RsvgHandle * handle); -GdkPixbuf *rsvg_handle_get_pixbuf_sub (RsvgHandle * handle, const char *id); const char *rsvg_handle_get_base_uri (RsvgHandle * handle); void rsvg_handle_set_base_uri (RsvgHandle * handle, const char *base_uri); @@ -99,25 +91,6 @@ int rsvg_handle_has_sub (RsvgHandle * handle, const char *id); RsvgHandle *rsvg_handle_new_with_flags (RsvgHandleFlags flags); -void rsvg_handle_set_base_gfile (RsvgHandle *handle, - GFile *base_file); - -int rsvg_handle_read_stream_sync (RsvgHandle *handle, - GInputStream *stream, - GCancellable *cancellable, - GError **error); - -RsvgHandle *rsvg_handle_new_from_gfile_sync (GFile *file, - RsvgHandleFlags flags, - GCancellable *cancellable, - GError **error); - -RsvgHandle *rsvg_handle_new_from_stream_sync (GInputStream *input_stream, - GFile *base_file, - RsvgHandleFlags flags, - GCancellable *cancellable, - GError **error); - RsvgHandle *rsvg_handle_new_from_data (const unsigned char * data, unsigned long data_len, GError ** error); RsvgHandle *rsvg_handle_new_from_file (const char * file_name, GError ** error); From 118332aa000f42ffee19ac53f42c284984955a4a Mon Sep 17 00:00:00 2001 From: Jochen Keil Date: Wed, 22 May 2013 21:18:35 +0200 Subject: [PATCH 4/8] Inline typedefs --- lua/rsvg.pkg | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lua/rsvg.pkg b/lua/rsvg.pkg index e283a6b1..558f9b27 100644 --- a/lua/rsvg.pkg +++ b/lua/rsvg.pkg @@ -48,8 +48,6 @@ $#include typedef struct _RsvgHandle RsvgHandle; typedef struct RsvgHandlePrivate RsvgHandlePrivate; typedef struct _RsvgHandleClass RsvgHandleClass; -typedef struct _RsvgDimensionData RsvgDimensionData; -typedef struct _RsvgPositionData RsvgPositionData; /** * RsvgDimensionData: @@ -58,21 +56,21 @@ typedef struct _RsvgPositionData RsvgPositionData; * @em: em * @ex: ex */ -struct _RsvgDimensionData { +typedef struct _RsvgDimensionData { int width; int height; double em; double ex; -}; +} RsvgDimensionData; /** * RsvgPositionData: * Position of an SVG fragment. */ -struct _RsvgPositionData { +typedef struct _RsvgPositionData { int x; int y; -}; +} RsvgPositionData; RsvgHandle *rsvg_handle_new (void); int rsvg_handle_write (RsvgHandle * handle, const unsigned char * buf, From 32c60685bacab38b0d2ad35f8904eeccff7ab862 Mon Sep 17 00:00:00 2001 From: Jochen Keil Date: Wed, 22 May 2013 20:51:11 +0200 Subject: [PATCH 5/8] Wrapper functions for {creat,destroy}ing an rsvg handle This wrapper functions should facilitate the handling of rsvg handles. Especially unrefing with g_object_unref does not seem to work properly using the lua bindings. --- lua/librsvg-helper.h | 71 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 64 insertions(+), 7 deletions(-) diff --git a/lua/librsvg-helper.h b/lua/librsvg-helper.h index 26916bc2..900227e9 100644 --- a/lua/librsvg-helper.h +++ b/lua/librsvg-helper.h @@ -25,18 +25,75 @@ #ifndef _LIBRSVG_HELPER_H_ #define _LIBRSVG_HELPER_H_ -#include +#include +#include -cairo_text_extents_t *create_cairo_text_extents_t(void) { - return calloc(1, sizeof(cairo_text_extents_t)); +RsvgDimensionData * +rsvgDimensionDataCreate(void) +{ + return (RsvgDimensionData *)calloc(1, sizeof(RsvgDimensionData)); } -cairo_font_extents_t *create_cairo_font_extents_t(void) { - return calloc(1, sizeof(cairo_font_extents_t)); +void +rsvgDimensionDataGet(RsvgDimensionData * dd, + int * width, int * height, double * em, double * ex) +{ + if (dd) { + *width = dd->width; + *height = dd->height; + *em = dd->em; + *ex = dd->ex; + } } -cairo_matrix_t *create_cairo_matrix_t(void) { - return calloc(1, sizeof(cairo_matrix_t)); +RsvgPositionData * +rsvgPositionDataCreate(void) +{ + return (RsvgPositionData *)calloc(1, sizeof(RsvgPositionData)); +} + +void +rsvgPositionDataGet(RsvgPositionData * pd, int * x, int * y) +{ + if (pd) { + *x = pd->x; + *y = pd->y; + } +} + +RsvgHandle * +rsvg_create_handle_from_file(const char * filename) +{ + GError * error = NULL; + RsvgHandle * handle = rsvg_handle_new_from_file(filename, &error); + + if (error) { + g_object_unref(error); + if (handle) + g_object_unref(handle); + handle = NULL; + } + + return handle; +} + +int +rsvg_destroy_handle(RsvgHandle * handle) +{ + int status = 0; + + if (handle) { + GError * error = NULL; + status = rsvg_handle_close(handle, &error); + + if (status) + g_object_unref(handle); + + if (error) + g_object_unref(error); + } + + return status; } #endif /* _LIBRSVG_HELPER_H_ */ From dee71f4eb24905dbc470839bc4f4aa40d8e8ccec Mon Sep 17 00:00:00 2001 From: Jochen Keil Date: Wed, 22 May 2013 21:27:44 +0200 Subject: [PATCH 6/8] Functions for creating and accessing Dimension/Position structs --- lua/librsvg-helper.h | 1 + lua/rsvg.pkg | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/lua/librsvg-helper.h b/lua/librsvg-helper.h index 900227e9..ca527ea0 100644 --- a/lua/librsvg-helper.h +++ b/lua/librsvg-helper.h @@ -26,6 +26,7 @@ #define _LIBRSVG_HELPER_H_ #include +#include #include RsvgDimensionData * diff --git a/lua/rsvg.pkg b/lua/rsvg.pkg index 558f9b27..22791744 100644 --- a/lua/rsvg.pkg +++ b/lua/rsvg.pkg @@ -61,6 +61,8 @@ typedef struct _RsvgDimensionData { int height; double em; double ex; + static tolua_outside RsvgDimensionData * rsvgDimensionDataCreate @ create(); + tolua_outside rsvgDimensionDataGet @ get(int width, int height, double em, double ex); } RsvgDimensionData; /** @@ -70,6 +72,8 @@ typedef struct _RsvgDimensionData { typedef struct _RsvgPositionData { int x; int y; + static tolua_outside RsvgPositionData * rsvgPositionDataCreate @ create(); + tolua_outside rsvgPositionDataGet @ get(int x, int y); } RsvgPositionData; RsvgHandle *rsvg_handle_new (void); From bec61e922c7b27abe4196a6cd7b612801bb8afdc Mon Sep 17 00:00:00 2001 From: Jochen Keil Date: Wed, 22 May 2013 21:17:01 +0200 Subject: [PATCH 7/8] Include header file for helper functions Also add function declarations --- lua/librsvg-helper.h | 2 +- lua/rsvg.pkg | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lua/librsvg-helper.h b/lua/librsvg-helper.h index ca527ea0..8918f558 100644 --- a/lua/librsvg-helper.h +++ b/lua/librsvg-helper.h @@ -25,7 +25,7 @@ #ifndef _LIBRSVG_HELPER_H_ #define _LIBRSVG_HELPER_H_ -#include +#include #include #include diff --git a/lua/rsvg.pkg b/lua/rsvg.pkg index 22791744..538c5f90 100644 --- a/lua/rsvg.pkg +++ b/lua/rsvg.pkg @@ -42,8 +42,9 @@ Author: Carl Worth */ -$#include +$#include $#include +$#include "librsvg-helper.h" typedef struct _RsvgHandle RsvgHandle; typedef struct RsvgHandlePrivate RsvgHandlePrivate; @@ -62,7 +63,8 @@ typedef struct _RsvgDimensionData { double em; double ex; static tolua_outside RsvgDimensionData * rsvgDimensionDataCreate @ create(); - tolua_outside rsvgDimensionDataGet @ get(int width, int height, double em, double ex); + tolua_outside void rsvgDimensionDataGet @ get(int * width, int * height, + double * em, double * ex); } RsvgDimensionData; /** @@ -73,7 +75,7 @@ typedef struct _RsvgPositionData { int x; int y; static tolua_outside RsvgPositionData * rsvgPositionDataCreate @ create(); - tolua_outside rsvgPositionDataGet @ get(int x, int y); + tolua_outside void rsvgPositionDataGet @ get(int * x, int * y); } RsvgPositionData; RsvgHandle *rsvg_handle_new (void); @@ -101,3 +103,6 @@ int rsvg_handle_render_cairo_sub (RsvgHandle * handle, cairo_t * cr, con void g_type_init(void); void g_object_unref(gpointer object); + +RsvgHandle * rsvg_create_handle_from_file(const char *); +int rsvg_destroy_handle(RsvgHandle *); From 550d644e6c05682951aede8c1935201c4f826331 Mon Sep 17 00:00:00 2001 From: Jochen Keil Date: Wed, 22 May 2013 22:21:29 +0200 Subject: [PATCH 8/8] Add rsvg bindings to cmake build framework --- cmake/ConkyBuildOptions.cmake | 1 + cmake/ConkyPlatformChecks.cmake | 6 ++++++ cmake/config.h.in | 4 +++- lua/CMakeLists.txt | 11 +++++++++++ 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/cmake/ConkyBuildOptions.cmake b/cmake/ConkyBuildOptions.cmake index a7e512a4..dc428890 100644 --- a/cmake/ConkyBuildOptions.cmake +++ b/cmake/ConkyBuildOptions.cmake @@ -124,6 +124,7 @@ endif(OWN_WINDOW) option(BUILD_LUA_CAIRO "Build cairo bindings for Lua" false) option(BUILD_LUA_IMLIB2 "Build Imlib2 bindings for Lua" false) +option(BUILD_LUA_RSVG "Build rsvg bindings for Lua" false) option(BUILD_AUDACIOUS "Build audacious (music player) support" false) diff --git a/cmake/ConkyPlatformChecks.cmake b/cmake/ConkyPlatformChecks.cmake index e9cc1fae..7594ff24 100644 --- a/cmake/ConkyPlatformChecks.cmake +++ b/cmake/ConkyPlatformChecks.cmake @@ -252,6 +252,12 @@ if(BUILD_LUA_IMLIB2) set(luaimlib2_libs ${IMLIB2_LIB} ${LUA_LIBRARIES}) set(luaimlib2_includes ${IMLIB2_INCLUDE_PATH} ${LUA_INCLUDE_DIRS}) endif(BUILD_LUA_IMLIB2) +if(BUILD_LUA_RSVG) + set(WANT_TOLUA true) + pkg_check_modules(RSVG REQUIRED librsvg-2.0) + set(luarsvg_libs ${RSVG_LIBRARIES} ${LUA_LIBRARIES}) + set(luarsvg_includes ${RSVG_INCLUDE_DIRS} ${LUA_INCLUDE_DIRS}) +endif(BUILD_LUA_RSVG) if(BUILD_AUDACIOUS) set(WANT_GLIB true) diff --git a/cmake/config.h.in b/cmake/config.h.in index b9a8b024..2d3ef629 100644 --- a/cmake/config.h.in +++ b/cmake/config.h.in @@ -108,7 +108,9 @@ #cmakedefine BUILD_LUA_IMLIB2 1 -#if defined(BUILD_LUA_CAIRO) || defined(BUILD_LUA_IMLIB2) +#cmakedefine BUILD_LUA_RSVG 1 + +#if defined(BUILD_LUA_CAIRO) || defined(BUILD_LUA_IMLIB2) || defined(BUILD_LUA_RSVG) #define BUILD_LUA_EXTRAS #endif diff --git a/lua/CMakeLists.txt b/lua/CMakeLists.txt index 20dcaeaf..09a12fb4 100644 --- a/lua/CMakeLists.txt +++ b/lua/CMakeLists.txt @@ -52,6 +52,17 @@ if(BUILD_LUA_IMLIB2) set(lua_libs ${lua_libs} conky-imlib2) endif(BUILD_LUA_IMLIB2) +if(BUILD_LUA_RSVG) + include_directories(${luarsvg_includes} ${CMAKE_CURRENT_SOURCE_DIR}) + wrap_tolua(luarsvg_src rsvg.pkg) + + add_library(conky-rsvg SHARED ${luarsvg_src}) + set_target_properties(conky-rsvg PROPERTIES OUTPUT_NAME "rsvg") + + target_link_libraries(conky-rsvg ${luarsvg_libs} ${TOLUA_LIBS}) + set(lua_libs ${lua_libs} conky-rsvg) +endif(BUILD_LUA_RSVG) + install(TARGETS ${lua_libs} LIBRARY DESTINATION lib/conky