gnucash master: Multiple changes pushed

Geert Janssens gjanssens at code.gnucash.org
Sun Jan 1 09:28:54 EST 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/a5431436 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/bdde1711 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/510b5784 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/57294d7e (commit)
	from  https://github.com/Gnucash/gnucash/commit/31d79e30 (commit)



commit a543143689992fe0aec37933eef9b419f83755b3
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Sat Dec 31 16:31:05 2022 +0100

    Generate the gresource xml file based on a list of resources
    
    This inverts the logic from
    - having an xml file and extracting dependencies
      from it to
    - having a list of dependencies and generating
      an xml file from it
    
    In the original configuration adding or removing a
    resource to/from the gresources.xml file would not
    be detected by cmake as a change in dependencies.
    The user would have to remember to rerun cmake manually.
    By explicitly listing the dependencies, cmake will
    properly recongifure and regenerate if that list is
    updated. The remainder of the dependency configuration
    also ensures proper rebuilds of gnucash, libaqbanking
    and libofx if any of the resource files change, a new
    one is added or an existing one is removed.
    
    For reusability the code to generate the gresource related
    files as been extracted into a separate function.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3d840d2a8..a7b209da5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -39,6 +39,7 @@ include (CheckIncludeFiles)
 include (GncAddSchemeTargets)
 include (GncAddGSchemaTargets)
 include (GncAddTest)
+include (GncGenerateGResources)
 include (MakeDistFiles)
 include (GNUInstallDirs)
 include (TestBigEndian)
diff --git a/common/cmake_modules/CMakeLists.txt b/common/cmake_modules/CMakeLists.txt
index e25f806b2..18de0fb95 100644
--- a/common/cmake_modules/CMakeLists.txt
+++ b/common/cmake_modules/CMakeLists.txt
@@ -1,9 +1,16 @@
 
 set(cmake_FILES
-  GncAddGSchemaTargets.cmake GncAddSchemeTargets.cmake
-  GncAddSwigCommand.cmake GncAddTest.cmake GncFindLibm.cmake
-  MacroAddSourceFileCompileFlags.cmake MacroAppendForeach.cmake
-  MakeDist.cmake MakeDistFiles.cmake MakeDistCheck.cmake
-  )
+  GncAddGSchemaTargets.cmake
+  GncAddSchemeTargets.cmake
+  GncAddSwigCommand.cmake
+  GncAddTest.cmake
+  GncFindLibm.cmake
+  GncGenerateGResources.cmake
+  MacroAddSourceFileCompileFlags.cmake
+  MacroAppendForeach.cmake
+  MakeDist.cmake
+  MakeDistFiles.cmake
+  MakeDistCheck.cmake
+)
 
 set_dist_list(cmake_modules_DIST CMakeLists.txt COPYING-CMAKE-SCRIPTS.txt ${cmake_FILES})
diff --git a/common/cmake_modules/GncGenerateGResources.cmake b/common/cmake_modules/GncGenerateGResources.cmake
new file mode 100644
index 000000000..600201dcf
--- /dev/null
+++ b/common/cmake_modules/GncGenerateGResources.cmake
@@ -0,0 +1,62 @@
+# gnc_generate_gresources (BASE filename
+#                          RESOURCE_FILES resource1 resource2 ...)
+#
+# Function to generate two files in CMAKE_CURRENT_BINARY_DIR:
+# - a gresource xml file that serves as an input to the glib_resource_compiler
+# - a c source file to be compiled and linked with a library or executable
+#   to include the resources listed in RESOURCE_FILES in that library or
+#   executable
+#
+# To link the resources, add
+#
+#   ${CMAKE_CURRENT_BINARY_DIR}/<filename>.c
+#
+# as additional source to the relevant "add_library" or "add_executable" call.
+#
+#
+# BASE filename
+#    the base filename without extension for all output files to generate
+#
+# RESOURCE_FILES
+#    a list of files that you want compiled into a gresource
+#
+# The XML file will be generated in the current cmake binary directory
+function(gnc_generate_gresources)
+
+    set(singleValues BASE)
+    set(multiValues RESOURCE_FILES)
+    cmake_parse_arguments(GR "" "${singleValues}" "${multiValues}" ${ARGN})
+
+    string(STRIP GR_BASE "${GR_BASE}")
+    set(XML_FILE "${GR_BASE}.xml")
+
+    set(TMP_FILE "${CMAKE_CURRENT_BINARY_DIR}/${XML_FILE}-tmp")
+    set(XML_PATH "${CMAKE_CURRENT_BINARY_DIR}/${XML_FILE}")
+
+    file(WRITE ${TMP_FILE} "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
+    file(APPEND ${TMP_FILE} "<gresources>\n")
+    file(APPEND ${TMP_FILE} "  <gresource prefix=\"/org/gnucash\">\n")
+
+    foreach(res_file ${GR_RESOURCE_FILES})
+        file(APPEND ${TMP_FILE} "    <file>${res_file}</file>\n")
+    endforeach()
+    file(APPEND ${TMP_FILE} "  </gresource>\n")
+    file(APPEND ${TMP_FILE} "</gresources>\n")
+
+    # Regenerate target file only if something changed
+    configure_file(${TMP_FILE} ${XML_PATH} COPYONLY)
+    file(REMOVE ${TMP_FILE})
+
+    set(C_FILE "${GR_BASE}.c")
+    add_custom_command(
+        OUTPUT ${C_FILE}
+        COMMAND
+            "${GLIB_COMPILE_RESOURCES_EXECUTABLE}"
+                --target=${C_FILE}
+                --sourcedir=${CMAKE_CURRENT_SOURCE_DIR}
+                --generate-source
+                ${XML_PATH}
+        DEPENDS
+            ${XML_PATH} ${GR_RESOURCE_FILES}
+    )
+endfunction()
diff --git a/gnucash/CMakeLists.txt b/gnucash/CMakeLists.txt
index bb736b3da..ab38a52fa 100644
--- a/gnucash/CMakeLists.txt
+++ b/gnucash/CMakeLists.txt
@@ -5,6 +5,18 @@ set(SCHEMADIR_BUILD ${DATADIR_BUILD}/glib-2.0/schemas)
 file(MAKE_DIRECTORY ${SCHEMADIR_BUILD})
 unset(gschema_depends CACHE)
 unset(gschema_preftrans_files CACHE)
+
+# Get glib executable for generating the gresource file
+execute_process(
+  COMMAND
+  ${PKG_CONFIG_EXECUTABLE} gio-2.0 --variable glib_compile_resources
+  OUTPUT_VARIABLE
+  GLIB_COMPILE_RESOURCES_NAME
+  OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+
+find_program(GLIB_COMPILE_RESOURCES_EXECUTABLE ${GLIB_COMPILE_RESOURCES_NAME})
+
 # The subdirectories
 add_subdirectory (gnome)
 add_subdirectory (gnome-utils)
@@ -40,13 +52,44 @@ set(gnucash_noinst_HEADERS
     gnucash-locale-platform.h
 )
 
+set(gnucash_GRESOURCES
+  gnucash.css
+  gnucash-fallback.css
+  ui/gnc-embedded-register-window.ui
+  ui/gnc-main-window.ui
+  ui/gnc-plugin-account-tree.ui
+  ui/gnc-plugin-basic-commands.ui
+  ui/gnc-plugin-bi-import.ui
+  ui/gnc-plugin-budget.ui
+  ui/gnc-plugin-business.ui
+  ui/gnc-plugin-csv-export.ui
+  ui/gnc-plugin-csv-import.ui
+  ui/gnc-plugin-customer-import.ui
+  ui/gnc-plugin-file-history.ui
+  ui/gnc-plugin-log-replay.ui
+  ui/gnc-plugin-register.ui
+  ui/gnc-plugin-report-system.ui
+  ui/gnc-plugin-page-account-tree.ui
+  ui/gnc-plugin-page-budget.ui
+  ui/gnc-plugin-page-invoice.ui
+  ui/gnc-plugin-page-owner-tree.ui
+  ui/gnc-plugin-page-register.ui
+  ui/gnc-plugin-page-report.ui
+  ui/gnc-plugin-page-sx-list.ui
+  ui/gnc-plugin-qif-import.ui
+  ui/gnc-reconcile-window.ui
+)
+
+# Generate the gresource file
+gnc_generate_gresources(BASE gnucash-gresources RESOURCE_FILES ${gnucash_GRESOURCES})
+
 set (gnucash_SOURCES
   gnucash.cpp
   gnucash-commands.cpp
   gnucash-core-app.cpp
-  gnucash-gresources.c
+  ${CMAKE_CURRENT_BINARY_DIR}/gnucash-gresources.c
   ${GNUCASH_RESOURCE_FILE}
-  )
+)
 
 if (MINGW)
   list(APPEND gnucash_SOURCES "gnucash-locale-windows.c")
@@ -109,43 +152,6 @@ if (BUILDING_FROM_VCS)
     target_compile_definitions(gnc-gnome-utils PRIVATE -DGNC_VCS=\"git\")
 endif()
 
-# Get glib executable for generating the gresource file
-execute_process(
-   COMMAND
-       ${PKG_CONFIG_EXECUTABLE} gio-2.0 --variable glib_compile_resources
-   OUTPUT_VARIABLE
-       GLIB_COMPILE_RESOURCES_NAME
-   OUTPUT_STRIP_TRAILING_WHITESPACE
-)
-
-find_program(GLIB_COMPILE_RESOURCES_EXECUTABLE ${GLIB_COMPILE_RESOURCES_NAME})
-
-# Get the dependencies of the gresource
-
-execute_process(
-  OUTPUT_VARIABLE
-      gr_files
-  COMMAND "${GLIB_COMPILE_RESOURCES_EXECUTABLE}"
-     --generate-dependencies
-     ${CMAKE_CURRENT_SOURCE_DIR}/gnucash-gresources.xml
-)
-
-string (REPLACE "\n" ";" gresource_files ${gr_files})
-
-add_custom_command(
-   OUTPUT gnucash-gresources.c
-   COMMAND
-    "${GLIB_COMPILE_RESOURCES_EXECUTABLE}"
-    --target=gnucash-gresources.c
-    --sourcedir=${CMAKE_CURRENT_SOURCE_DIR}
-    --generate-source
-    ${CMAKE_CURRENT_SOURCE_DIR}/gnucash-gresources.xml
-   DEPENDS
-    gnucash-gresources.xml ${gresource_files}
-   WORKING_DIRECTORY
-    ${CMAKE_CURRENT_BINARY_DIR}
-)
-
 if (MAC_INTEGRATION)
   target_compile_options(gnucash PRIVATE ${OSX_EXTRA_COMPILE_FLAGS})
   target_link_libraries(gnucash ${OSX_EXTRA_LIBRARIES})
@@ -261,7 +267,7 @@ install(FILES ${ENVIRONMENT_FILE_DIR}/environment DESTINATION
 set_local_dist(gnucash_DIST_local CMakeLists.txt environment.in generate-gnc-script
     gnucash.cpp gnucash-commands.cpp gnucash-cli.cpp gnucash-core-app.cpp
     gnucash-locale-macos.mm gnucash-locale-windows.c gnucash.rc.in gnucash-valgrind.in
-    gnucash-gresources.xml ${gresource_files}
+    ${gnucash_GRESOURCES}
     ${gnucash_noinst_HEADERS} ${gnucash_EXTRA_DIST})
 
 set (gnucash_DIST ${gnucash_DIST_local} ${gnome_DIST} ${gnome_search_DIST} ${gnome_utils_DIST}
diff --git a/gnucash/gnucash-gresources.xml b/gnucash/gnucash-gresources.xml
deleted file mode 100644
index 32a1d2890..000000000
--- a/gnucash/gnucash-gresources.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<gresources>
-  <gresource prefix="/org/gnucash">
-    <file>gnucash.css</file>
-    <file>gnucash-fallback.css</file>
-    <file>ui/gnc-embedded-register-window.ui</file>
-    <file>ui/gnc-main-window.ui</file>
-    <file>ui/gnc-plugin-account-tree.ui</file>
-    <file>ui/gnc-plugin-basic-commands.ui</file>
-    <file>ui/gnc-plugin-bi-import.ui</file>
-    <file>ui/gnc-plugin-budget.ui</file>
-    <file>ui/gnc-plugin-business.ui</file>
-    <file>ui/gnc-plugin-csv-export.ui</file>
-    <file>ui/gnc-plugin-csv-import.ui</file>
-    <file>ui/gnc-plugin-customer-import.ui</file>
-    <file>ui/gnc-plugin-file-history.ui</file>
-    <file>ui/gnc-plugin-log-replay.ui</file>
-    <file>ui/gnc-plugin-register.ui</file>
-    <file>ui/gnc-plugin-report-system.ui</file>
-
-    <file>ui/gnc-plugin-page-account-tree.ui</file>
-    <file>ui/gnc-plugin-page-budget.ui</file>
-    <file>ui/gnc-plugin-page-invoice.ui</file>
-    <file>ui/gnc-plugin-page-owner-tree.ui</file>
-    <file>ui/gnc-plugin-page-register.ui</file>
-    <file>ui/gnc-plugin-page-report.ui</file>
-    <file>ui/gnc-plugin-page-sx-list.ui</file>
-
-    <file>ui/gnc-plugin-qif-import.ui</file>
-
-    <file>ui/gnc-reconcile-window.ui</file>
-  </gresource>
-</gresources>
diff --git a/gnucash/import-export/aqb/CMakeLists.txt b/gnucash/import-export/aqb/CMakeLists.txt
index d18131ea0..181f793f4 100644
--- a/gnucash/import-export/aqb/CMakeLists.txt
+++ b/gnucash/import-export/aqb/CMakeLists.txt
@@ -41,23 +41,11 @@ set (aqbanking_noinst_HEADERS
 
 set(aqbanking_GLADE assistant-ab-initial.glade dialog-ab.glade dialog-ab-pref.glade)
 
-set(aqbanking_UI gnc-plugin-aqbanking.ui)
+set(aqbanking_UI ui/gnc-plugin-aqbanking.ui)
 
 if(WITH_AQBANKING)
 
-  add_custom_command(
-    OUTPUT aqb-gresources.c
-    COMMAND
-      "${GLIB_COMPILE_RESOURCES_EXECUTABLE}"
-      --target=aqb-gresources.c
-      --sourcedir=${CMAKE_CURRENT_SOURCE_DIR}
-      --generate-source
-      ${CMAKE_CURRENT_SOURCE_DIR}/aqb-gresources.xml
-    DEPENDS
-      ${CMAKE_CURRENT_SOURCE_DIR}/aqb-gresources.xml ${aqbanking_UI}
-    WORKING_DIRECTORY
-      ${CMAKE_CURRENT_BINARY_DIR}
-  )
+  gnc_generate_gresources(BASE aqb-gresources RESOURCE_FILES ${aqbanking_UI})
 
   add_library (gncmod-aqbanking
     ${aqbanking_SOURCES}
diff --git a/gnucash/import-export/aqb/gnc-plugin-aqbanking.ui b/gnucash/import-export/aqb/ui/gnc-plugin-aqbanking.ui
similarity index 100%
rename from gnucash/import-export/aqb/gnc-plugin-aqbanking.ui
rename to gnucash/import-export/aqb/ui/gnc-plugin-aqbanking.ui
diff --git a/gnucash/import-export/ofx/CMakeLists.txt b/gnucash/import-export/ofx/CMakeLists.txt
index b0ada9de2..695f4fe34 100644
--- a/gnucash/import-export/ofx/CMakeLists.txt
+++ b/gnucash/import-export/ofx/CMakeLists.txt
@@ -15,23 +15,11 @@ set(ofx_noinst_HEADERS
   gnc-plugin-ofx.h
 )
 
-set(ofx_UI gnc-plugin-ofx.ui)
+set(ofx_UI ui/gnc-plugin-ofx.ui)
 
 if (WITH_OFX)
 
-  add_custom_command(
-    OUTPUT ofx-gresources.c
-    COMMAND
-      "${GLIB_COMPILE_RESOURCES_EXECUTABLE}"
-      --target=ofx-gresources.c
-      --sourcedir=${CMAKE_CURRENT_SOURCE_DIR}
-      --generate-source
-      ${CMAKE_CURRENT_SOURCE_DIR}/ofx-gresources.xml
-    DEPENDS
-      ${CMAKE_CURRENT_SOURCE_DIR}/ofx-gresources.xml ${ofx_UI}
-    WORKING_DIRECTORY
-      ${CMAKE_CURRENT_BINARY_DIR}
-  )
+  gnc_generate_gresources(BASE ofx-gresources RESOURCE_FILES ${ofx_UI})
 
   add_library(gncmod-ofx
     ${ofx_SOURCES}
diff --git a/gnucash/import-export/ofx/gnc-plugin-ofx.ui b/gnucash/import-export/ofx/ui/gnc-plugin-ofx.ui
similarity index 100%
rename from gnucash/import-export/ofx/gnc-plugin-ofx.ui
rename to gnucash/import-export/ofx/ui/gnc-plugin-ofx.ui
diff --git a/po/POTFILES.in b/po/POTFILES.in
index e5293495c..16b574a68 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -315,9 +315,9 @@ gnucash/import-export/aqb/gnc-flicker-gui.c
 gnucash/import-export/aqb/gnc-gwen-gui.c
 gnucash/import-export/aqb/gncmod-aqbanking.c
 gnucash/import-export/aqb/gnc-plugin-aqbanking.c
-gnucash/import-export/aqb/gnc-plugin-aqbanking.ui
 gnucash/import-export/aqb/gschemas/org.gnucash.GnuCash.dialogs.flicker.gschema.xml.in
 gnucash/import-export/aqb/gschemas/org.gnucash.GnuCash.dialogs.import.hbci.gschema.xml.in
+gnucash/import-export/aqb/ui/gnc-plugin-aqbanking.ui
 gnucash/import-export/bi-import/dialog-bi-import.c
 gnucash/import-export/bi-import/dialog-bi-import-gui.c
 gnucash/import-export/bi-import/dialog-bi-import-helper.c
@@ -362,8 +362,8 @@ gnucash/import-export/log-replay/gnc-plugin-log-replay.c
 gnucash/import-export/ofx/gncmod-ofx-import.c
 gnucash/import-export/ofx/gnc-ofx-import.c
 gnucash/import-export/ofx/gnc-plugin-ofx.c
-gnucash/import-export/ofx/gnc-plugin-ofx.ui
 gnucash/import-export/ofx/gschemas/org.gnucash.GnuCash.dialogs.import.ofx.gschema.xml.in
+gnucash/import-export/ofx/ui/gnc-plugin-ofx.ui
 gnucash/import-export/qif-imp/assistant-qif-import.c
 gnucash/import-export/qif-imp/dialog-account-picker.c
 gnucash/import-export/qif-imp/gnc-plugin-qif-import.c

commit bdde17115dcc35418ec417b3b463d0adb619f14d
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Sat Dec 31 14:49:19 2022 +0100

    Use relative paths to ui files

diff --git a/gnucash/CMakeLists.txt b/gnucash/CMakeLists.txt
index 254aece47..bb736b3da 100644
--- a/gnucash/CMakeLists.txt
+++ b/gnucash/CMakeLists.txt
@@ -126,7 +126,6 @@ execute_process(
   OUTPUT_VARIABLE
       gr_files
   COMMAND "${GLIB_COMPILE_RESOURCES_EXECUTABLE}"
-     --sourcedir=${CMAKE_CURRENT_SOURCE_DIR}
      --generate-dependencies
      ${CMAKE_CURRENT_SOURCE_DIR}/gnucash-gresources.xml
 )
@@ -142,7 +141,7 @@ add_custom_command(
     --generate-source
     ${CMAKE_CURRENT_SOURCE_DIR}/gnucash-gresources.xml
    DEPENDS
-    ${CMAKE_CURRENT_SOURCE_DIR}/gnucash-gresources.xml ${gresource_files}
+    gnucash-gresources.xml ${gresource_files}
    WORKING_DIRECTORY
     ${CMAKE_CURRENT_BINARY_DIR}
 )
@@ -259,15 +258,6 @@ install(FILES ${ENVIRONMENT_FILE_DIR}/environment DESTINATION
   ${CMAKE_INSTALL_FULL_SYSCONFDIR}/gnucash)
 
 
-# The GResource Files are absolute paths but set_local_dist requires
-# relative paths.
-foreach(gres_file ${gresource_files})
-  file(RELATIVE_PATH rel_file ${CMAKE_CURRENT_SOURCE_DIR} ${gres_file})
-  list(REMOVE_ITEM gresource_files ${gres_file})
-  list(APPEND gresource_files ${rel_file})
-endforeach()
-
-
 set_local_dist(gnucash_DIST_local CMakeLists.txt environment.in generate-gnc-script
     gnucash.cpp gnucash-commands.cpp gnucash-cli.cpp gnucash-core-app.cpp
     gnucash-locale-macos.mm gnucash-locale-windows.c gnucash.rc.in gnucash-valgrind.in

commit 510b57843b77439fa90666d527f5b94ded3436eb
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Sat Dec 31 13:17:22 2022 +0100

    Some whitespace fixes
    
    Kept separate to not clutter the actual changes

diff --git a/gnucash/gnucash-gresources.xml b/gnucash/gnucash-gresources.xml
index e89c6fc1f..32a1d2890 100644
--- a/gnucash/gnucash-gresources.xml
+++ b/gnucash/gnucash-gresources.xml
@@ -6,7 +6,7 @@
     <file>gnucash-fallback.css</file>
     <file>ui/gnc-embedded-register-window.ui</file>
     <file>ui/gnc-main-window.ui</file>
-     <file>ui/gnc-plugin-account-tree.ui</file>
+    <file>ui/gnc-plugin-account-tree.ui</file>
     <file>ui/gnc-plugin-basic-commands.ui</file>
     <file>ui/gnc-plugin-bi-import.ui</file>
     <file>ui/gnc-plugin-budget.ui</file>
diff --git a/gnucash/import-export/aqb/CMakeLists.txt b/gnucash/import-export/aqb/CMakeLists.txt
index dcc856e59..d18131ea0 100644
--- a/gnucash/import-export/aqb/CMakeLists.txt
+++ b/gnucash/import-export/aqb/CMakeLists.txt
@@ -89,16 +89,16 @@ if(WITH_AQBANKING)
     ${GWENHYWFAR_INCLUDE_DIRS}
     ${GWEN_GTK3_INCLUDE_DIRS})
 
-if (APPLE)
-  set_target_properties (gncmod-aqbanking PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/gnucash")
-endif()
+  if (APPLE)
+    set_target_properties (gncmod-aqbanking PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/gnucash")
+  endif()
 
   install(TARGETS gncmod-aqbanking
     LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/gnucash
     ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/gnucash
     RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
 
-# No headers to install
+  # No headers to install
 
   install(FILES ${aqbanking_GLADE} DESTINATION  ${CMAKE_INSTALL_DATADIR}/gnucash/gtkbuilder)
 
diff --git a/gnucash/import-export/ofx/CMakeLists.txt b/gnucash/import-export/ofx/CMakeLists.txt
index 8d3fed4f3..b0ada9de2 100644
--- a/gnucash/import-export/ofx/CMakeLists.txt
+++ b/gnucash/import-export/ofx/CMakeLists.txt
@@ -46,9 +46,9 @@ if (WITH_OFX)
 
   target_include_directories(gncmod-ofx PRIVATE ${LIBOFX_INCLUDE_DIRS})
 
-if (APPLE)
-  set_target_properties (gncmod-ofx PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/gnucash")
-endif()
+  if (APPLE)
+    set_target_properties (gncmod-ofx PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/gnucash")
+  endif()
 
   install(TARGETS gncmod-ofx
   LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/gnucash

commit 57294d7e1681ef67676d9eff6dfda7d1d2311a27
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Sat Dec 31 13:13:36 2022 +0100

    Keep ui files for optional modules within the module
    
    This goes for ofx and aqbanking. If either
    module is not part of the build, the ui files
    should not be part of the resource of gnucash.
    It turns out each compilation unit can have
    its proper resource though, so the build system
    was changed to include the ui files in a local resource
    for the aqbanking and ofx modules instead of to
    the gnucash global resource.

diff --git a/gnucash/gnucash-gresources.xml b/gnucash/gnucash-gresources.xml
index 780271d70..e89c6fc1f 100644
--- a/gnucash/gnucash-gresources.xml
+++ b/gnucash/gnucash-gresources.xml
@@ -27,9 +27,6 @@
     <file>ui/gnc-plugin-page-report.ui</file>
     <file>ui/gnc-plugin-page-sx-list.ui</file>
 
-    <file>ui/gnc-plugin-ofx.ui</file>
-    <file>ui/gnc-plugin-aqbanking.ui</file>
-
     <file>ui/gnc-plugin-qif-import.ui</file>
 
     <file>ui/gnc-reconcile-window.ui</file>
diff --git a/gnucash/import-export/aqb/CMakeLists.txt b/gnucash/import-export/aqb/CMakeLists.txt
index a275638fb..dcc856e59 100644
--- a/gnucash/import-export/aqb/CMakeLists.txt
+++ b/gnucash/import-export/aqb/CMakeLists.txt
@@ -41,9 +41,27 @@ set (aqbanking_noinst_HEADERS
 
 set(aqbanking_GLADE assistant-ab-initial.glade dialog-ab.glade dialog-ab-pref.glade)
 
+set(aqbanking_UI gnc-plugin-aqbanking.ui)
+
 if(WITH_AQBANKING)
+
+  add_custom_command(
+    OUTPUT aqb-gresources.c
+    COMMAND
+      "${GLIB_COMPILE_RESOURCES_EXECUTABLE}"
+      --target=aqb-gresources.c
+      --sourcedir=${CMAKE_CURRENT_SOURCE_DIR}
+      --generate-source
+      ${CMAKE_CURRENT_SOURCE_DIR}/aqb-gresources.xml
+    DEPENDS
+      ${CMAKE_CURRENT_SOURCE_DIR}/aqb-gresources.xml ${aqbanking_UI}
+    WORKING_DIRECTORY
+      ${CMAKE_CURRENT_BINARY_DIR}
+  )
+
   add_library (gncmod-aqbanking
     ${aqbanking_SOURCES}
+    ${CMAKE_CURRENT_BINARY_DIR}/aqb-gresources.c
     ${aqbanking_noinst_HEADERS}
   )
 
diff --git a/gnucash/ui/gnc-plugin-aqbanking.ui b/gnucash/import-export/aqb/gnc-plugin-aqbanking.ui
similarity index 100%
rename from gnucash/ui/gnc-plugin-aqbanking.ui
rename to gnucash/import-export/aqb/gnc-plugin-aqbanking.ui
diff --git a/gnucash/import-export/ofx/CMakeLists.txt b/gnucash/import-export/ofx/CMakeLists.txt
index 8a9a25460..8d3fed4f3 100644
--- a/gnucash/import-export/ofx/CMakeLists.txt
+++ b/gnucash/import-export/ofx/CMakeLists.txt
@@ -15,8 +15,29 @@ set(ofx_noinst_HEADERS
   gnc-plugin-ofx.h
 )
 
+set(ofx_UI gnc-plugin-ofx.ui)
+
 if (WITH_OFX)
-  add_library(gncmod-ofx ${ofx_SOURCES} ${ofx_noinst_HEADERS})
+
+  add_custom_command(
+    OUTPUT ofx-gresources.c
+    COMMAND
+      "${GLIB_COMPILE_RESOURCES_EXECUTABLE}"
+      --target=ofx-gresources.c
+      --sourcedir=${CMAKE_CURRENT_SOURCE_DIR}
+      --generate-source
+      ${CMAKE_CURRENT_SOURCE_DIR}/ofx-gresources.xml
+    DEPENDS
+      ${CMAKE_CURRENT_SOURCE_DIR}/ofx-gresources.xml ${ofx_UI}
+    WORKING_DIRECTORY
+      ${CMAKE_CURRENT_BINARY_DIR}
+  )
+
+  add_library(gncmod-ofx
+    ${ofx_SOURCES}
+    ${CMAKE_CURRENT_BINARY_DIR}/ofx-gresources.c
+    ${ofx_noinst_HEADERS}
+  )
 
   target_link_libraries(gncmod-ofx gnc-generic-import gnc-engine gnc-app-utils gnc-core-utils
                     gnc-gnome-utils gnc-gnome gnc-module ${LIBOFX_LDFLAGS})
@@ -36,5 +57,5 @@ endif()
 
 endif()
 
-set_local_dist(ofx_DIST_local CMakeLists.txt ${ofx_SOURCES} ${ofx_noinst_HEADERS} )
+set_local_dist(ofx_DIST_local CMakeLists.txt ${ofx_SOURCES} ${ofx_noinst_HEADERS} ${ofx_UI})
 set(ofx_DIST ${ofx_DIST_local} ${test_ofx_DIST} ${ofx_gschema_DIST} PARENT_SCOPE)
diff --git a/gnucash/ui/gnc-plugin-ofx.ui b/gnucash/import-export/ofx/gnc-plugin-ofx.ui
similarity index 100%
rename from gnucash/ui/gnc-plugin-ofx.ui
rename to gnucash/import-export/ofx/gnc-plugin-ofx.ui
diff --git a/po/POTFILES.in b/po/POTFILES.in
index a71d9ae57..e5293495c 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -315,6 +315,7 @@ gnucash/import-export/aqb/gnc-flicker-gui.c
 gnucash/import-export/aqb/gnc-gwen-gui.c
 gnucash/import-export/aqb/gncmod-aqbanking.c
 gnucash/import-export/aqb/gnc-plugin-aqbanking.c
+gnucash/import-export/aqb/gnc-plugin-aqbanking.ui
 gnucash/import-export/aqb/gschemas/org.gnucash.GnuCash.dialogs.flicker.gschema.xml.in
 gnucash/import-export/aqb/gschemas/org.gnucash.GnuCash.dialogs.import.hbci.gschema.xml.in
 gnucash/import-export/bi-import/dialog-bi-import.c
@@ -361,6 +362,7 @@ gnucash/import-export/log-replay/gnc-plugin-log-replay.c
 gnucash/import-export/ofx/gncmod-ofx-import.c
 gnucash/import-export/ofx/gnc-ofx-import.c
 gnucash/import-export/ofx/gnc-plugin-ofx.c
+gnucash/import-export/ofx/gnc-plugin-ofx.ui
 gnucash/import-export/ofx/gschemas/org.gnucash.GnuCash.dialogs.import.ofx.gschema.xml.in
 gnucash/import-export/qif-imp/assistant-qif-import.c
 gnucash/import-export/qif-imp/dialog-account-picker.c
@@ -508,7 +510,6 @@ gnucash/report/trep-engine.scm
 gnucash/ui/gnc-embedded-register-window.ui
 gnucash/ui/gnc-main-window.ui
 gnucash/ui/gnc-plugin-account-tree.ui
-gnucash/ui/gnc-plugin-aqbanking.ui
 gnucash/ui/gnc-plugin-basic-commands.ui
 gnucash/ui/gnc-plugin-bi-import.ui
 gnucash/ui/gnc-plugin-budget.ui
@@ -518,7 +519,6 @@ gnucash/ui/gnc-plugin-csv-import.ui
 gnucash/ui/gnc-plugin-customer-import.ui
 gnucash/ui/gnc-plugin-file-history.ui
 gnucash/ui/gnc-plugin-log-replay.ui
-gnucash/ui/gnc-plugin-ofx.ui
 gnucash/ui/gnc-plugin-page-account-tree.ui
 gnucash/ui/gnc-plugin-page-budget.ui
 gnucash/ui/gnc-plugin-page-invoice.ui



Summary of changes:
 CMakeLists.txt                                     |  1 +
 common/cmake_modules/CMakeLists.txt                | 17 ++--
 common/cmake_modules/GncGenerateGResources.cmake   | 62 ++++++++++++++
 gnucash/CMakeLists.txt                             | 96 +++++++++++-----------
 gnucash/gnucash-gresources.xml                     | 37 ---------
 gnucash/import-export/aqb/CMakeLists.txt           | 14 +++-
 .../aqb}/ui/gnc-plugin-aqbanking.ui                |  0
 gnucash/import-export/ofx/CMakeLists.txt           | 19 +++--
 .../{ => import-export/ofx}/ui/gnc-plugin-ofx.ui   |  0
 po/POTFILES.in                                     |  4 +-
 10 files changed, 147 insertions(+), 103 deletions(-)
 create mode 100644 common/cmake_modules/GncGenerateGResources.cmake
 delete mode 100644 gnucash/gnucash-gresources.xml
 rename gnucash/{ => import-export/aqb}/ui/gnc-plugin-aqbanking.ui (100%)
 rename gnucash/{ => import-export/ofx}/ui/gnc-plugin-ofx.ui (100%)



More information about the gnucash-changes mailing list