[gnome-calendar] project: don't compile source files twice



commit 647e243bd5f7b17ebe42f1534d8e04d09181d318
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Sep 7 12:07:22 2017 -0300

    project: don't compile source files twice
    
    We can just link with the private library, and use the
    main file to make it an executable. This drops the compile
    time by 43% here.

 contrib/evolution/meson.build |    2 +
 contrib/meson.build           |    2 +
 src/main.c                    |    3 +-
 src/meson.build               |   46 +++++++++++++++++++++++++++++++---------
 4 files changed, 40 insertions(+), 13 deletions(-)
---
diff --git a/contrib/evolution/meson.build b/contrib/evolution/meson.build
index 9a84e22..8b89b6b 100644
--- a/contrib/evolution/meson.build
+++ b/contrib/evolution/meson.build
@@ -1,3 +1,5 @@
+contrib_incs += [ include_directories('.') ]
+
 libevolution_files = files(
   'e-cal-data-model.c',
   'e-cal-data-model-subscriber.c'
diff --git a/contrib/meson.build b/contrib/meson.build
index 5eb8cde..7b3624b 100644
--- a/contrib/meson.build
+++ b/contrib/meson.build
@@ -1 +1,3 @@
+contrib_incs = []
+
 subdir('evolution')
diff --git a/src/main.c b/src/main.c
index 5374277..abb6c88 100644
--- a/src/main.c
+++ b/src/main.c
@@ -17,8 +17,7 @@
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <config.h>
-#include <gtk/gtk.h>
+#include "config.h"
 #include "gcal-application.h"
 
 #include <glib/gi18n.h>
diff --git a/src/meson.build b/src/meson.build
index 2499a46..89cc5e3 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -2,7 +2,7 @@ src_inc = include_directories('.')
 
 enum_headers = files('gcal-utils.h')
 
-calendar_deps = [
+libgcal_deps = [
   gsettings_desktop_schemas_dep,
   libedataserverui_dep,
   libedataserver_dep,
@@ -45,7 +45,6 @@ sources = files(
   'gcal-utils.c',
   'gcal-view.c',
   'gcal-window.c',
-  'main.c'
 )
 
 gnome.mkenums(
@@ -90,6 +89,11 @@ debug_conf = configuration_data()
 debug_conf.set('BUGREPORT_URL', package_bugreport)
 debug_conf.set10('ENABLE_TRACING', enable_tracing)
 
+
+#########
+# Debug #
+#########
+
 debug = 'gcal-debug.h'
 
 sources += configure_file(
@@ -98,28 +102,48 @@ sources += configure_file(
   configuration: debug_conf
 )
 
+
+#######################
+# Include directories #
+#######################
+
 incs = [
   top_inc,
   include_directories('views')
 ]
 
-executable(
-  meson.project_name(),
-               sources,
-   include_directories: incs,
-          dependencies: calendar_deps,
-               install: true,
-           install_dir: calendar_bindir
-)
+incs += contrib_incs
+
+
+###################
+# Private library #
+###################
 
 libgcal = shared_library(
                'gcal',
               sources: sources,
   include_directories: incs,
-         dependencies: calendar_deps
+         dependencies: libgcal_deps
 )
 
 libgcal_dep = declare_dependency(
             link_with: libgcal,
   include_directories: src_inc
 )
+
+
+##################
+# gnome-calendar #
+##################
+
+calendar_deps = libgcal_deps
+calendar_deps += [ libgcal_dep ]
+
+executable(
+  meson.project_name(),
+       files('main.c'),
+   include_directories: incs,
+          dependencies: calendar_deps,
+               install: true,
+           install_dir: calendar_bindir
+)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]