1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-17 18:45:10 +00:00

Compile tolua++ output as C++

This commit is contained in:
Brenden Matthews 2024-02-23 09:04:32 -05:00
parent 3bb8188785
commit e4bdabc538
4 changed files with 15 additions and 14 deletions

View File

@ -24,20 +24,20 @@ function(wrap_tolua VAR FIL)
get_filename_component(ABS_FIL ${FIL} ABSOLUTE) get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
get_filename_component(FIL_WE ${FIL} NAME_WE) get_filename_component(FIL_WE ${FIL} NAME_WE)
list(APPEND ${VAR} "${CMAKE_CURRENT_BINARY_DIR}/lib${FIL_WE}.c") list(APPEND ${VAR} "${CMAKE_CURRENT_BINARY_DIR}/lib${FIL_WE}.cc")
if(DEFINED ARGV2) if(DEFINED ARGV2)
get_filename_component(PATCH ${ARGV2} ABSOLUTE) get_filename_component(PATCH ${ARGV2} ABSOLUTE)
set(TOLUA_OUT ${CMAKE_CURRENT_BINARY_DIR}/lib${FIL_WE}-orig.c) set(TOLUA_OUT ${CMAKE_CURRENT_BINARY_DIR}/lib${FIL_WE}-orig.cc)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lib${FIL_WE}.c add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lib${FIL_WE}.cc
COMMAND ${APP_PATCH} -s ${TOLUA_OUT} ${PATCH} -o COMMAND ${APP_PATCH} -s ${TOLUA_OUT} ${PATCH} -o
${CMAKE_CURRENT_BINARY_DIR}/lib${FIL_WE}.c ${CMAKE_CURRENT_BINARY_DIR}/lib${FIL_WE}.cc
DEPENDS ${TOLUA_OUT} ${PATCH} DEPENDS ${TOLUA_OUT} ${PATCH}
COMMENT "Patching lib${FIL_WE}-orig.c" COMMENT "Patching lib${FIL_WE}-orig.cc"
VERBATIM) VERBATIM)
set_source_files_properties(${TOLUA_OUT} PROPERTIES GENERATED TRUE) set_source_files_properties(${TOLUA_OUT} PROPERTIES GENERATED TRUE)
else() else()
set(TOLUA_OUT ${CMAKE_CURRENT_BINARY_DIR}/lib${FIL_WE}.c) set(TOLUA_OUT ${CMAKE_CURRENT_BINARY_DIR}/lib${FIL_WE}.cc)
endif(DEFINED ARGV2) endif(DEFINED ARGV2)
# Call toluapp from 3rdparty/ path directly. The last argument to toluapp is # Call toluapp from 3rdparty/ path directly. The last argument to toluapp is
@ -54,7 +54,7 @@ function(wrap_tolua VAR FIL)
${${VAR}} ${${VAR}}
PROPERTIES PROPERTIES
COMPILE_FLAGS COMPILE_FLAGS
"-Wno-bad-function-cast -Wno-unused-parameter -Wno-cast-qual -Wno-error=pedantic" "-Wno-unused-parameter -Wno-cast-qual -Wno-error=pedantic"
) )
set(${VAR} ${${VAR}} PARENT_SCOPE) set(${VAR} ${${VAR}} PARENT_SCOPE)

View File

@ -26,17 +26,18 @@
#define _LIBCAIRO_HELPER_H_ #define _LIBCAIRO_HELPER_H_
#include <cairo.h> #include <cairo.h>
#include <cstdlib>
cairo_text_extents_t *create_cairo_text_extents_t(void) { cairo_text_extents_t *create_cairo_text_extents_t(void) {
return calloc(1, sizeof(cairo_text_extents_t)); return (cairo_text_extents_t *)calloc(1, sizeof(cairo_text_extents_t));
} }
cairo_font_extents_t *create_cairo_font_extents_t(void) { cairo_font_extents_t *create_cairo_font_extents_t(void) {
return calloc(1, sizeof(cairo_font_extents_t)); return (cairo_font_extents_t *)calloc(1, sizeof(cairo_font_extents_t));
} }
cairo_matrix_t *create_cairo_matrix_t(void) { cairo_matrix_t *create_cairo_matrix_t(void) {
return calloc(1, sizeof(cairo_matrix_t)); return (cairo_matrix_t *)calloc(1, sizeof(cairo_matrix_t));
} }
void destroy_cairo_text_extents_t(cairo_text_extents_t *pointer) { void destroy_cairo_text_extents_t(cairo_text_extents_t *pointer) {

View File

@ -36,7 +36,7 @@ void cairo_draw_image(const char *file, cairo_surface_t *cs, int x, int y,
Imlib_Image premul; Imlib_Image premul;
cairo_surface_t *result; cairo_surface_t *result;
cairo_t *cr; cairo_t *cr;
Imlib_Image *image = imlib_load_image(file); auto image = imlib_load_image(file);
if (!image) { return; } if (!image) { return; }
imlib_context_set_image(image); imlib_context_set_image(image);
@ -64,8 +64,8 @@ void cairo_draw_image(const char *file, cairo_surface_t *cs, int x, int y,
/* now pass the result to cairo */ /* now pass the result to cairo */
result = cairo_image_surface_create_for_data( result = cairo_image_surface_create_for_data(
(void *)imlib_image_get_data_for_reading_only(), CAIRO_FORMAT_ARGB32, (unsigned char *)imlib_image_get_data_for_reading_only(),
scaled_w, scaled_h, sizeof(DATA32) * scaled_w); CAIRO_FORMAT_ARGB32, scaled_w, scaled_h, sizeof(DATA32) * scaled_w);
cr = cairo_create(cs); cr = cairo_create(cs);
cairo_set_source_surface(cr, result, x, y); cairo_set_source_surface(cr, result, x, y);

View File

@ -93,7 +93,7 @@ int rsvg_destroy_handle(RsvgHandle *handle) {
} }
RsvgRectangle *rsvg_rectangle_create(void) { RsvgRectangle *rsvg_rectangle_create(void) {
return calloc(1, sizeof(RsvgRectangle)); return (RsvgRectangle *)calloc(1, sizeof(RsvgRectangle));
} }
void rsvg_rectangle_destroy(RsvgRectangle *rect) { free(rect); } void rsvg_rectangle_destroy(RsvgRectangle *rect) { free(rect); }