2018-03-17 19:25:39 -05:00
|
|
|
# NB: Unit tests which require GSchemas should be made conditional on COMPILE_GSCHEMAS.
|
2018-05-03 16:18:15 -05:00
|
|
|
add_subdirectory(test)
|
2020-05-29 10:20:53 -05:00
|
|
|
add_subdirectory(mocks)
|
2020-07-06 14:24:49 -05:00
|
|
|
|
|
|
|
include (GncFindLibm)
|
|
|
|
|
2015-12-07 11:17:08 -06:00
|
|
|
# Build the library
|
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
set (app_utils_noinst_HEADERS
|
2015-12-07 11:17:08 -06:00
|
|
|
calculation/finvar.h
|
|
|
|
calculation/finproto.h
|
|
|
|
calculation/fin_spl_protos.h
|
|
|
|
calculation/fin_static_proto.h
|
2020-02-13 12:36:54 -06:00
|
|
|
gnc-option-impl.hpp
|
|
|
|
gnc-optiondb-impl.hpp
|
2015-12-07 11:17:08 -06:00
|
|
|
)
|
2010-03-14 16:01:32 -05:00
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
set (app_utils_HEADERS
|
2011-01-27 13:22:16 -06:00
|
|
|
QuickFill.h
|
2010-03-14 16:01:32 -05:00
|
|
|
file-utils.h
|
|
|
|
gfec.h
|
|
|
|
gnc-basic-gobject.h
|
|
|
|
gnc-account-merge.h
|
|
|
|
gnc-accounting-period.h
|
2011-02-10 15:49:12 -06:00
|
|
|
gnc-addr-quickfill.h
|
2011-01-27 13:22:16 -06:00
|
|
|
gnc-entry-quickfill.h
|
2010-03-14 16:10:26 -05:00
|
|
|
gnc-euro.h
|
2010-03-14 16:01:32 -05:00
|
|
|
gnc-exp-parser.h
|
2015-12-07 11:17:08 -06:00
|
|
|
gnc-gsettings.h
|
2010-03-14 16:01:32 -05:00
|
|
|
gnc-help-utils.h
|
|
|
|
gnc-helpers.h
|
2020-02-13 12:36:54 -06:00
|
|
|
gnc-option.hpp
|
|
|
|
gnc-optiondb.hpp
|
2015-12-07 11:17:08 -06:00
|
|
|
gnc-prefs-utils.h
|
2020-02-13 12:36:54 -06:00
|
|
|
gnc-state.h
|
2010-03-14 16:01:32 -05:00
|
|
|
gnc-sx-instance-model.h
|
2010-03-14 16:10:26 -05:00
|
|
|
gnc-ui-util.h
|
2011-08-25 02:57:55 -05:00
|
|
|
gnc-ui-balances.h
|
2010-03-14 16:01:32 -05:00
|
|
|
option-util.h
|
|
|
|
)
|
|
|
|
|
2018-01-29 11:54:13 -06:00
|
|
|
# Command to generate the swig-app-utils-guile.c wrapper file
|
2020-02-13 12:36:54 -06:00
|
|
|
set(SWIG_ARGS "-c++" "-procdoc" "sw-gnc-option-doc" "-procdocformat" "plain")
|
|
|
|
gnc_add_swig_guile_command (swig-apputils-guile-cpp
|
|
|
|
SWIG_APP_UTILS_GUILE_CPP swig-app-utils-guile.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/app-utils.i
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/gnc-optiondb.i ""
|
2018-01-29 11:54:13 -06:00
|
|
|
)
|
2020-02-13 12:36:54 -06:00
|
|
|
unset(SWIG_ARGS)
|
2017-02-01 21:48:46 -06:00
|
|
|
|
2018-01-29 11:54:13 -06:00
|
|
|
# Command to generate the swig-app-utils-python.c wrapper file
|
2018-01-29 11:04:08 -06:00
|
|
|
gnc_add_swig_python_command (swig-app-utils-python
|
|
|
|
SWIG_APP_UTILS_PYTHON_C SWIG_APP_UTILS_PYTHON_PY
|
|
|
|
swig-app-utils-python.c sw_app_utils.py
|
2019-09-30 15:31:46 -05:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/app-utils.i ""
|
2018-01-29 11:04:08 -06:00
|
|
|
)
|
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
set (app_utils_SOURCES
|
2012-03-13 08:18:51 -05:00
|
|
|
calculation/expression_parser.c
|
|
|
|
calculation/fin.c
|
2011-01-27 13:22:16 -06:00
|
|
|
QuickFill.c
|
2010-03-14 16:01:32 -05:00
|
|
|
file-utils.c
|
|
|
|
gfec.c
|
|
|
|
gnc-account-merge.c
|
|
|
|
gnc-accounting-period.c
|
2011-02-10 15:49:12 -06:00
|
|
|
gnc-addr-quickfill.c
|
2011-01-27 13:22:16 -06:00
|
|
|
gnc-entry-quickfill.c
|
2010-03-14 16:10:26 -05:00
|
|
|
gnc-euro.c
|
2010-03-14 16:01:32 -05:00
|
|
|
gnc-exp-parser.c
|
2015-12-07 11:17:08 -06:00
|
|
|
gnc-gsettings.c
|
2010-03-14 16:01:32 -05:00
|
|
|
gnc-helpers.c
|
2020-02-13 12:36:54 -06:00
|
|
|
gnc-option.cpp
|
|
|
|
gnc-option-impl.cpp
|
|
|
|
gnc-optiondb.cpp
|
2015-12-07 11:17:08 -06:00
|
|
|
gnc-prefs-utils.c
|
2010-03-14 16:01:32 -05:00
|
|
|
gnc-sx-instance-model.c
|
2015-12-07 11:17:08 -06:00
|
|
|
gnc-state.c
|
2010-03-14 16:10:26 -05:00
|
|
|
gnc-ui-util.c
|
2011-08-25 02:57:55 -05:00
|
|
|
gnc-ui-balances.c
|
2010-03-14 16:01:32 -05:00
|
|
|
option-util.c
|
2020-07-06 14:24:49 -05:00
|
|
|
)
|
2010-03-14 16:01:32 -05:00
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
set_source_files_properties (${app_utils_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
|
2015-12-07 11:17:08 -06:00
|
|
|
|
2020-07-06 14:24:49 -05:00
|
|
|
gnc_check_standard_math_library()
|
|
|
|
if (NOT STANDARD_MATH_LIBRARY_FOUND)
|
|
|
|
message(FATAL_ERROR "An implementation of the standard C function pow() is required and is supported neither by the C runtime nor libm.so.")
|
|
|
|
endif()
|
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
set(app_utils_ALL_SOURCES ${app_utils_SOURCES} ${app_utils_HEADERS} ${app_utils_noinst_HEADERS})
|
2019-10-01 04:57:56 -05:00
|
|
|
set(app_utils_ALL_LIBRARIES
|
2019-11-24 11:30:33 -06:00
|
|
|
gnc-engine
|
2019-11-26 14:30:28 -06:00
|
|
|
gnc-locale-tax
|
2019-10-01 04:57:56 -05:00
|
|
|
gnucash-guile
|
2020-02-18 16:27:41 -06:00
|
|
|
${GLIB_LDFLAGS}
|
2019-10-01 04:57:56 -05:00
|
|
|
${GIO_LDFLAGS}
|
|
|
|
${LIBXML2_LDFLAGS}
|
2020-07-06 14:24:49 -05:00
|
|
|
${LIBXSLT_LDFLAGS}
|
|
|
|
${STANDARD_MATH_LIBRARY}
|
|
|
|
)
|
|
|
|
|
2019-10-01 04:57:56 -05:00
|
|
|
set(app_utils_ALL_INCLUDES
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/calculation
|
|
|
|
${GIO_INCLUDE_DIRS}
|
|
|
|
${LIBXML2_INCLUDE_DIRS}
|
|
|
|
${LIBXSLT_INCLUDE_DIRS}
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/backend
|
|
|
|
${CMAKE_SOURCE_DIR}/libgnucash/engine)
|
2015-12-07 11:17:08 -06:00
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
if (WIN32)
|
|
|
|
list(APPEND app_utils_ALL_SOURCES gnc-help-utils.c)
|
|
|
|
list(APPEND app_utils_ALL_LIBRARIES ${HTMLHELP_LIBRARY})
|
|
|
|
list(APPEND app_utils_ALL_INCLUDES ${HTMLHELP_INCLUDE_PATH})
|
|
|
|
endif()
|
2015-12-07 11:17:08 -06:00
|
|
|
|
2017-02-01 21:48:46 -06:00
|
|
|
|
2020-02-13 12:36:54 -06:00
|
|
|
add_library (gnc-app-utils ${app_utils_ALL_SOURCES} ${SWIG_APP_UTILS_GUILE_CPP})
|
2019-11-26 11:27:13 -06:00
|
|
|
target_link_libraries(gnc-app-utils ${app_utils_ALL_LIBRARIES})
|
2015-12-07 11:17:08 -06:00
|
|
|
|
2019-11-26 11:27:13 -06:00
|
|
|
target_include_directories (gnc-app-utils
|
2020-04-24 15:16:24 -05:00
|
|
|
PUBLIC
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
${GLIB2_INCLUDE_DIRS}
|
|
|
|
PRIVATE
|
|
|
|
${app_utils_ALL_INCLUDES}
|
2015-12-07 11:17:08 -06:00
|
|
|
)
|
2019-11-26 11:27:13 -06:00
|
|
|
target_compile_definitions (gnc-app-utils PRIVATE -DG_LOG_DOMAIN=\"gnc.app-utils\")
|
2015-12-07 11:17:08 -06:00
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
if (APPLE)
|
2020-04-28 12:30:22 -05:00
|
|
|
set_target_properties (gnc-app-utils PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}")
|
2018-05-03 16:18:15 -05:00
|
|
|
endif()
|
2017-10-15 15:22:29 -05:00
|
|
|
|
2019-11-26 11:27:13 -06:00
|
|
|
install(TARGETS gnc-app-utils
|
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
2017-11-28 16:25:35 -06:00
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
2015-12-07 11:17:08 -06:00
|
|
|
)
|
2016-08-26 13:59:33 -05:00
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
if (WITH_PYTHON)
|
|
|
|
set(PYEXEC_FILES sw_app_utils.py)
|
|
|
|
add_library (sw_app_utils MODULE ${SWIG_APP_UTILS_PYTHON_C})
|
2016-08-26 13:59:33 -05:00
|
|
|
|
2019-11-26 11:27:13 -06:00
|
|
|
target_link_libraries(sw_app_utils gnc-app-utils ${app_utils_ALL_LIBRARIES} ${PYTHON_LIBRARIES})
|
2018-05-03 16:18:15 -05:00
|
|
|
set_target_properties(sw_app_utils PROPERTIES PREFIX "_")
|
2018-05-09 10:20:13 -05:00
|
|
|
if (HAVE_STRINGOP_TRUNCATION)
|
|
|
|
target_compile_options(sw_app_utils PRIVATE -Wno-error=stringop-truncation)
|
|
|
|
endif()
|
2016-08-26 13:59:33 -05:00
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
target_include_directories (sw_app_utils
|
2016-08-26 13:59:33 -05:00
|
|
|
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
PRIVATE ${app_utils_ALL_INCLUDES} ${PYTHON_INCLUDE_DIRS}
|
|
|
|
)
|
2018-05-03 16:18:15 -05:00
|
|
|
target_compile_definitions (sw_app_utils PRIVATE -DG_LOG_DOMAIN=\"gnc.app-utils\")
|
2016-08-26 13:59:33 -05:00
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
if (APPLE)
|
2019-11-26 11:27:13 -06:00
|
|
|
set_target_properties (sw_app_utils PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}")
|
2018-05-03 16:18:15 -05:00
|
|
|
endif()
|
2017-10-15 15:22:29 -05:00
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
install(TARGETS sw_app_utils
|
2018-03-18 13:59:13 -05:00
|
|
|
LIBRARY DESTINATION ${PYTHON_SYSCONFIG_OUTPUT}/gnucash
|
|
|
|
ARCHIVE DESTINATION ${PYTHON_SYSCONFIG_OUTPUT}/gnucash
|
2016-08-26 13:59:33 -05:00
|
|
|
)
|
2018-03-18 13:59:13 -05:00
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
add_custom_target(sw-app-utils-py ALL
|
2018-03-18 13:59:13 -05:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${SWIG_APP_UTILS_PYTHON_PY} ${PYTHON_SYSCONFIG_BUILD}/gnucash
|
|
|
|
DEPENDS ${SWIG_APP_UTILS_PYTHON_C})
|
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
add_custom_target(sw-app-utils-build ALL
|
2018-03-18 13:59:13 -05:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR_BUILD}/gnucash/_sw_app_utils${CMAKE_SHARED_MODULE_SUFFIX} ${PYTHON_SYSCONFIG_BUILD}/gnucash
|
|
|
|
DEPENDS sw_app_utils)
|
2016-08-26 13:59:33 -05:00
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
endif()
|
2016-08-26 13:59:33 -05:00
|
|
|
|
|
|
|
|
2015-12-07 11:17:08 -06:00
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
install(FILES ${app_utils_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gnucash)
|
2015-12-07 11:17:08 -06:00
|
|
|
|
|
|
|
# And now handle scheme files
|
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
set (app_utils_SCHEME_1
|
2015-12-07 11:17:08 -06:00
|
|
|
c-interface.scm
|
|
|
|
date-utilities.scm
|
2018-02-19 12:25:50 -06:00
|
|
|
fin.scm
|
2015-12-07 11:17:08 -06:00
|
|
|
)
|
|
|
|
|
2020-12-23 20:43:07 -06:00
|
|
|
set (app_utils_SCHEME_1a
|
|
|
|
options.scm
|
|
|
|
)
|
|
|
|
|
|
|
|
set (app_utils_SCHEME_1b
|
|
|
|
business-options.scm
|
|
|
|
)
|
|
|
|
|
|
|
|
set (app_utils_SCHEME_1c
|
|
|
|
business-prefs.scm
|
|
|
|
)
|
|
|
|
|
2019-06-08 11:04:50 -05:00
|
|
|
set (app_utils_SCHEME_2
|
|
|
|
app-utils.scm
|
2015-12-07 11:17:08 -06:00
|
|
|
)
|
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
set(GUILE_DEPENDS
|
2020-04-24 15:16:24 -05:00
|
|
|
gnc-app-utils
|
|
|
|
scm-core-utils
|
|
|
|
scm-engine)
|
2015-12-07 11:17:08 -06:00
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
gnc_add_scheme_targets(scm-app-utils-1
|
2020-03-08 16:29:01 -05:00
|
|
|
SOURCES "${app_utils_SCHEME_1}"
|
|
|
|
OUTPUT_DIR "gnucash/app-utils"
|
|
|
|
DEPENDS "${GUILE_DEPENDS}"
|
|
|
|
MAKE_LINKS)
|
2020-12-23 20:43:07 -06:00
|
|
|
|
|
|
|
gnc_add_scheme_targets(scm-app-utils-1a
|
|
|
|
SOURCES "${app_utils_SCHEME_1a}"
|
2020-12-03 08:31:13 -06:00
|
|
|
OUTPUT_DIR "gnucash/app-utils"
|
2020-12-13 18:57:48 -06:00
|
|
|
DEPENDS "scm-app-utils-1"
|
|
|
|
MAKE_LINKS)
|
2015-12-07 11:17:08 -06:00
|
|
|
|
2020-12-23 20:43:07 -06:00
|
|
|
gnc_add_scheme_targets(scm-app-utils-1b
|
|
|
|
SOURCES "${app_utils_SCHEME_1b}"
|
|
|
|
OUTPUT_DIR "gnucash/app-utils"
|
|
|
|
DEPENDS "scm-app-utils-1a"
|
|
|
|
MAKE_LINKS)
|
|
|
|
|
|
|
|
gnc_add_scheme_targets(scm-bus-prefs
|
|
|
|
SOURCES "${app_utils_SCHEME_1c}"
|
|
|
|
OUTPUT_DIR "gnucash/app-utils"
|
|
|
|
DEPENDS "scm-app-utils-1b"
|
|
|
|
MAKE_LINKS)
|
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
gnc_add_scheme_targets(scm-app-utils-2
|
2020-03-08 16:29:01 -05:00
|
|
|
SOURCES "${app_utils_SCHEME_2}"
|
|
|
|
OUTPUT_DIR "gnucash"
|
2020-12-13 18:57:48 -06:00
|
|
|
DEPENDS "scm-bus-prefs"
|
|
|
|
MAKE_LINKS)
|
2015-12-07 11:17:08 -06:00
|
|
|
|
2019-11-10 11:15:34 -06:00
|
|
|
add_custom_target(scm-app-utils ALL DEPENDS scm-app-utils-2 scm-app-utils-1)
|
2017-02-01 21:48:46 -06:00
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
set_local_dist(app_utils_DIST_local
|
2020-12-23 20:43:07 -06:00
|
|
|
${app_utils_ALL_SOURCES}
|
|
|
|
${app_utils_SCHEME_1}
|
|
|
|
${app_utils_SCHEME_1a}
|
|
|
|
${app_utils_SCHEME_1b}
|
|
|
|
${app_utils_SCHEME_1c}
|
|
|
|
${app_utils_SCHEME_2}
|
|
|
|
${app_utils_SCHEME_3}
|
|
|
|
app-utils.i CMakeLists.txt gnc-help-utils.c)
|
|
|
|
|
2020-05-29 10:20:53 -05:00
|
|
|
set(app_utils_DIST
|
|
|
|
${app_utils_DIST_local}
|
|
|
|
${test_app_utils_DIST}
|
|
|
|
${app_utils_mocks_DIST}
|
|
|
|
PARENT_SCOPE)
|