Remove autotools-only path exception to find reports

With it we can also remove the hack to find standard reports while running
from the build tree.
This commit is contained in:
Geert Janssens 2018-02-28 12:08:37 +01:00
parent e7ec3a610d
commit c29b9c9cbf
2 changed files with 16 additions and 43 deletions

View File

@ -59,14 +59,5 @@ GNC_ADD_SCHEME_TARGETS(scm-standard-reports-2
ADD_CUSTOM_TARGET(scm-standard-reports ALL DEPENDS scm-standard-reports-2 scm-standard-reports-1) ADD_CUSTOM_TARGET(scm-standard-reports ALL DEPENDS scm-standard-reports-2 scm-standard-reports-1)
# FIXME: This is a hack since core-utils assumes an autotools build environment.
SET(STD_RPT_DIR ${CMAKE_CURRENT_BINARY_DIR}/gnucash/report)
FILE(MAKE_DIRECTORY ${STD_RPT_DIR})
FILE(COPY standard-reports.scm DESTINATION ${STD_RPT_DIR})
FILE(MAKE_DIRECTORY ${STD_RPT_DIR}/standard-reports)
FILE(COPY ${standard_reports_SCHEME_2} DESTINATION ${STD_RPT_DIR}/standard-reports)
SET_LOCAL_DIST(standard_reports_DIST_local CMakeLists.txt ${standard_reports_SCHEME} ${standard_reports_SCHEME_2}) SET_LOCAL_DIST(standard_reports_DIST_local CMakeLists.txt ${standard_reports_SCHEME} ${standard_reports_SCHEME_2})
SET(standard_reports_DIST ${standard_reports_DIST_local} ${test_standard_reports_DIST} PARENT_SCOPE) SET(standard_reports_DIST ${standard_reports_DIST_local} ${test_standard_reports_DIST} PARENT_SCOPE)

View File

@ -169,30 +169,21 @@ gchar *gnc_path_get_accountsdir()
* @returns A newly allocated string. */ * @returns A newly allocated string. */
gchar *gnc_path_get_reportdir() gchar *gnc_path_get_reportdir()
{ {
gchar *result; /* Careful: if the cmake variable SCHEME_INSTALLED_SOURCE_DIR gets changed
const gchar *builddir = g_getenv ("GNC_BUILDDIR"); * in toplevel CMakeLists.txt, this path should probably change as well.
if (g_getenv ("GNC_UNINSTALLED") && builddir) * Currently this code assumes SCHEME_INSTALLED_SOURCE_DIR is set to
{ * pkgdatadir/scm
result = g_build_filename (builddir, "gnucash", "report", NULL); * We can't use GNC_SCM_INSTALL_DIR directly at build time to
} * get this information, because on Windows and OS X
else * the final path may get installed in a different location
{ * than assumed during build, invalidating the build path at
/* Careful: if the autoconf macro GNC_SCM_INSTALL_DIR gets changed * runtime.
* in configure.ac, this path should probably change as well. */
* Currently this code assumes GNC_SCM_INSTALL_DIR is set to gchar *pkgdatadir = gnc_path_get_pkgdatadir ();
* pkgdatadir/scm gchar *result = g_build_filename (pkgdatadir, "scm",
* We can't use the AC_MACRO GNC_SCM_INSTALL_DIR here directly "gnucash", "report", (char*)NULL);
* because that's expanded at build time. On Windows and OS X g_free (pkgdatadir);
* the final path may get installed in a different location
* than assumed during build, invalidating the build path at
* runtime.
*/
gchar *pkgdatadir = gnc_path_get_pkgdatadir ();
result = g_build_filename (pkgdatadir, "scm",
"gnucash", "report", (char*)NULL);
g_free (pkgdatadir);
}
//printf("Returning stdreportsdir %s\n", result);
return result; return result;
} }
@ -203,17 +194,8 @@ gchar *gnc_path_get_reportdir()
* @returns A newly allocated string. */ * @returns A newly allocated string. */
gchar *gnc_path_get_stdreportsdir() gchar *gnc_path_get_stdreportsdir()
{ {
gchar *result;
gchar *reportdir = gnc_path_get_reportdir (); gchar *reportdir = gnc_path_get_reportdir ();
if (g_getenv ("GNC_UNINSTALLED")) gchar *result = g_build_filename (reportdir, "standard-reports", NULL);
{
result = g_build_filename (reportdir, "standard-reports", "gnucash",
"report", "standard-reports", NULL);
}
else
{
result = g_build_filename (reportdir, "standard-reports", NULL);
}
g_free (reportdir); g_free (reportdir);
//printf("Returning stdreportsdir %s\n", result); //printf("Returning stdreportsdir %s\n", result);
return result; return result;