2017-08-10 06:56:00 -05:00
|
|
|
# CMakeLists.txt for libgnucash/core-utils
|
2010-02-24 13:44:59 -06:00
|
|
|
|
2016-01-18 10:33:34 -06:00
|
|
|
ADD_SUBDIRECTORY(test)
|
2016-08-26 13:59:33 -05:00
|
|
|
|
|
|
|
IF (BUILDING_FROM_VCS)
|
|
|
|
SET (SWIG_CORE_UTILS_GUILE_C ${CMAKE_CURRENT_BINARY_DIR}/swig-core-utils-guile.c)
|
2017-02-01 21:48:46 -06:00
|
|
|
GNC_ADD_SWIG_COMMAND (swig-core-utils-guile-c ${SWIG_CORE_UTILS_GUILE_C} ${CMAKE_CURRENT_SOURCE_DIR}/core-utils.i)
|
2016-08-26 13:59:33 -05:00
|
|
|
SET (SWIG_CORE_UTILS_PYTHON_C ${CMAKE_CURRENT_BINARY_DIR}/swig-core-utils-python.c)
|
|
|
|
GNC_ADD_SWIG_PYTHON_COMMAND (swig-core-utils-python ${SWIG_CORE_UTILS_PYTHON_C} ${CMAKE_CURRENT_SOURCE_DIR}/core-utils.i)
|
|
|
|
ELSE()
|
|
|
|
SET(SWIG_CORE_UTILS_GUILE_C swig-core-utils-guile.c)
|
|
|
|
SET(SWIG_CORE_UTILS_PYTHON_C swig-core-utils-python.c)
|
|
|
|
ENDIF()
|
2010-02-24 13:44:59 -06:00
|
|
|
|
2015-12-07 11:17:08 -06: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
|
2010-03-04 13:50:45 -06:00
|
|
|
gnc-path.c
|
2010-02-24 13:44:59 -06:00
|
|
|
)
|
|
|
|
|
2010-02-27 05:37:14 -06:00
|
|
|
# Add dependency on config.h
|
2015-12-07 11:17:08 -06:00
|
|
|
SET_SOURCE_FILES_PROPERTIES (${core_utils_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
|
2010-02-27 05:37:14 -06:00
|
|
|
|
2017-02-01 21:48:46 -06:00
|
|
|
IF (BUILDING_FROM_VCS)
|
|
|
|
# Command to generate the swig-runtime.h header
|
|
|
|
ADD_CUSTOM_COMMAND (
|
|
|
|
OUTPUT ${SWIG_RUNTIME_H}
|
|
|
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
|
|
|
COMMAND ${SWIG_EXECUTABLE} -guile -external-runtime ${SWIG_RUNTIME_H}
|
|
|
|
)
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
ADD_CUSTOM_TARGET(swig-runtime-h DEPENDS ${SWIG_RUNTIME_H})
|
2013-02-08 14:47:42 -06:00
|
|
|
|
|
|
|
# Add dependency on swig-runtime.h
|
|
|
|
SET_SOURCE_FILES_PROPERTIES (gnc-guile-utils.c PROPERTIES OBJECT_DEPENDS ${SWIG_RUNTIME_H})
|
|
|
|
|
2015-12-07 11:17:08 -06:00
|
|
|
SET(prefix ${CMAKE_INSTALL_PREFIX})
|
2017-12-05 16:48:45 -06:00
|
|
|
if(ENABLE_BINRELOC)
|
|
|
|
SET(datadir ${DATADIR})
|
|
|
|
SET(bindir ${BINDIR})
|
|
|
|
SET(libdir ${LIBDIR})
|
|
|
|
SET(sysconfdir ${SYSCONFDIR})
|
|
|
|
SET(localedir ${LOCALEDIR})
|
|
|
|
else()
|
|
|
|
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")
|
|
|
|
endif()
|
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
|
|
|
|
|
|
|
### Create gnc-version.h ###
|
2010-03-04 13:50:45 -06:00
|
|
|
|
2015-12-07 11:17:08 -06:00
|
|
|
SET (GNC_VERSION_H_IN
|
|
|
|
"/* Autogenerated. Do not change. */
|
2010-12-12 06:04:00 -06:00
|
|
|
#ifndef GNC_VERSION_H
|
|
|
|
#define GNC_VERSION_H
|
|
|
|
|
2017-10-05 15:47:11 -05:00
|
|
|
#define GNC_VCS \"git\"
|
2015-12-07 11:17:08 -06:00
|
|
|
#include \"gnc-vcs-info.h\"
|
2010-12-12 06:04:00 -06:00
|
|
|
#endif
|
|
|
|
")
|
|
|
|
|
2015-12-07 11:17:08 -06:00
|
|
|
STRING(CONFIGURE ${GNC_VERSION_H_IN} GNC_VERSION_H_CONTENT)
|
|
|
|
FILE (WRITE ${CMAKE_CURRENT_BINARY_DIR}/gnc-version.h ${GNC_VERSION_H_CONTENT})
|
|
|
|
|
|
|
|
### 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
|
2017-10-04 16:01:03 -05:00
|
|
|
IF (BUILDING_FROM_VCS)
|
2015-12-07 11:17:08 -06:00
|
|
|
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
|
|
|
")
|
|
|
|
|
2016-07-05 11:56:11 -05:00
|
|
|
SET(SCM_REV_COMMAND "${CMAKE_SOURCE_DIR}/util/gnc-vcs-info -r")
|
2017-10-04 16:01:03 -05:00
|
|
|
SET(SCM_REV_DATE_COMMAND "${CMAKE_SOURCE_DIR}/util/gnc-vcs-info -d")
|
2015-12-07 11:17:08 -06:00
|
|
|
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/version.cmake
|
|
|
|
"EXECUTE_PROCESS(
|
2016-07-08 11:34:35 -05:00
|
|
|
COMMAND ${SHELL} ${SCM_REV_COMMAND} ${CMAKE_SOURCE_DIR}
|
2017-10-05 15:47:11 -05:00
|
|
|
OUTPUT_VARIABLE GNC_VCS_REV
|
2015-12-07 11:17:08 -06:00
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
)
|
2017-10-04 16:01:03 -05:00
|
|
|
EXECUTE_PROCESS(
|
|
|
|
COMMAND ${SHELL} ${SCM_REV_DATE_COMMAND} ${CMAKE_SOURCE_DIR}
|
2017-10-05 15:47:11 -05:00
|
|
|
OUTPUT_VARIABLE GNC_VCS_REV_DATE
|
2017-10-04 16:01:03 -05:00
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
)
|
2017-10-05 15:47:11 -05:00
|
|
|
STRING(SUBSTRING \${GNC_VCS_REV_DATE} 0 4 GNC_VCS_REV_YEAR)
|
|
|
|
STRING(SUBSTRING \${GNC_VCS_REV_DATE} 0 7 GNC_VCS_REV_Y_M)
|
2015-12-07 11:17:08 -06:00
|
|
|
CONFIGURE_FILE(\${SRC} \${DST} @ONLY)
|
|
|
|
")
|
|
|
|
|
2017-02-01 21:48:46 -06:00
|
|
|
IF (${CMAKE_VERSION} VERSION_GREATER "3.1")
|
|
|
|
ADD_CUSTOM_TARGET(gnc-vcs-info ALL
|
|
|
|
BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h
|
|
|
|
COMMAND ${CMAKE_COMMAND} -D SRC=${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h.in
|
|
|
|
-D DST=${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h
|
|
|
|
-P ${CMAKE_CURRENT_BINARY_DIR}/version.cmake
|
|
|
|
)
|
|
|
|
ELSE()
|
|
|
|
# BYPRODUCTS keyword not supported below 3.2
|
|
|
|
ADD_CUSTOM_TARGET(gnc-vcs-info ALL
|
|
|
|
COMMAND ${CMAKE_COMMAND} -D SRC=${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h.in
|
|
|
|
-D DST=${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h
|
|
|
|
-P ${CMAKE_CURRENT_BINARY_DIR}/version.cmake
|
|
|
|
)
|
|
|
|
ENDIF()
|
2017-10-04 16:01:03 -05:00
|
|
|
ELSE(BUILDING_FROM_VCS)
|
|
|
|
ADD_CUSTOM_TARGET(gnc-vcs-info DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gnc-vcs-info.h)
|
|
|
|
ENDIF(BUILDING_FROM_VCS)
|
2018-01-28 10:45:49 -06:00
|
|
|
dist_add_generated(gnc-vcs-info gnc-vcs-info.h)
|
2015-12-07 11:17:08 -06:00
|
|
|
### Compile library
|
|
|
|
|
|
|
|
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
|
2010-03-04 13:50:45 -06:00
|
|
|
gnc-path.h
|
2010-02-24 13:44:59 -06:00
|
|
|
)
|
|
|
|
|
2016-08-26 13:59:33 -05:00
|
|
|
SET(core_utils_ALL_SOURCES ${core_utils_SOURCES} ${core_utils_noinst_HEADERS})
|
2017-09-04 15:04:04 -05:00
|
|
|
SET(core_utils_ALL_LIBRARIES ${Boost_LIBRARIES} ${GUILE_LDFLAGS} ${GLIB2_LDFLAGS} ${GOBJECT_LDFLAGS} ${GTK_MAC_LDFLAGS})
|
2017-07-04 20:36:35 -05:00
|
|
|
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
|
|
|
|
2017-12-02 19:50:14 -06:00
|
|
|
SET_LOCAL_DIST(core_utils_DIST_local ${core_utils_ALL_SOURCES} CMakeLists.txt core-utils.i core-utils.scm gncla-dir.h.in)
|
2017-02-01 21:48:46 -06:00
|
|
|
SET(core_utils_DIST ${core_utils_DIST_local} ${test_core_utils_DIST} PARENT_SCOPE)
|
2016-08-26 13:59:33 -05:00
|
|
|
|
|
|
|
IF (MAC_INTEGRATION)
|
|
|
|
LIST(APPEND core_utils_ALL_LIBRARIES ${OSX_EXTRA_LIBRARIES})
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
ADD_LIBRARY (gnc-core-utils ${core_utils_ALL_SOURCES} ${SWIG_CORE_UTILS_GUILE_C})
|
2015-12-07 11:17:08 -06:00
|
|
|
ADD_DEPENDENCIES(gnc-core-utils gnc-vcs-info)
|
|
|
|
|
2016-08-26 13:59:33 -05:00
|
|
|
TARGET_LINK_LIBRARIES(gnc-core-utils ${core_utils_ALL_LIBRARIES})
|
2015-12-07 11:17:08 -06:00
|
|
|
|
|
|
|
TARGET_COMPILE_DEFINITIONS(gnc-core-utils
|
|
|
|
PRIVATE -DG_LOG_DOMAIN=\"gnc.core-utils\" ${GTK_MAC_CFLAGS_OTHER})
|
|
|
|
|
2016-08-26 13:59:33 -05:00
|
|
|
TARGET_INCLUDE_DIRECTORIES(gnc-core-utils PUBLIC ${core_utils_ALL_INCLUDES})
|
2015-12-07 11:17:08 -06:00
|
|
|
|
|
|
|
IF (MAC_INTEGRATION)
|
|
|
|
TARGET_COMPILE_OPTIONS(gnc-core-utils PRIVATE ${OSX_EXTRA_COMPILE_FLAGS})
|
|
|
|
ENDIF(MAC_INTEGRATION)
|
|
|
|
|
|
|
|
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
|
|
|
)
|
|
|
|
|
|
|
|
IF (WITH_PYTHON)
|
|
|
|
ADD_LIBRARY (gnc-core-utils-python ${core_utils_ALL_SOURCES} ${SWIG_CORE_UTILS_PYTHON_C})
|
|
|
|
ADD_DEPENDENCIES(gnc-core-utils-python gnc-vcs-info)
|
|
|
|
|
|
|
|
TARGET_LINK_LIBRARIES(gnc-core-utils-python ${core_utils_ALL_LIBRARIES} ${PYTHON_LIBRARIES})
|
|
|
|
|
|
|
|
TARGET_COMPILE_DEFINITIONS(gnc-core-utils-python
|
|
|
|
PRIVATE -DG_LOG_DOMAIN=\"gnc.core-utils\" ${GTK_MAC_CFLAGS_OTHER}
|
|
|
|
)
|
|
|
|
|
|
|
|
TARGET_INCLUDE_DIRECTORIES(gnc-core-utils-python PUBLIC ${core_utils_ALL_INCLUDES} ${PYTHON_INCLUDE_DIRS})
|
|
|
|
|
|
|
|
IF (MAC_INTEGRATION)
|
|
|
|
TARGET_COMPILE_OPTIONS(gnc-core-utils-python PRIVATE ${OSX_EXTRA_COMPILE_FLAGS})
|
|
|
|
ENDIF(MAC_INTEGRATION)
|
|
|
|
|
|
|
|
INSTALL(TARGETS gnc-core-utils-python
|
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
|
|
|
)
|
|
|
|
|
|
|
|
ENDIF()
|
|
|
|
|
2015-12-07 11:17:08 -06:00
|
|
|
# No headers to install
|
|
|
|
|
|
|
|
# Scheme
|
|
|
|
|
|
|
|
SET (core_utils_SCHEME core-utils.scm)
|
|
|
|
|
|
|
|
SET(GUILE_OUTPUT_DIR gnucash)
|
|
|
|
SET(GUILE_DEPENDS gnc-core-utils)
|
|
|
|
|
|
|
|
GNC_ADD_SCHEME_TARGETS(scm-core-utils
|
|
|
|
"${core_utils_SCHEME}"
|
|
|
|
${GUILE_OUTPUT_DIR}
|
|
|
|
"${GUILE_DEPENDS}"
|
|
|
|
FALSE
|
|
|
|
)
|
|
|
|
|