blob: 109c9b71748dc2cfd4bb04c4eee1fa1fb8b91f4a [file] [log] [blame] [edit]
From 8edf9507de5df116459bdf1d2d7801839a825ae1 Mon Sep 17 00:00:00 2001
From: Alberto Fanjul <albertofanjul@gmail.com>
Date: Wed, 28 Apr 2021 15:28:55 +0200
Subject: [PATCH] Build on windows
---
lib/Application.vala | 2 ++
lib/Services/System.vala | 3 +++
meson.build | 9 ++++++++-
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/lib/Application.vala b/lib/Application.vala
index 4f57855..2f077cc 100644
--- a/lib/Application.vala
+++ b/lib/Application.vala
@@ -154,8 +154,10 @@ namespace Granite {
Granite.Services.Logger.initialize (program_name);
Granite.Services.Logger.DisplayLevel = Granite.Services.LogLevel.INFO;
message ("%s version: %s", program_name, build_version);
+#if ! WINDOWS
var un = Posix.utsname ();
message ("Kernel version: %s", (string) un.release);
+#endif
Granite.Services.Logger.DisplayLevel = Granite.Services.LogLevel.WARN;
Intl.bindtextdomain (exec_name, build_data_dir + "/locale");
diff --git a/lib/Services/System.vala b/lib/Services/System.vala
index 51e5b34..a861144 100644
--- a/lib/Services/System.vala
+++ b/lib/Services/System.vala
@@ -144,9 +144,12 @@ namespace Granite.Services {
return;
AppInfo info;
+
+#if ! WINDOWS
if (app != null)
info = new DesktopAppInfo.from_filename (app.get_path ());
else
+#endif
try {
info = files.first ().data.query_default_handler ();
} catch {
diff --git a/meson.build b/meson.build
index da0f211..6a9eef6 100644
--- a/meson.build
+++ b/meson.build
@@ -22,11 +22,18 @@ elif build_machine.system() == 'freebsd'
vala_os_arg = ['--define=FREE_BSD']
elif build_machine.system() == 'netbsd'
vala_os_arg = ['--define=NET_BSD']
+elif build_machine.system() == 'windows'
+ vala_os_arg = ['--define=WINDOWS']
else
vala_os_arg = []
endif
glib_min_version = '2.50'
+if build_machine.system() == 'windows'
+ gio_os_dep = dependency('gio-windows-2.0', version: '>=' + glib_min_version)
+else
+ gio_os_dep = dependency('gio-unix-2.0', version: '>=' + glib_min_version)
+endif
add_project_arguments(
vala_os_arg,
@@ -39,7 +46,7 @@ add_project_arguments(
libgranite_deps = [
dependency('gee-0.8'),
dependency('gio-2.0', version: '>=' + glib_min_version),
- dependency('gio-unix-2.0', version: '>=' + glib_min_version),
+ gio_os_dep,
dependency('glib-2.0', version: '>=' + glib_min_version),
dependency('gobject-2.0', version: '>=' + glib_min_version),
dependency('gtk+-3.0', version: '>=3.22'),
--
2.30.1