mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
core-utils - regroup build rules per target
- first all rules and variables for libgnc-core-utils - then the rules to generate additional files (like gncla-dir.h or gnc-vcs-info.h) - next rules for the python bindings - finally rules for the dist targets Note this commit also eliminates variable core_utils_ALL_SOURCES, replacing its two uses directly with its value.
This commit is contained in:
parent
94fc5233ea
commit
36c19b4085
@ -2,13 +2,8 @@
|
|||||||
|
|
||||||
add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
|
|
||||||
# Command to generate the swig-core-utils-python.c wrapper file
|
|
||||||
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_SOURCE_DIR}/bindings/core-utils.i ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
### libgnc-core-utils
|
||||||
set (core_utils_SOURCES
|
set (core_utils_SOURCES
|
||||||
binreloc.c
|
binreloc.c
|
||||||
gnc-prefs.c
|
gnc-prefs.c
|
||||||
@ -26,51 +21,6 @@ set (core_utils_SOURCES
|
|||||||
# Add dependency on config.h
|
# Add dependency on config.h
|
||||||
set_source_files_properties (${core_utils_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
|
set_source_files_properties (${core_utils_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
|
||||||
|
|
||||||
set(prefix ${CMAKE_INSTALL_PREFIX})
|
|
||||||
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")
|
|
||||||
configure_file(gncla-dir.h.in gncla-dir.h)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ---
|
|
||||||
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-info.h file")
|
|
||||||
|
|
||||||
### Create gnc-vcs-info.h
|
|
||||||
# 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.
|
|
||||||
# The meta-cmake gymnastics here come from https://cmake.org/pipermail/cmake/2010-July/038015.html
|
|
||||||
if (BUILDING_FROM_VCS)
|
|
||||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h.in
|
|
||||||
"/* Autogenerated. Do not change. */
|
|
||||||
#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@\"
|
|
||||||
")
|
|
||||||
|
|
||||||
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
|
|
||||||
-D SRC_DIR=${CMAKE_SOURCE_DIR}
|
|
||||||
-D SHELL="${SHELL}"
|
|
||||||
-P ${CMAKE_SOURCE_DIR}/cmake/git2version-info.cmake
|
|
||||||
)
|
|
||||||
else(BUILDING_FROM_VCS)
|
|
||||||
add_custom_target(gnc-vcs-info DEPENDS ${VCS_INFO_FILE})
|
|
||||||
endif(BUILDING_FROM_VCS)
|
|
||||||
dist_add_generated (${BUILDING_FROM_VCS} gnc-vcs-info.h)
|
|
||||||
### Compile library
|
|
||||||
|
|
||||||
set(core_utils_noinst_HEADERS
|
set(core_utils_noinst_HEADERS
|
||||||
binreloc.h
|
binreloc.h
|
||||||
gnc-prefs.h
|
gnc-prefs.h
|
||||||
@ -86,13 +36,8 @@ set(core_utils_noinst_HEADERS
|
|||||||
gnc-version.h
|
gnc-version.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set(core_utils_ALL_SOURCES ${core_utils_SOURCES} ${core_utils_noinst_HEADERS})
|
add_library(gnc-core-utils ${core_utils_SOURCES} ${core_utils_noinst_HEADERS})
|
||||||
|
|
||||||
set_local_dist(core_utils_DIST_local ${core_utils_ALL_SOURCES} CMakeLists.txt gncla-dir.h.in)
|
|
||||||
set(core_utils_DIST ${core_utils_DIST_local} ${test_core_utils_DIST} PARENT_SCOPE)
|
|
||||||
|
|
||||||
|
|
||||||
add_library(gnc-core-utils ${core_utils_ALL_SOURCES})
|
|
||||||
add_dependencies(gnc-core-utils gnc-vcs-info)
|
add_dependencies(gnc-core-utils gnc-vcs-info)
|
||||||
|
|
||||||
target_include_directories(gnc-core-utils
|
target_include_directories(gnc-core-utils
|
||||||
@ -127,6 +72,57 @@ install(TARGETS gnc-core-utils
|
|||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
### gncla-dir.h
|
||||||
|
set(prefix ${CMAKE_INSTALL_PREFIX})
|
||||||
|
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")
|
||||||
|
configure_file(gncla-dir.h.in gncla-dir.h)
|
||||||
|
|
||||||
|
|
||||||
|
### Create gnc-vcs-info.h
|
||||||
|
# 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.
|
||||||
|
# The meta-cmake gymnastics here come from https://cmake.org/pipermail/cmake/2010-July/038015.html
|
||||||
|
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-info.h file")
|
||||||
|
|
||||||
|
if (BUILDING_FROM_VCS)
|
||||||
|
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/gnc-vcs-info.h.in
|
||||||
|
"/* Autogenerated. Do not change. */
|
||||||
|
#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@\"
|
||||||
|
")
|
||||||
|
|
||||||
|
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
|
||||||
|
-D SRC_DIR=${CMAKE_SOURCE_DIR}
|
||||||
|
-D SHELL="${SHELL}"
|
||||||
|
-P ${CMAKE_SOURCE_DIR}/cmake/git2version-info.cmake
|
||||||
|
)
|
||||||
|
else(BUILDING_FROM_VCS)
|
||||||
|
add_custom_target(gnc-vcs-info DEPENDS ${VCS_INFO_FILE})
|
||||||
|
endif(BUILDING_FROM_VCS)
|
||||||
|
dist_add_generated (${BUILDING_FROM_VCS} gnc-vcs-info.h)
|
||||||
|
|
||||||
|
# Command to generate the swig-core-utils-python.c wrapper file
|
||||||
|
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_SOURCE_DIR}/bindings/core-utils.i ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
if (WITH_PYTHON)
|
if (WITH_PYTHON)
|
||||||
add_library (sw_core_utils MODULE ${SWIG_CORE_UTILS_PYTHON_C})
|
add_library (sw_core_utils MODULE ${SWIG_CORE_UTILS_PYTHON_C})
|
||||||
|
|
||||||
@ -162,5 +158,10 @@ if (WITH_PYTHON)
|
|||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# No headers to install
|
# Dist files
|
||||||
|
set_local_dist(core_utils_DIST_local
|
||||||
|
${core_utils_SOURCES}
|
||||||
|
${core_utils_noinst_HEADERS}
|
||||||
|
CMakeLists.txt
|
||||||
|
gncla-dir.h.in)
|
||||||
|
set(core_utils_DIST ${core_utils_DIST_local} ${test_core_utils_DIST} PARENT_SCOPE)
|
||||||
|
Loading…
Reference in New Issue
Block a user