mirror of
				https://github.com/Gnucash/gnucash.git
				synced 2025-02-25 18:55:30 -06:00 
			
		
		
		
	Convert gncmod-csv-import/export into ordinary libraries
As with qif-import use gnucash plugin interface to initialize the code.
This commit is contained in:
		| @@ -53,7 +53,7 @@ endif() | ||||
| target_link_libraries (gnucash | ||||
|    gnc-ledger-core gnc-gnome gnc-gnome-utils gnc-app-utils | ||||
|    gnc-engine gnc-module gnc-core-utils gncmod-report gnucash-guile | ||||
|    gnc-qif-import | ||||
|    gnc-qif-import gnc-csv-import gnc-csv-export | ||||
|    PkgConfig::GTK3 ${GUILE_LDFLAGS} ${GLIB2_LDFLAGS} ${GTK_MAC_LDFLAGS} | ||||
| ) | ||||
|  | ||||
|   | ||||
| @@ -50,6 +50,8 @@ | ||||
| #include "gnc-main-window.h" | ||||
| #include "gnc-splash.h" | ||||
| #include "gnc-gnome-utils.h" | ||||
| #include "gnc-plugin-csv-export.h" | ||||
| #include "gnc-plugin-csv-import.h" | ||||
| #include "gnc-plugin-file-history.h" | ||||
| #include "gnc-plugin-qif-import.h" | ||||
| #include "gnc-plugin-report-system.h" | ||||
| @@ -482,6 +484,8 @@ gnc_parse_command_line(int *argc, char ***argv) | ||||
| static void | ||||
| load_gnucash_plugins() | ||||
| { | ||||
|     gnc_plugin_csv_export_create_plugin(); | ||||
|     gnc_plugin_csv_import_create_plugin(); | ||||
|     gnc_plugin_qif_import_create_plugin (); | ||||
| } | ||||
|  | ||||
| @@ -497,8 +501,6 @@ load_gnucash_modules() | ||||
|     } modules[] = | ||||
|     { | ||||
|         { "gnucash/import-export/ofx", 0, TRUE }, | ||||
|         { "gnucash/import-export/csv-import", 0, TRUE }, | ||||
|         { "gnucash/import-export/csv-export", 0, TRUE }, | ||||
|         { "gnucash/import-export/log-replay", 0, TRUE }, | ||||
|         { "gnucash/import-export/aqbanking", 0, TRUE }, | ||||
|         { "gnucash/import-export/bi-import", 0, TRUE}, | ||||
|   | ||||
| @@ -1,5 +1,4 @@ | ||||
| set(csv_export_SOURCES | ||||
|   gncmod-csv-export.c | ||||
|   gnc-plugin-csv-export.c | ||||
|   assistant-csv-export.c | ||||
|   csv-tree-export.c | ||||
| @@ -16,18 +15,23 @@ set(csv_export_noinst_HEADERS | ||||
|   csv-transactions-export.h | ||||
| ) | ||||
|  | ||||
| add_library(gncmod-csv-export ${csv_export_noinst_HEADERS} ${csv_export_SOURCES}) | ||||
| add_library(gnc-csv-export ${csv_export_noinst_HEADERS} ${csv_export_SOURCES}) | ||||
|  | ||||
| target_link_libraries(gncmod-csv-export gnc-register-gnome gnc-register-core gnc-ledger-core gnc-engine | ||||
| target_link_libraries(gnc-csv-export gnc-register-gnome gnc-register-core gnc-ledger-core gnc-engine | ||||
|                          gnc-module gnc-gnome-utils gnc-gnome gnc-app-utils gnc-core-utils) | ||||
|  | ||||
| target_compile_definitions(gncmod-csv-export PRIVATE -DG_LOG_DOMAIN=\"gnc.export.csv\") | ||||
| target_include_directories(gnc-csv-export | ||||
|     PUBLIC | ||||
|         ${CMAKE_CURRENT_SOURCE_DIR} | ||||
| ) | ||||
|  | ||||
| target_compile_definitions(gnc-csv-export PRIVATE -DG_LOG_DOMAIN=\"gnc.export.csv\") | ||||
|  | ||||
| if (APPLE) | ||||
|   set_target_properties (gncmod-csv-export PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/gnucash") | ||||
|   set_target_properties (gnc-csv-export PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/gnucash") | ||||
| endif() | ||||
|  | ||||
| install(TARGETS gncmod-csv-export | ||||
| install(TARGETS gnc-csv-export | ||||
|   LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/gnucash | ||||
|   ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/gnucash | ||||
|   RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) | ||||
|   | ||||
| @@ -1,73 +0,0 @@ | ||||
| /********************************************************************\ | ||||
|  * 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                   * | ||||
| \********************************************************************/ | ||||
| /** @addtogroup Import_Export | ||||
|     @{ */ | ||||
| /**@internal | ||||
| @file gncmod-csv-export.c | ||||
| @brief module definition/initialization for the csv exporter | ||||
| @author Copyright (c) 2012 Robert Fewell | ||||
| */ | ||||
| #include <config.h> | ||||
|  | ||||
| #include <gmodule.h> | ||||
|  | ||||
| #include "gnc-module.h" | ||||
| #include "gnc-module-api.h" | ||||
| #include "gnc-plugin-csv-export.h" | ||||
|  | ||||
| GNC_MODULE_API_DECL(libgncmod_csv_export) | ||||
|  | ||||
| /* version of the gnc module system interface we require */ | ||||
| int libgncmod_csv_export_gnc_module_system_interface = 0; | ||||
|  | ||||
| /* module versioning uses libtool semantics. */ | ||||
| int libgncmod_csv_export_gnc_module_current  = 0; | ||||
| int libgncmod_csv_export_gnc_module_revision = 0; | ||||
| int libgncmod_csv_export_gnc_module_age      = 0; | ||||
|  | ||||
| //static GNCModule bus_core; | ||||
| //static GNCModule file; | ||||
|  | ||||
| char * | ||||
| libgncmod_csv_export_gnc_module_path(void) | ||||
| { | ||||
|     return g_strdup("gnucash/import-export/csv-export"); | ||||
| } | ||||
|  | ||||
| char * | ||||
| libgncmod_csv_export_gnc_module_description(void) | ||||
| { | ||||
|     return g_strdup("Gnome GUI and C code for CSV exporter."); | ||||
| } | ||||
|  | ||||
| int | ||||
| libgncmod_csv_export_gnc_module_init(int refcount) | ||||
| { | ||||
|     /* Add menu items with C callbacks */ | ||||
|     gnc_plugin_csv_export_create_plugin(); | ||||
|  | ||||
|     return TRUE; | ||||
| } | ||||
|  | ||||
| int | ||||
| libgncmod_csv_export_gnc_module_end(int refcount) | ||||
| { | ||||
|     return TRUE; | ||||
| } | ||||
| /** @}*/ | ||||
| @@ -7,7 +7,6 @@ set(csv_import_remote_SOURCES | ||||
| ) | ||||
|  | ||||
| set(csv_import_SOURCES | ||||
|   gncmod-csv-import.c | ||||
|   assistant-csv-account-import.c | ||||
|   assistant-csv-price-import.cpp | ||||
|   assistant-csv-trans-import.cpp | ||||
| @@ -58,12 +57,12 @@ set(csv_import_noinst_HEADERS | ||||
|   gnc-tokenizer-fw.hpp | ||||
| ) | ||||
|  | ||||
| add_library(gncmod-csv-import ${csv_import_noinst_HEADERS} | ||||
| add_library(gnc-csv-import ${csv_import_noinst_HEADERS} | ||||
|   ${csv_import_remote_HEADERS} ${csv_import_remote_SOURCES} ${csv_import_SOURCES} | ||||
| ) | ||||
|  | ||||
| target_link_libraries( | ||||
|   gncmod-csv-import | ||||
|   gnc-csv-import | ||||
|   ${Boost_LIBRARIES} | ||||
|   ${ICU4C_I18N_LDFLAGS} | ||||
|   gnc-generic-import | ||||
| @@ -74,18 +73,21 @@ target_link_libraries( | ||||
|   gnc-module) | ||||
|  | ||||
|  | ||||
| target_compile_definitions(gncmod-csv-import PRIVATE -DG_LOG_DOMAIN=\"gnc.import.csv\") | ||||
| target_compile_definitions(gnc-csv-import PRIVATE -DG_LOG_DOMAIN=\"gnc.import.csv\") | ||||
|  | ||||
| target_include_directories(gncmod-csv-import PRIVATE | ||||
|      ${ICU4C_I18N_INCLUDE_DIRS} | ||||
|      ${CMAKE_SOURCE_DIR}/borrowed/goffice | ||||
| target_include_directories(gnc-csv-import | ||||
|     PRIVATE | ||||
|         ${ICU4C_I18N_INCLUDE_DIRS} | ||||
|         ${CMAKE_SOURCE_DIR}/borrowed/goffice | ||||
|     PUBLIC | ||||
|         ${CMAKE_CURRENT_SOURCE_DIR} | ||||
| ) | ||||
|  | ||||
| if (APPLE) | ||||
|   set_target_properties (gncmod-csv-import PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/gnucash") | ||||
|   set_target_properties (gnc-csv-import PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/gnucash") | ||||
| endif() | ||||
|  | ||||
| install(TARGETS gncmod-csv-import | ||||
| install(TARGETS gnc-csv-import | ||||
|   LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/gnucash | ||||
|   ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/gnucash | ||||
|   RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) | ||||
|   | ||||
| @@ -1,73 +0,0 @@ | ||||
| /********************************************************************\ | ||||
|  * 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                   * | ||||
| \********************************************************************/ | ||||
| /** @addtogroup Import_Export | ||||
|     @{ */ | ||||
| /**@internal | ||||
| @file gncmod-csv-import.c | ||||
| @brief module definition/initialization for the csv importer | ||||
| @author Copyright (c) 2012 Robert Fewell | ||||
| */ | ||||
| #include <config.h> | ||||
|  | ||||
| #include <gmodule.h> | ||||
|  | ||||
| #include "gnc-module.h" | ||||
| #include "gnc-module-api.h" | ||||
| #include "gnc-plugin-csv-import.h" | ||||
|  | ||||
| GNC_MODULE_API_DECL(libgncmod_csv_import) | ||||
|  | ||||
| /* version of the gnc module system interface we require */ | ||||
| int libgncmod_csv_import_gnc_module_system_interface = 0; | ||||
|  | ||||
| /* module versioning uses libtool semantics. */ | ||||
| int libgncmod_csv_import_gnc_module_current  = 0; | ||||
| int libgncmod_csv_import_gnc_module_revision = 0; | ||||
| int libgncmod_csv_import_gnc_module_age      = 0; | ||||
|  | ||||
| //static GNCModule bus_core; | ||||
| //static GNCModule file; | ||||
|  | ||||
| char * | ||||
| libgncmod_csv_import_gnc_module_path(void) | ||||
| { | ||||
|     return g_strdup("gnucash/import-export/csv-import"); | ||||
| } | ||||
|  | ||||
| char * | ||||
| libgncmod_csv_import_gnc_module_description(void) | ||||
| { | ||||
|     return g_strdup("Gnome GUI and C code for CSV importer."); | ||||
| } | ||||
|  | ||||
| int | ||||
| libgncmod_csv_import_gnc_module_init(int refcount) | ||||
| { | ||||
|     /* Add menu items with C callbacks */ | ||||
|     gnc_plugin_csv_import_create_plugin(); | ||||
|  | ||||
|     return TRUE; | ||||
| } | ||||
|  | ||||
| int | ||||
| libgncmod_csv_import_gnc_module_end(int refcount) | ||||
| { | ||||
|     return TRUE; | ||||
| } | ||||
| /** @}*/ | ||||
| @@ -6,12 +6,12 @@ set(CSV_IMP_TEST_INCLUDE_DIRS | ||||
|   ${CMAKE_SOURCE_DIR}/common/test-core | ||||
|   ${GLIB2_INCLUDE_DIRS} | ||||
| ) | ||||
| set(CSV_IMP_TEST_LIBS gncmod-csv-import gnc-engine test-core) | ||||
| set(CSV_IMP_TEST_LIBS gnc-csv-import gnc-engine test-core) | ||||
|  | ||||
| # This test does not run in Win32 | ||||
| if (NOT WIN32) | ||||
|   set(MODULEPATH ${CMAKE_SOURCE_DIR}/gnucash/import-export/csv-imp) | ||||
|   set(gtest_csv_imp_LIBS gncmod-csv-import ${GLIB2_LDFLAGS} gtest) | ||||
|   set(gtest_csv_imp_LIBS gnc-csv-import ${GLIB2_LDFLAGS} gtest) | ||||
|   set(gtest_csv_imp_INCLUDES | ||||
|     ${MODULEPATH} | ||||
|     ${CSV_IMP_TEST_INCLUDE_DIRS}) | ||||
|   | ||||
| @@ -296,7 +296,6 @@ gnucash/import-export/bi-import/gnc-plugin-bi-import.c | ||||
| gnucash/import-export/csv-exp/assistant-csv-export.c | ||||
| gnucash/import-export/csv-exp/csv-transactions-export.c | ||||
| gnucash/import-export/csv-exp/csv-tree-export.c | ||||
| gnucash/import-export/csv-exp/gncmod-csv-export.c | ||||
| gnucash/import-export/csv-exp/gnc-plugin-csv-export.c | ||||
| gnucash/import-export/csv-imp/assistant-csv-account-import.c | ||||
| gnucash/import-export/csv-imp/assistant-csv-price-import.cpp | ||||
| @@ -311,7 +310,6 @@ gnucash/import-export/csv-imp/gnc-imp-props-tx.cpp | ||||
| gnucash/import-export/csv-imp/gnc-imp-settings-csv.cpp | ||||
| gnucash/import-export/csv-imp/gnc-imp-settings-csv-price.cpp | ||||
| gnucash/import-export/csv-imp/gnc-imp-settings-csv-tx.cpp | ||||
| gnucash/import-export/csv-imp/gncmod-csv-import.c | ||||
| gnucash/import-export/csv-imp/gnc-plugin-csv-import.c | ||||
| gnucash/import-export/csv-imp/gnc-tokenizer.cpp | ||||
| gnucash/import-export/csv-imp/gnc-tokenizer-csv.cpp | ||||
|   | ||||
		Reference in New Issue
	
	Block a user