Add python renderer to plugins

This commit is contained in:
Mario Hüttel 2019-11-16 14:54:58 +01:00
parent 1b1f742ae1
commit ebce4a2669
5 changed files with 38 additions and 5 deletions

View File

@ -40,7 +40,7 @@ IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-DGETTEXT_PACKAGE=\"gds-render\" -DLOCALEDATADIR=\"${CMAKE_CURRENT_BINARY_DIR}/translations/output\")
message("${BoldMagenta}${CMAKE_CURRENT_BINARY_DIR}/translations/output used as data dir${ColorReset}")
else(CMAKE_BUILD_TYPE STREQUAL "Debug")
message("Global locale directory used. Make sure files in /usr/share/locale are available")
message("${BoldCyan}Global locale directory used. Make sure files in /usr/share/locale are available${ColorReset}")
add_definitions(-DGETTEXT_PACKAGE=\"gds-render\" -DLOCALEDATADIR=\"/usr/share\")
ENDIF(CMAKE_BUILD_TYPE STREQUAL "Debug")

View File

@ -1,2 +1,4 @@
add_subdirectory(plugin-example)
add_custom_target(plugins DEPENDS pluginexample)
add_subdirectory(python-renderer)
add_custom_target(plugins DEPENDS pluginexample pythonrenderer)

View File

@ -1,12 +1,11 @@
project(pluginexample)
cmake_minimum_required(VERSION 2.8)
find_package(PkgConfig REQUIRED)
pkg_search_module(PYTHON REQUIRED python3)
aux_source_directory(src SOURCES)
include_directories(${PYTHON_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/include)
link_libraries(${PYTHON_LDFLAGS} version)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
link_libraries(version)
add_library(${PROJECT_NAME} SHARED EXCLUDE_FROM_ALL ${SOURCES})
add_dependencies(${PROJECT_NAME} version)

View File

@ -0,0 +1,13 @@
project(pythonrenderer)
cmake_minimum_required(VERSION 2.8)
find_package(PkgConfig REQUIRED)
pkg_search_module(PYTHON REQUIRED python3)
aux_source_directory(src SOURCES)
include_directories(${PYTHON_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/include)
link_libraries(${PYTHON_LDFLAGS} version)
add_library(${PROJECT_NAME} SHARED EXCLUDE_FROM_ALL ${SOURCES})
add_dependencies(${PROJECT_NAME} version)

View File

@ -0,0 +1,19 @@
#include <stdio.h>
#include <glib.h>
#include <gds-render/gds-utils/gds-types.h>
#include <gds-render/output-renderers/external-renderer-interfaces.h>
int FUNC_DECL(EXTERNAL_LIBRARY_RENDER_FUNCTION)(struct gds_cell *toplevel, GList *layer_info_list, const char *output_file_name, double scale)
{
if (!toplevel)
return -1000;
printf("Rendering %s\n", toplevel->name);
return 0;
}
int FUNC_DECL(EXTERNAL_LIBRARY_INIT_FUNCTION)(const char *params, const char *version)
{
printf("Init with params: %s\ngds-render version: %s\n", params, version);
return 0;
}