2017-08-10 06:56:00 -05:00
|
|
|
# CMakeLists.txt for libgnucash/core-utils
|
2010-02-24 13:44:59 -06:00
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
add_subdirectory(test)
|
2016-08-26 13:59:33 -05:00
|
|
|
|
2018-01-29 11:54:13 -06:00
|
|
|
# Command to generate the swig-core-utils-guile.c wrapper file
|
|
|
|
gnc_add_swig_guile_command (swig-core-utils-guile-c
|
|
|
|
SWIG_CORE_UTILS_GUILE_C swig-core-utils-guile.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/core-utils.i
|
|
|
|
)
|
2010-02-24 13:44:59 -06:00
|
|
|
|
2018-01-29 11:54:13 -06:00
|
|
|
# Command to generate the swig-core-utils-python.c wrapper file
|
2018-01-29 11:04:08 -06:00
|
|
|
gnc_add_swig_python_command (swig-core-utils-python
|
|
|
|
SWIG_CORE_UTILS_PYTHON_C SWIG_CORE_UTILS_PYTHON_PY
|
|
|
|
swig-core-utils-python.c sw_core_utils.py
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/core-utils.i
|
|
|
|
)
|
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
set (core_utils_SOURCES
|
2010-03-04 13:50:45 -06:00
|
|
|
binreloc.c
|
2013-11-18 02:00:34 -06:00
|
|
|
gnc-prefs.c
|
2015-12-07 11:17:08 -06:00
|
|
|
gnc-environment.c
|
2017-08-22 09:33:34 -05:00
|
|
|
gnc-filepath-utils.cpp
|
2010-02-25 11:42:21 -06:00
|
|
|
gnc-gkeyfile-utils.c
|
|
|
|
gnc-glib-utils.c
|
2013-02-08 14:47:42 -06:00
|
|
|
gnc-guile-utils.c
|
2010-03-07 07:51:54 -06:00
|
|
|
gnc-jalali.c
|
2011-02-02 14:31:10 -06:00
|
|
|
gnc-locale-utils.c
|
2019-01-06 11:52:43 -06:00
|
|
|
gnc-locale-utils.cpp
|
2010-03-04 13:50:45 -06:00
|
|
|
gnc-path.c
|
2019-02-21 10:00:15 -06:00
|
|
|
gnc-version.c
|
2010-02-24 13:44:59 -06:00
|
|
|
)
|
|
|
|
|
2010-02-27 05:37:14 -06:00
|
|
|
# Add dependency on config.h
|
2018-05-03 16:18:15 -05:00
|
|
|
set_source_files_properties (${core_utils_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
|
2010-02-27 05:37:14 -06:00
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
set(prefix ${CMAKE_INSTALL_PREFIX})
|
2018-09-09 18:24:26 -05:00
|
|
|
set(datadir ${CMAKE_INSTALL_FULL_DATADIR})
|
|
|
|
set(bindir ${CMAKE_INSTALL_FULL_BINDIR})
|
|
|
|
set(libdir ${CMAKE_INSTALL_FULL_LIBDIR})
|
|
|
|
set(sysconfdir ${CMAKE_INSTALL_FULL_SYSCONFDIR})
|
|
|
|
set(localedir "${CMAKE_INSTALL_FULL_DATAROOTDIR}/locale")
|
2017-12-21 10:54:49 -06:00
|
|
|
configure_file(gncla-dir.h.in gncla-dir.h)
|
2015-12-07 11:17:08 -06:00
|
|
|
|
2019-08-24 09:32:56 -05:00
|
|
|
|
|
|
|
|
|
|
|
# ---
|
|
|
|
if (BUILDING_FROM_VCS)
|
|
|
|
set(VCS_INFO_BASE_DIR ${CMAKE_BINARY_DIR})
|
|
|
|
else()
|
|
|
|
set(VCS_INFO_BASE_DIR ${CMAKE_SOURCE_DIR})
|
|
|
|
endif()
|
|
|
|
set(VCS_INFO_FILE ${VCS_INFO_BASE_DIR}/libgnucash/core-utils/gnc-vcs-info.h CACHE STRING "path to gnc-vcs-dir")
|
|
|
|
|
2015-12-07 11:17:08 -06:00
|
|
|
### Create gnc-vcs-info.h
|
2017-10-04 16:01:03 -05:00
|
|
|
# This can only be done when building from a vcs (git/svn/bzr/svk) working directory.
|
|
|
|
# This file is shipped in the distribution tarball, so no need to generate it in that case anyway.
|
2015-12-07 11:17:08 -06:00
|
|
|
# The meta-cmake gymnastics here come from https://cmake.org/pipermail/cmake/2010-July/038015.html
|
2018-05-03 16:18:15 -05:00
|
|
|
if (BUILDING_FROM_VCS)
|
|
|
|
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h.in
|
2017-10-04 16:01:03 -05:00
|
|
|
"/* Autogenerated. Do not change. */
|
2017-10-05 15:47:11 -05:00
|
|
|
#define GNC_VCS_REV \"@GNC_VCS_REV@\"
|
|
|
|
#define GNC_VCS_REV_DATE \"@GNC_VCS_REV_DATE@\"
|
|
|
|
#define GNC_VCS_REV_YEAR \"@GNC_VCS_REV_YEAR@\"
|
|
|
|
#define GNC_VCS_REV_Y_M \"@GNC_VCS_REV_Y_M@\"
|
2017-10-04 16:01:03 -05:00
|
|
|
")
|
|
|
|
|
2019-08-24 05:42:19 -05:00
|
|
|
add_custom_target(gnc-vcs-info ALL
|
2017-02-01 21:48:46 -06:00
|
|
|
BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h
|
|
|
|
COMMAND ${CMAKE_COMMAND} -D SRC=${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h.in
|
2019-08-24 05:42:19 -05:00
|
|
|
-D DST=${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h
|
2019-08-24 08:33:24 -05:00
|
|
|
-D SRC_DIR=${CMAKE_SOURCE_DIR}
|
|
|
|
-D SHELL="${SHELL}"
|
|
|
|
-P ${CMAKE_SOURCE_DIR}/cmake/git2version-info.cmake
|
2019-08-24 05:42:19 -05:00
|
|
|
)
|
2020-01-30 05:20:25 -06:00
|
|
|
else()
|
2019-08-24 09:32:56 -05:00
|
|
|
add_custom_target(gnc-vcs-info DEPENDS ${VCS_INFO_FILE})
|
2020-01-30 05:20:25 -06:00
|
|
|
endif()
|
2018-01-31 09:16:59 -06:00
|
|
|
dist_add_generated (${BUILDING_FROM_VCS} gnc-vcs-info.h)
|
2015-12-07 11:17:08 -06:00
|
|
|
### Compile library
|
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
set(core_utils_noinst_HEADERS
|
2010-03-04 13:50:45 -06:00
|
|
|
binreloc.h
|
2013-11-18 02:00:34 -06:00
|
|
|
gnc-prefs.h
|
|
|
|
gnc-prefs-p.h
|
2015-12-07 11:17:08 -06:00
|
|
|
gnc-environment.h
|
2010-03-04 13:50:45 -06:00
|
|
|
gnc-filepath-utils.h
|
2010-02-25 11:42:21 -06:00
|
|
|
gnc-gkeyfile-utils.h
|
2010-02-24 13:44:59 -06:00
|
|
|
gnc-glib-utils.h
|
2013-02-08 14:47:42 -06:00
|
|
|
gnc-guile-utils.h
|
2010-03-07 07:51:54 -06:00
|
|
|
gnc-jalali.h
|
2011-02-02 14:31:10 -06:00
|
|
|
gnc-locale-utils.h
|
2019-01-06 11:52:43 -06:00
|
|
|
gnc-locale-utils.hpp
|
2010-03-04 13:50:45 -06:00
|
|
|
gnc-path.h
|
2019-02-21 10:00:15 -06:00
|
|
|
gnc-version.h
|
2010-02-24 13:44:59 -06:00
|
|
|
)
|
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
set(core_utils_ALL_SOURCES ${core_utils_SOURCES} ${core_utils_noinst_HEADERS})
|
|
|
|
set(core_utils_ALL_LIBRARIES ${Boost_LIBRARIES} ${GUILE_LDFLAGS} ${GLIB2_LDFLAGS} ${GOBJECT_LDFLAGS} ${GTK_MAC_LDFLAGS})
|
|
|
|
set(core_utils_ALL_INCLUDES
|
2017-08-10 06:56:00 -05:00
|
|
|
${CMAKE_SOURCE_DIR}/common
|
|
|
|
${CMAKE_BINARY_DIR}/common
|
2017-07-04 20:36:35 -05:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
2017-08-06 10:12:16 -05:00
|
|
|
${GLIB2_INCLUDE_DIRS}
|
2017-07-04 20:36:35 -05:00
|
|
|
${GUILE_INCLUDE_DIRS}
|
|
|
|
${GTK_MAC_INCLUDE_DIRS})
|
2016-08-26 13:59:33 -05:00
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
set_local_dist(core_utils_DIST_local ${core_utils_ALL_SOURCES} CMakeLists.txt core-utils.i core-utils.scm gncla-dir.h.in)
|
|
|
|
set(core_utils_DIST ${core_utils_DIST_local} ${test_core_utils_DIST} PARENT_SCOPE)
|
2016-08-26 13:59:33 -05:00
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
if (MAC_INTEGRATION)
|
|
|
|
list(APPEND core_utils_ALL_LIBRARIES ${OSX_EXTRA_LIBRARIES})
|
|
|
|
endif()
|
2016-08-26 13:59:33 -05:00
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
add_library(gnc-core-utils ${core_utils_ALL_SOURCES} ${SWIG_CORE_UTILS_GUILE_C})
|
2018-01-29 05:19:47 -06:00
|
|
|
add_dependencies(gnc-core-utils gnc-vcs-info swig-runtime-h)
|
2015-12-07 11:17:08 -06:00
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
target_link_libraries(gnc-core-utils ${core_utils_ALL_LIBRARIES})
|
2015-12-07 11:17:08 -06:00
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
target_compile_definitions(gnc-core-utils
|
2015-12-07 11:17:08 -06:00
|
|
|
PRIVATE -DG_LOG_DOMAIN=\"gnc.core-utils\" ${GTK_MAC_CFLAGS_OTHER})
|
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
target_include_directories(gnc-core-utils PUBLIC ${core_utils_ALL_INCLUDES})
|
2015-12-07 11:17:08 -06:00
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
if (MAC_INTEGRATION)
|
|
|
|
target_compile_options(gnc-core-utils PRIVATE ${OSX_EXTRA_COMPILE_FLAGS})
|
2020-01-30 05:20:25 -06:00
|
|
|
endif()
|
2019-02-21 10:00:15 -06:00
|
|
|
if (BUILDING_FROM_VCS)
|
|
|
|
target_compile_definitions(gnc-core-utils PRIVATE -DGNC_VCS=\"git\")
|
2020-01-30 05:20:25 -06:00
|
|
|
endif()
|
2015-12-07 11:17:08 -06:00
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
install(TARGETS gnc-core-utils
|
2017-11-28 16:25:35 -06:00
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
2016-08-26 13:59:33 -05:00
|
|
|
)
|
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
if (WITH_PYTHON)
|
|
|
|
add_library (sw_core_utils MODULE ${SWIG_CORE_UTILS_PYTHON_C})
|
2016-08-26 13:59:33 -05:00
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
target_link_libraries(sw_core_utils gnc-core-utils ${core_utils_ALL_LIBRARIES} ${PYTHON_LIBRARIES})
|
|
|
|
set_target_properties(sw_core_utils PROPERTIES PREFIX "_")
|
2016-08-26 13:59:33 -05:00
|
|
|
|
2018-05-09 10:20:13 -05:00
|
|
|
if (HAVE_STRINGOP_TRUNCATION)
|
|
|
|
target_compile_options(sw_core_utils PRIVATE -Wno-error=stringop-truncation)
|
|
|
|
endif()
|
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
target_include_directories (sw_core_utils
|
2018-03-18 13:59:13 -05:00
|
|
|
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
PRIVATE ${core_utils_ALL_INCLUDES} ${PYTHON_INCLUDE_DIRS}
|
2016-08-26 13:59:33 -05:00
|
|
|
)
|
2018-05-03 16:18:15 -05:00
|
|
|
target_compile_definitions (sw_core_utils PRIVATE -DG_LOG_DOMAIN=\"gnc.core-utils\")
|
2016-08-26 13:59:33 -05:00
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
if (CORELE)
|
|
|
|
set_target_properties (sw_core_utils PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/gnucash")
|
|
|
|
endif()
|
2016-08-26 13:59:33 -05:00
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
install(TARGETS sw_core_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-05-03 16:18:15 -05:00
|
|
|
add_custom_target(sw-core-utils-py ALL
|
2018-03-18 13:59:13 -05:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${SWIG_CORE_UTILS_PYTHON_PY} ${PYTHON_SYSCONFIG_BUILD}/gnucash
|
|
|
|
DEPENDS ${SWIG_CORE_UTILS_PYTHON_C})
|
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
add_custom_target(sw-core-utils-build ALL
|
2018-03-18 13:59:13 -05:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR_BUILD}/gnucash/_sw_core_utils${CMAKE_SHARED_MODULE_SUFFIX} ${PYTHON_SYSCONFIG_BUILD}/gnucash
|
|
|
|
DEPENDS sw_core_utils)
|
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
|
|
|
# No headers to install
|
|
|
|
|
|
|
|
# Scheme
|
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
set (core_utils_SCHEME core-utils.scm)
|
2015-12-07 11:17:08 -06:00
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
set(GUILE_OUTPUT_DIR gnucash)
|
|
|
|
set(GUILE_DEPENDS gnc-core-utils)
|
2015-12-07 11:17:08 -06:00
|
|
|
|
2018-05-03 16:18:15 -05:00
|
|
|
gnc_add_scheme_targets(scm-core-utils
|
2015-12-07 11:17:08 -06:00
|
|
|
"${core_utils_SCHEME}"
|
|
|
|
${GUILE_OUTPUT_DIR}
|
|
|
|
"${GUILE_DEPENDS}"
|
|
|
|
FALSE
|
|
|
|
)
|
|
|
|
|