diff --git a/CMakeLists.txt b/CMakeLists.txt index c8a4e11..76c5dc2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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") diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 5064828..558c0b0 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -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) diff --git a/plugins/plugin-example/CMakeLists.txt b/plugins/plugin-example/CMakeLists.txt index 6018e7b..3b24aa4 100644 --- a/plugins/plugin-example/CMakeLists.txt +++ b/plugins/plugin-example/CMakeLists.txt @@ -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) diff --git a/plugins/python-renderer/CMakeLists.txt b/plugins/python-renderer/CMakeLists.txt new file mode 100644 index 0000000..473f658 --- /dev/null +++ b/plugins/python-renderer/CMakeLists.txt @@ -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) + diff --git a/plugins/python-renderer/src/plugin-main.c b/plugins/python-renderer/src/plugin-main.c new file mode 100644 index 0000000..829daea --- /dev/null +++ b/plugins/python-renderer/src/plugin-main.c @@ -0,0 +1,19 @@ +#include +#include +#include +#include + +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; +}