[gnome-builder] meson: use _build if build locality is in-tree
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] meson: use _build if build locality is in-tree
- Date: Tue, 16 Jan 2018 08:50:29 +0000 (UTC)
commit 10f73d53c5e63a631c8dca4f50db8781e87d9656
Author: Christian Hergert <chergert redhat com>
Date: Tue Jan 16 00:40:27 2018 -0800
meson: use _build if build locality is in-tree
If the build configuration requires that the build is in tree,
then use _build inside the source directory.
This can be needed sometimes, such as some meson scripts in the
wild that integrate with Cargo.
src/plugins/meson/gbp-meson-build-system.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
---
diff --git a/src/plugins/meson/gbp-meson-build-system.c b/src/plugins/meson/gbp-meson-build-system.c
index cd2def3af..2813bf2bd 100644
--- a/src/plugins/meson/gbp-meson-build-system.c
+++ b/src/plugins/meson/gbp-meson-build-system.c
@@ -526,6 +526,35 @@ gbp_meson_build_system_get_build_flags_finish (IdeBuildSystem *build_system,
IDE_RETURN (ret);
}
+static gchar *
+gbp_meson_build_system_get_builddir (IdeBuildSystem *build_system,
+ IdeConfiguration *configuration)
+{
+ GbpMesonBuildSystem *self = (GbpMesonBuildSystem *)build_system;
+ IdeBuildLocality locality;
+
+ g_assert (GBP_IS_MESON_BUILD_SYSTEM (self));
+ g_assert (IDE_IS_CONFIGURATION (configuration));
+
+ /*
+ * If the build configuration requires that we do an in tree build (yuck),
+ * then use "_build" as our build directory to build in-tree.
+ */
+
+ locality = ide_configuration_get_locality (configuration);
+
+ if ((locality & IDE_BUILD_LOCALITY_OUT_OF_TREE) == 0)
+ {
+ g_autoptr(GFile) parent = g_file_get_parent (self->project_file);
+ g_autofree gchar *path = g_file_get_path (parent);
+ g_autofree gchar *builddir = g_build_filename (path, "_build", NULL);
+
+ return g_steal_pointer (&builddir);
+ }
+
+ return NULL;
+}
+
static void
build_system_iface_init (IdeBuildSystemInterface *iface)
{
@@ -534,6 +563,7 @@ build_system_iface_init (IdeBuildSystemInterface *iface)
iface->get_priority = gbp_meson_build_system_get_priority;
iface->get_build_flags_async = gbp_meson_build_system_get_build_flags_async;
iface->get_build_flags_finish = gbp_meson_build_system_get_build_flags_finish;
+ iface->get_builddir = gbp_meson_build_system_get_builddir;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]