From e493d42def129ea597d4b6db659a6814cd3eeb96 Mon Sep 17 00:00:00 2001 From: Geert Janssens Date: Mon, 30 Sep 2019 20:41:54 +0200 Subject: [PATCH] Introduce gnucash-guile shared library This (currently empty) library is intented to become the standard api library for guile code that wants to use the libgnucash functionality. --- CMakeLists.txt | 2 +- bindings/guile/CMakeLists.txt | 22 +++++++++++++-- bindings/guile/gnc-guile-bindings.c | 43 +++++++++++++++++++++++++++++ po/POTFILES.in | 1 + 4 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 bindings/guile/gnc-guile-bindings.c diff --git a/CMakeLists.txt b/CMakeLists.txt index e5784612af..54e72a9bc0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -868,7 +868,7 @@ configure_file( add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) -set(_MODULES gnc-core-utils gnc-module gnc-backend-xml-utils) +set(_MODULES gnc-core-utils gnc-module gnc-backend-xml-utils gnucash-guile) if (WITH_SQL) list(APPEND _MODULES gnc-backend-sql) diff --git a/bindings/guile/CMakeLists.txt b/bindings/guile/CMakeLists.txt index 7d1aae9649..39dbf4337a 100644 --- a/bindings/guile/CMakeLists.txt +++ b/bindings/guile/CMakeLists.txt @@ -1,7 +1,23 @@ add_subdirectory(test) -set(GUILE_DEPENDS scm-core-utils scm-gnc-module gncmod-engine) +set(guile_HEADERS ) + +set(guile_SOURCES + gnc-guile-bindings.c) +set(guile_bindings_ALL_INCLUDES + ${CMAKE_BINARY_DIR}/common + ${CMAKE_CURRENT_SOURCE_DIR}) +add_library(gnucash-guile SHARED ${guile_SOURCES} ${guile_HEADERS}) +target_include_directories(gnucash-guile PUBLIC ${guile_bindings_ALL_INCLUDES}) + +install(TARGETS gnucash-guile + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) + +set(GUILE_DEPENDS scm-core-utils scm-gnc-module gncmod-engine) gnc_add_scheme_targets(scm-scm "utilities.scm" @@ -18,7 +34,9 @@ gnc_add_scheme_targets(price-quotes FALSE) -set_local_dist(guile_DIST_local CMakeLists.txt utilities.scm price-quotes.scm) +set_local_dist(guile_DIST_local CMakeLists.txt utilities.scm price-quotes.scm + ${guile_SOURCES} ${guile_HEADERS} +) set(guile_DIST ${guile_DIST_local} ${test_guile_DIST} PARENT_SCOPE) diff --git a/bindings/guile/gnc-guile-bindings.c b/bindings/guile/gnc-guile-bindings.c new file mode 100644 index 0000000000..42c3fe0852 --- /dev/null +++ b/bindings/guile/gnc-guile-bindings.c @@ -0,0 +1,43 @@ +/********************************************************************* + * gnc-guile-bindings.c + * library to enable guile bindings for libgnucash + * + * Copyright (c) 2019 GnuCash Development Team + *********************************************************************/ +/********************************************************************\ + * 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 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 General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License* + * along with this program; if not, contact: * + * * + * Free Software Foundation Voice: +1-617-542-5942 * + * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 * + * Boston, MA 02110-1301, USA gnu@gnu.org * + * * +\********************************************************************/ + + +#include +#include + +void gnc_guile_bindings_init(void); + +static int is_initialized = 0; + +void +gnc_guile_bindings_init(void) +{ + if (!is_initialized) + { + /* Do what's necessary to initialize the bindings */ + is_initialized = 1; + } +} diff --git a/po/POTFILES.in b/po/POTFILES.in index e55d034e53..aa9394cf56 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,5 +1,6 @@ # This is a list of files which contain translatable strings. # This file was autogenerated by cmake. +bindings/guile/gnc-guile-bindings.c bindings/guile/price-quotes.scm bindings/guile/utilities.scm borrowed/goffice/go-charmap-sel.c