2018-05-03 23:18:15 +02:00
|
|
|
add_subdirectory(example_scripts)
|
|
|
|
|
add_subdirectory(tests)
|
2016-08-26 13:59:33 -05:00
|
|
|
|
2018-05-03 23:18:15 +02:00
|
|
|
set(PYEXEC_FILES __init__.py function_class.py gnucash_business.py gnucash_core.py)
|
2017-11-19 17:28:41 -08:00
|
|
|
|
2018-01-29 18:04:08 +01:00
|
|
|
set(SWIG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/gnucash_core.i ${CMAKE_CURRENT_SOURCE_DIR}/time64.i)
|
|
|
|
|
set(GNUCASH_CORE_C_INCLUDES
|
2017-08-10 13:56:00 +02:00
|
|
|
${CONFIG_H}
|
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/engine/qofsession.h
|
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/engine/qofbook.h
|
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/engine/qofbackend.h
|
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/engine/qoflog.h
|
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/engine/qofutil.h
|
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/engine/qofid.h
|
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/engine/guid.h
|
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/gnc-module/gnc-module.h
|
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/engine/gnc-engine.h
|
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/engine/Transaction.h
|
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/engine/Split.h
|
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/engine/Account.h
|
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/engine/gnc-commodity.h
|
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/engine/gnc-lot.h
|
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/engine/gnc-numeric.h
|
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/engine/gncCustomer.h
|
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/engine/gncEmployee.h
|
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/engine/gncVendor.h
|
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/engine/gncAddress.h
|
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/engine/gncBillTerm.h
|
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/engine/gncOwner.h
|
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/engine/gncInvoice.h
|
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/engine/gncJob.h
|
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/engine/gncEntry.h
|
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/engine/gncTaxTable.h
|
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/engine/gncIDSearch.h
|
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/engine/gnc-pricedb.h
|
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/app-utils/gnc-prefs-utils.h
|
2018-01-29 18:04:08 +01:00
|
|
|
)
|
2016-08-26 13:59:33 -05:00
|
|
|
|
2018-01-29 18:04:08 +01:00
|
|
|
gnc_add_swig_python_command (swig-gnucash-core
|
|
|
|
|
SWIG_GNUCASH_CORE_C SWIG_GNUCASH_CORE_PY
|
|
|
|
|
gnucash_core.c gnucash_core_c.py
|
2016-08-26 13:59:33 -05:00
|
|
|
${SWIG_FILES}
|
2019-09-30 22:31:46 +02:00
|
|
|
""
|
2017-08-10 13:56:00 +02:00
|
|
|
${CMAKE_SOURCE_DIR}/common/base-typemaps.i
|
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/engine/engine-common.i
|
2016-08-26 13:59:33 -05:00
|
|
|
${GNUCASH_CORE_C_INCLUDES}
|
2018-01-29 18:04:08 +01:00
|
|
|
)
|
2016-08-26 13:59:33 -05:00
|
|
|
|
2018-05-03 23:18:15 +02:00
|
|
|
if(WITH_PYTHON)
|
2016-08-26 13:59:33 -05:00
|
|
|
|
2018-05-03 23:18:15 +02:00
|
|
|
set(gnucash_core_c_INCLUDE_DIRS
|
2017-08-10 13:56:00 +02:00
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash
|
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/engine
|
|
|
|
|
${CMAKE_SOURCE_DIR}/gnucash/gnome-utils
|
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/app-utils
|
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/gnc-module
|
|
|
|
|
${CMAKE_SOURCE_DIR}/gnucash/gnome
|
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/core-utils
|
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/gnc-module
|
2016-08-26 13:59:33 -05:00
|
|
|
${GLIB_INCLUDE_DIRS}
|
|
|
|
|
${PYTHON_INCLUDE_DIRS}
|
|
|
|
|
)
|
|
|
|
|
|
2018-05-03 23:18:15 +02:00
|
|
|
add_library(gnucash_core_c MODULE ${SWIG_GNUCASH_CORE_C})
|
|
|
|
|
target_include_directories(gnucash_core_c PRIVATE ${gnucash_core_c_INCLUDE_DIRS})
|
2016-08-26 13:59:33 -05:00
|
|
|
|
2018-05-03 23:18:15 +02:00
|
|
|
target_link_libraries(gnucash_core_c gncmod-app-utils gncmod-engine gnc-module ${GLIB_LIBS} ${PYTHON_LIBRARIES})
|
|
|
|
|
set_target_properties(gnucash_core_c PROPERTIES PREFIX "_")
|
|
|
|
|
target_compile_options(gnucash_core_c PRIVATE -Wno-implicit -Wno-missing-prototypes -Wno-declaration-after-statement -Wno-missing-declarations)
|
2018-05-09 17:20:13 +02:00
|
|
|
if (HAVE_STRINGOP_TRUNCATION)
|
|
|
|
|
target_compile_options(gnucash_core_c PRIVATE -Wno-error=stringop-truncation)
|
|
|
|
|
endif()
|
2016-08-26 13:59:33 -05:00
|
|
|
|
2018-05-03 23:18:15 +02:00
|
|
|
add_executable(sqlite3test EXCLUDE_FROM_ALL sqlite3test.c ${SWIG_GNUCASH_CORE_C})
|
|
|
|
|
target_link_libraries(sqlite3test gncmod-app-utils gncmod-engine gnc-module ${GLIB_LIBS} ${PYTHON_LIBRARIES})
|
|
|
|
|
target_include_directories(sqlite3test PRIVATE ${gnucash_core_c_INCLUDE_DIRS})
|
|
|
|
|
target_compile_options(sqlite3test PRIVATE -Wno-implicit -Wno-missing-prototypes -Wno-declaration-after-statement -Wno-missing-declarations)
|
2018-05-09 17:20:13 +02:00
|
|
|
if (HAVE_STRINGOP_TRUNCATION)
|
|
|
|
|
target_compile_options(sqlite3test PRIVATE -Wno-error=stringop-truncation)
|
|
|
|
|
endif()
|
2016-08-26 13:59:33 -05:00
|
|
|
|
2018-05-03 23:18:15 +02:00
|
|
|
add_test(NAME sqlite3test COMMAND sqlite3test)
|
|
|
|
|
add_dependencies(check sqlite3test)
|
2016-08-26 13:59:33 -05:00
|
|
|
|
2018-05-03 23:18:15 +02:00
|
|
|
install(TARGETS gnucash_core_c
|
2016-08-26 13:59:33 -05:00
|
|
|
LIBRARY DESTINATION ${PYTHON_SYSCONFIG_OUTPUT}/gnucash
|
|
|
|
|
ARCHIVE DESTINATION ${PYTHON_SYSCONFIG_OUTPUT}/gnucash
|
|
|
|
|
)
|
2018-05-03 23:18:15 +02:00
|
|
|
install(FILES ${PYEXEC_FILES} ${SWIG_GNUCASH_CORE_PY}
|
2016-08-26 13:59:33 -05:00
|
|
|
DESTINATION ${PYTHON_SYSCONFIG_OUTPUT}/gnucash
|
|
|
|
|
)
|
|
|
|
|
|
2018-05-03 23:18:15 +02:00
|
|
|
file(COPY ${PYEXEC_FILES} DESTINATION ${PYTHON_SYSCONFIG_BUILD}/gnucash)
|
2017-09-08 09:41:15 -05:00
|
|
|
|
2018-05-03 23:18:15 +02:00
|
|
|
add_custom_target(gnucash-core-c-py ALL
|
2018-01-29 12:19:47 +01:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${SWIG_GNUCASH_CORE_PY} ${PYTHON_SYSCONFIG_BUILD}/gnucash
|
2017-09-08 09:41:15 -05:00
|
|
|
DEPENDS ${SWIG_GNUCASH_CORE_C})
|
|
|
|
|
|
2018-05-03 23:18:15 +02:00
|
|
|
add_custom_target(gnucash-core-c-build ALL
|
2017-12-01 20:31:44 -08:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR_BUILD}/gnucash/_gnucash_core_c${CMAKE_SHARED_MODULE_SUFFIX} ${PYTHON_SYSCONFIG_BUILD}/gnucash
|
2017-09-11 15:44:41 -05:00
|
|
|
DEPENDS gnucash_core_c)
|
2017-02-01 21:48:46 -06:00
|
|
|
|
2018-05-03 23:18:15 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
set(python_bindings_DATA ${PYEXEC_FILES}
|
2017-11-19 17:28:41 -08:00
|
|
|
gnucash_core.i
|
|
|
|
|
sqlite3test.c
|
2018-01-20 12:32:42 -08:00
|
|
|
time64.i)
|
2017-02-01 21:48:46 -06:00
|
|
|
|
2018-05-03 23:18:15 +02:00
|
|
|
set_local_dist(python_bindings_DIST_local CMakeLists.txt
|
2017-11-19 17:28:41 -08:00
|
|
|
${python_bindings_DATA})
|
2017-02-01 21:48:46 -06:00
|
|
|
|
2018-05-03 23:18:15 +02:00
|
|
|
set(python_bindings_DIST ${python_bindings_DIST_local}
|
2017-11-19 17:28:41 -08:00
|
|
|
${test_python_bindings_DIST} ${example_scripts_DIST} PARENT_SCOPE)
|