[anjuta] project-wizard: bgo #688611 - Make templates Windows portable
- From: Sebastien Granjoux <sgranjoux src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] project-wizard: bgo #688611 - Make templates Windows portable
- Date: Sat, 13 Apr 2013 09:11:05 +0000 (UTC)
commit a49059109cca559eae9a8a58c1883569fd9f2d56
Author: Arnel A. Borja <kyoushuu yahoo com>
Date: Wed Apr 10 01:58:09 2013 +0800
project-wizard: bgo #688611 - Make templates Windows portable
- Check for Windows in configure.ac templates.
- Add win32-dll to LT_INIT options.
- Add -mwindows to LDFLAGS of GUI applications if compiling for native
Windows.
- Add -no-undefined to LDFLAGS of libraries if compiling for Windows.
- Replace -Wl,--export-dynamic with -Wl,--export-all-symbols in LDFLAGS of
applications if compiling for Windows.
- Add Windows support option to wizards.
Affected templates are cpp, gtk, gtkapplication, gtkmm, library, terminal
and vala-gtk.
plugins/project-wizard/templates/cpp.wiz.in | 1 +
.../project-wizard/templates/cpp/configure.ac.tpl | 34 +++++++++-
.../templates/cpp/src/Makefile.am.tpl | 5 ++
plugins/project-wizard/templates/gtk.wiz.in | 1 +
.../templates/gtk/src/Makefile.am.tpl | 18 +++++-
plugins/project-wizard/templates/gtk/src/main.c | 74 ++++++++++++++++++----
.../project-wizard/templates/gtkapplication.wiz.in | 1 +
.../templates/gtkapplication/src/Makefile.am.tpl | 18 +++++-
plugins/project-wizard/templates/gtkmm.wiz.in | 1 +
.../templates/gtkmm/src/Makefile.am.tpl | 6 ++
plugins/project-wizard/templates/library.wiz.in | 1 +
.../templates/library/configure.ac.tpl | 31 ++++++++-
.../templates/library/src/Makefile.am.tpl | 10 +++
plugins/project-wizard/templates/terminal.wiz.in | 1 +
.../templates/terminal/configure.ac.tpl | 34 +++++++++-
plugins/project-wizard/templates/vala-gtk.wiz.in | 1 +
.../templates/vala-gtk/configure.ac.tpl | 34 +++++++++-
.../templates/vala-gtk/src/Makefile.am.tpl | 18 +++++-
18 files changed, 265 insertions(+), 24 deletions(-)
---
diff --git a/plugins/project-wizard/templates/cpp.wiz.in b/plugins/project-wizard/templates/cpp.wiz.in
index 01a6415..92eeb85 100644
--- a/plugins/project-wizard/templates/cpp.wiz.in
+++ b/plugins/project-wizard/templates/cpp.wiz.in
@@ -27,6 +27,7 @@
<property type="boolean" name="HaveSharedlib" _label="Add shared library support:"
_description="Adds support for building shared libraries in your project" default="1"/>
<property type="boolean" name="HaveI18n" _label="Add internationalization:"
_description="Adds support for internationalization so that your project can have translations in different
languages" default="1"/>
<property type="boolean" name="HavePackage" _label="Configure external packages:"
_description="Use pkg-config to add library support from other packages" default="0"/>
+ <property type="boolean" name="HaveWindowsSupport" _label="Add Windows support:"
_description="Adds support for building on Windows platforms" default="0"/>
</page>
[+IF (=(get "HavePackage") "1")+]
diff --git a/plugins/project-wizard/templates/cpp/configure.ac.tpl
b/plugins/project-wizard/templates/cpp/configure.ac.tpl
index 640ca89..19b6d2c 100644
--- a/plugins/project-wizard/templates/cpp/configure.ac.tpl
+++ b/plugins/project-wizard/templates/cpp/configure.ac.tpl
@@ -29,9 +29,37 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [GETTEXT package name])
AM_GLIB_GNU_GETTEXT
[+ENDIF+]
-[+IF (=(get "HaveSharedlib") "1")+]
-LT_INIT
-[+ENDIF+]
+[+IF (=(get "HaveWindowsSupport") "1")+]
+dnl ***************************************************************************
+dnl Check for Windows
+dnl ***************************************************************************
+AC_CANONICAL_HOST
+
+case $host_os in
+ *mingw*)
+ platform_win32=yes
+ native_win32=yes
+ ;;
+ pw32* | *cygwin*)
+ platform_win32=yes
+ native_win32=no
+ ;;
+ *)
+ platform_win32=no
+ native_win32=no
+ ;;
+esac
+AM_CONDITIONAL(PLATFORM_WIN32, test x"$platform_win32" = "xyes")
+AM_CONDITIONAL(NATIVE_WIN32, test x"$native_win32" = "xyes")[+
+ENDIF+]
+
+[+IF (=(get "HaveSharedlib") "1")+][+
+IF (=(get "HaveWindowsSupport") "1")+]
+LT_INIT([win32-dll])[+
+ELSE+]
+LT_INIT[+
+ENDIF+][+
+ENDIF+]
[+IF (=(get "HavePackage") "1")+]
PKG_CHECK_MODULES([+NameCUpper+], [[+PackageModule1+] [+PackageModule2+]])
diff --git a/plugins/project-wizard/templates/cpp/src/Makefile.am.tpl
b/plugins/project-wizard/templates/cpp/src/Makefile.am.tpl
index 28f4f76..7c0316e 100644
--- a/plugins/project-wizard/templates/cpp/src/Makefile.am.tpl
+++ b/plugins/project-wizard/templates/cpp/src/Makefile.am.tpl
@@ -22,3 +22,8 @@ bin_PROGRAMS = [+NameHLower+]
[+NameCLower+]_LDADD = [+IF (=(get "HavePackage") "1")+]$([+NameCUpper+]_LIBS)[+ENDIF+]
+[+IF (=(get "HaveWindowsSupport") "1")+]
+if NATIVE_WIN32
+[+NameCLower+]_LDFLAGS += -mwindows
+endif[+
+ENDIF+]
diff --git a/plugins/project-wizard/templates/gtk.wiz.in b/plugins/project-wizard/templates/gtk.wiz.in
index 852c018..5a858b9 100644
--- a/plugins/project-wizard/templates/gtk.wiz.in
+++ b/plugins/project-wizard/templates/gtk.wiz.in
@@ -34,6 +34,7 @@
<property type="boolean" name="HaveGtkDoc" _label="Add gtk-doc system:" _description="gtk-doc
is used to compile API documentations for GObject based classes" default="0"/>
<property type="boolean" name="HavePackageExtra" _label="Configure external packages:"
_description="Use pkg-config to add library support from other packages" default="0"/>
<property type="boolean" name="HaveBuilderUI" _label="Use GtkBuilder for user interface:"
_description="Use GtkBuilder to create the user-interface in a graphical way and load it from xml files at
runtime" default="1"/>
+ <property type="boolean" name="HaveWindowsSupport" _label="Add Windows support:"
_description="Adds support for building on Windows platforms" default="0"/>
</page>
[+IF (=(get "HavePackageExtra") "1")+]
diff --git a/plugins/project-wizard/templates/gtk/src/Makefile.am.tpl
b/plugins/project-wizard/templates/gtk/src/Makefile.am.tpl
index d01c41c..be5f637 100644
--- a/plugins/project-wizard/templates/gtk/src/Makefile.am.tpl
+++ b/plugins/project-wizard/templates/gtk/src/Makefile.am.tpl
@@ -23,11 +23,27 @@ bin_PROGRAMS = [+NameHLower+]
[+NameCLower+]_SOURCES = \
main.c
+[+IF (=(get "HaveWindowsSupport") "1")+]
+[+NameCLower+]_LDFLAGS =[+
+ELSE+]
[+NameCLower+]_LDFLAGS = \
- -Wl,--export-dynamic
+ -Wl,--export-dynamic[+
+ENDIF+]
[+NameCLower+]_LDADD = $([+NameCUpper+]_LIBS)
+[+IF (=(get "HaveWindowsSupport") "1")+]
+if PLATFORM_WIN32
+[+NameCLower+]_LDFLAGS += -Wl,--export-all-symbols
+else
+[+NameCLower+]_LDFLAGS += -Wl,--export-dynamic
+endif
+
+if NATIVE_WIN32
+[+NameCLower+]_LDFLAGS += -mwindows
+endif[+
+ENDIF+]
+
[+IF (=(get "HaveBuilderUI") "1")+]
EXTRA_DIST = $(ui_DATA)
diff --git a/plugins/project-wizard/templates/gtk/src/main.c b/plugins/project-wizard/templates/gtk/src/main.c
index 97d8024..f0e53e4 100644
--- a/plugins/project-wizard/templates/gtk/src/main.c
+++ b/plugins/project-wizard/templates/gtk/src/main.c
@@ -26,9 +26,21 @@ static struct _Private
static struct Private* priv = NULL;
-/* For testing propose use the local (not installed) ui file */
-/* #define UI_FILE PACKAGE_DATA_DIR"/ui/[+NameHLower+].ui" */
+/* For testing purpose, define TEST to use the local (not installed) ui file */
+#define TEST
+#ifdef TEST
#define UI_FILE "src/[+NameHLower+].ui"
+#else
+[+IF (=(get "HaveWindowsSupport") "1")\+]
+#ifdef G_OS_WIN32
+#define UI_FILE ui_file
+#else
+[+ENDIF\+]
+#define UI_FILE PACKAGE_DATA_DIR"/ui/[+NameHLower+].ui"
+[+IF (=(get "HaveWindowsSupport") "1")\+]
+#endif
+[+ENDIF\+]
+#endif
#define TOP_WINDOW "window"
/* Signal handlers */
@@ -46,6 +58,13 @@ destroy (GtkWidget *widget, gpointer data)
static GtkWidget*
create_window (void)
{
+[+IF (=(get "HaveWindowsSupport") "1")\+]
+#if !defined(TEST) && defined(G_OS_WIN32)
+ gchar *prefix = g_win32_get_package_installation_directory_of_module (NULL);
+ gchar *datadir = g_build_filename (prefix, "share", PACKAGE, NULL);
+ gchar *ui_file = g_build_filename (datadir, "ui", "[+NameHLower+].ui", NULL);
+#endif
+[+ENDIF\+]
GtkWidget *window;
GtkBuilder *builder;
GError* error = NULL;
@@ -74,10 +93,18 @@ create_window (void)
/* ANJUTA: Widgets initialization for [+NameHLower+].ui - DO NOT REMOVE */
g_object_unref (builder);
+
+[+IF (=(get "HaveWindowsSupport") "1")+]
+#if !defined(TEST) && defined(G_OS_WIN32)
+ g_free (prefix);
+ g_free (datadir);
+ g_free (ui_file);
+#endif
+[+ENDIF\+]
return window;
-}
-[+ELSE+]
+}[+
+ELSE+]
static GtkWidget*
create_window (void)
{
@@ -90,21 +117,36 @@ create_window (void)
g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
return window;
-}
-[+ENDIF+]
+}[+
+ENDIF+]
int
main (int argc, char *argv[])
{
GtkWidget *window;
-[+IF (=(get "HaveI18n") "1")+]
+[+IF (=(get "HaveI18n") "1")+][+
+IF (=(get "HaveWindowsSupport") "1")+]
+#ifdef G_OS_WIN32
+ gchar *prefix = g_win32_get_package_installation_directory_of_module (NULL);
+ gchar *localedir = g_build_filename (prefix, "share", "locale", NULL);
+#endif[+
+ENDIF+]
+
#ifdef ENABLE_NLS
+[+IF (=(get "HaveWindowsSupport") "1")+]
+# ifndef G_OS_WIN32
bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
+# else
+ bindtextdomain (GETTEXT_PACKAGE, localedir);
+# endif[+
+ELSE+]
+ bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);[+
+ENDIF+]
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
-#endif
-[+ENDIF+]
+#endif[+
+ENDIF+]
gtk_init (&argc, &argv);
@@ -112,9 +154,19 @@ main (int argc, char *argv[])
gtk_widget_show (window);
gtk_main ();
+
[+IF (=(get "HaveBuilderUI") "1")+]
- g_free (priv);
-[+ENDIF+]
+ g_free (priv);[+
+ENDIF+]
+[+IF (=(get "HaveI18n") "1")+][+
+IF (=(get "HaveWindowsSupport") "1")+]
+#ifdef G_OS_WIN32
+ g_free (prefix);
+ g_free (localedir);
+#endif[+
+ENDIF+][+
+ENDIF+]
+
return 0;
}
[+INVOKE END-INDENT\+]
diff --git a/plugins/project-wizard/templates/gtkapplication.wiz.in
b/plugins/project-wizard/templates/gtkapplication.wiz.in
index dd8e1e5..4e2c76a 100644
--- a/plugins/project-wizard/templates/gtkapplication.wiz.in
+++ b/plugins/project-wizard/templates/gtkapplication.wiz.in
@@ -35,6 +35,7 @@
<property type="boolean" name="HaveGtkDoc" _label="Add gtk-doc system:" _description="gtk-doc
is used to compile API documentations for GObject based classes" default="0"/>
<property type="boolean" name="HavePackageExtra" _label="Configure external packages:"
_description="Use pkg-config to add library support from other packages" default="0"/>
<property type="boolean" name="HaveBuilderUI" _label="Use GtkBuilder for user interface:"
_description="Use GtkBuilder to create the user-interface in a graphical way and load it from xml files at
runtime" default="1"/>
+ <property type="boolean" name="HaveWindowsSupport" _label="Add Windows support:"
_description="Adds support for building on Windows platforms" default="0"/>
</page>
[+IF (=(get "HavePackageExtra") "1")+]
diff --git a/plugins/project-wizard/templates/gtkapplication/src/Makefile.am.tpl
b/plugins/project-wizard/templates/gtkapplication/src/Makefile.am.tpl
index fbd5dcf..f130d02 100644
--- a/plugins/project-wizard/templates/gtkapplication/src/Makefile.am.tpl
+++ b/plugins/project-wizard/templates/gtkapplication/src/Makefile.am.tpl
@@ -25,11 +25,27 @@ bin_PROGRAMS = [+NameHLower+]
[+NameLower+].h \
[+NameLower+].c
+[+IF (=(get "HaveWindowsSupport") "1")+]
+[+NameCLower+]_LDFLAGS =[+
+ELSE+]
[+NameCLower+]_LDFLAGS = \
- -Wl,--export-dynamic
+ -Wl,--export-dynamic[+
+ENDIF+]
[+NameCLower+]_LDADD = $([+NameCUpper+]_LIBS)
+[+IF (=(get "HaveWindowsSupport") "1")+]
+if PLATFORM_WIN32
+[+NameCLower+]_LDFLAGS += -Wl,--export-all-symbols
+else
+[+NameCLower+]_LDFLAGS += -Wl,--export-dynamic
+endif
+
+if NATIVE_WIN32
+[+NameCLower+]_LDFLAGS += -mwindows
+endif[+
+ENDIF+]
+
[+IF (=(get "HaveBuilderUI") "1")+]
EXTRA_DIST = $(ui_DATA)
diff --git a/plugins/project-wizard/templates/gtkmm.wiz.in b/plugins/project-wizard/templates/gtkmm.wiz.in
index 61b76e8..97d9fc5 100644
--- a/plugins/project-wizard/templates/gtkmm.wiz.in
+++ b/plugins/project-wizard/templates/gtkmm.wiz.in
@@ -33,6 +33,7 @@
<property type="hidden" name="HaveGtkDoc" _label="Add gtk-doc system:" _description="gtk-doc
is used to compile API documentations for GObject based classes" default="0"/>
<property type="boolean" name="HavePackageExtra" _label="Configure external packages:"
_description="Use pkg-config to add library support from other packages" default="0"/>
<property type="boolean" name="HaveBuilderUI" _label="Use GtkBuilder for user interface:"
_description="Use GtkBuilder to create the user-interface in a graphical way and load it from xml files at
runtime" default="1"/>
+ <property type="boolean" name="HaveWindowsSupport" _label="Add Windows support:"
_description="Adds support for building on Windows platforms" default="0"/>
</page>
[+IF (=(get "HavePackageExtra") "1")+]
diff --git a/plugins/project-wizard/templates/gtkmm/src/Makefile.am.tpl
b/plugins/project-wizard/templates/gtkmm/src/Makefile.am.tpl
index 079c1a8..e126a78 100644
--- a/plugins/project-wizard/templates/gtkmm/src/Makefile.am.tpl
+++ b/plugins/project-wizard/templates/gtkmm/src/Makefile.am.tpl
@@ -27,6 +27,12 @@ bin_PROGRAMS = [+NameHLower+]
[+NameCLower+]_LDADD = $([+NameCUpper+]_LIBS)
+[+IF (=(get "HaveWindowsSupport") "1")+]
+if NATIVE_WIN32
+[+NameCLower+]_LDFLAGS += -mwindows
+endif
+[+ENDIF+]
+
[+IF (=(get "HaveBuilderUI") "1")+]
EXTRA_DIST = $(ui_DATA)
diff --git a/plugins/project-wizard/templates/library.wiz.in b/plugins/project-wizard/templates/library.wiz.in
index 7f1489c..f7ebdb4 100644
--- a/plugins/project-wizard/templates/library.wiz.in
+++ b/plugins/project-wizard/templates/library.wiz.in
@@ -33,6 +33,7 @@
<property type="boolean" name="HaveLangCPP" _label="Add C++ support:" _description="Adds C++
support to the project so that C++ source files can be built" default="0"/>
<property type="boolean" name="HaveI18n" _label="Add internationalization:"
_description="Adds support for internationalization so that your project can have translations in different
languages" default="1"/>
<property type="boolean" name="HavePackage" _label="Configure external packages:"
_description="Use pkg-config to add library support from other packages" default="0"/>
+ <property type="boolean" name="HaveWindowsSupport" _label="Add Windows support:"
_description="Adds support for building on Windows platforms" default="0"/>
</page>
[+IF (=(get "HavePackage") "1")+]
diff --git a/plugins/project-wizard/templates/library/configure.ac.tpl
b/plugins/project-wizard/templates/library/configure.ac.tpl
index eabc296..886bb66 100644
--- a/plugins/project-wizard/templates/library/configure.ac.tpl
+++ b/plugins/project-wizard/templates/library/configure.ac.tpl
@@ -29,10 +29,39 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [GETTEXT package name])
AM_GLIB_GNU_GETTEXT
[+ENDIF+]
+[+IF (=(get "HaveWindowsSupport") "1")+]
+dnl ***************************************************************************
+dnl Check for Windows
+dnl ***************************************************************************
+AC_CANONICAL_HOST
+
+case $host_os in
+ *mingw*)
+ platform_win32=yes
+ native_win32=yes
+ ;;
+ pw32* | *cygwin*)
+ platform_win32=yes
+ native_win32=no
+ ;;
+ *)
+ platform_win32=no
+ native_win32=no
+ ;;
+esac
+AM_CONDITIONAL(PLATFORM_WIN32, test x"$platform_win32" = "xyes")
+AM_CONDITIONAL(NATIVE_WIN32, test x"$native_win32" = "xyes")[+
+ENDIF+]
+
[+CASE (get "LibraryType") +]
[+ == "Static" +]AC_DISABLE_SHARED
[+ == "Shared" +]AC_DISABLE_STATIC
-[+ESAC+]LT_INIT
+[+ESAC+][+
+IF (=(get "HaveWindowsSupport") "1")+]
+LT_INIT([win32-dll])[+
+ELSE+]
+LT_INIT[+
+ENDIF+]
[+IF (=(get "HavePackage") "1")+]
PKG_CHECK_MODULES([+NameCUpper+], [[+PackageModule1+] [+PackageModule2+]])
diff --git a/plugins/project-wizard/templates/library/src/Makefile.am.tpl
b/plugins/project-wizard/templates/library/src/Makefile.am.tpl
index e71f901..913ac67 100644
--- a/plugins/project-wizard/templates/library/src/Makefile.am.tpl
+++ b/plugins/project-wizard/templates/library/src/Makefile.am.tpl
@@ -37,6 +37,16 @@ lib_LTLIBRARIES = [+(prefix_if_missing "NameHLower" "lib")+].la
[+(prefix_if_missing "NameCLower" "lib")+]_la_LIBADD = [+IF (=(get "HavePackage")
"1")+]$([+NameCUpper+]_LIBS)[+ENDIF+]
+[+IF (=(get "HaveWindowsSupport") "1")+]
+if PLATFORM_WIN32
+[+(prefix_if_missing "NameCLower" "lib")+]_la_LDFLAGS += -no-undefined
+endif
+
+if NATIVE_WIN32
+[+(prefix_if_missing "NameCLower" "lib")+]_la_LDFLAGS += -export-dynamic
+endif[+
+ENDIF+]
+
include_HEADERS = \
[+NameHLower+].h
diff --git a/plugins/project-wizard/templates/terminal.wiz.in
b/plugins/project-wizard/templates/terminal.wiz.in
index 9adbde3..938d691 100644
--- a/plugins/project-wizard/templates/terminal.wiz.in
+++ b/plugins/project-wizard/templates/terminal.wiz.in
@@ -28,6 +28,7 @@
<property type="boolean" name="HaveSharedlib" _label="Add shared library support:"
_description="Adds support for building shared libraries in your project" default="1"/>
<property type="boolean" name="HaveI18n" _label="Add internationalization:"
_description="Adds support for internationalization so that your project can have translations in different
languages" default="1"/>
<property type="boolean" name="HavePackage" _label="Configure external packages:"
_description="Use pkg-config to add library support from other packages" default="0"/>
+ <property type="boolean" name="HaveWindowsSupport" _label="Add Windows support:"
_description="Adds support for building on Windows platforms" default="0"/>
</page>
[+IF (=(get "HavePackage") "1")+]
diff --git a/plugins/project-wizard/templates/terminal/configure.ac.tpl
b/plugins/project-wizard/templates/terminal/configure.ac.tpl
index 34e517a..052b02c 100644
--- a/plugins/project-wizard/templates/terminal/configure.ac.tpl
+++ b/plugins/project-wizard/templates/terminal/configure.ac.tpl
@@ -30,9 +30,37 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [GETTEXT package name])
AM_GLIB_GNU_GETTEXT
[+ENDIF+]
-[+IF (=(get "HaveSharedlib") "1")+]
-LT_INIT
-[+ENDIF+]
+[+IF (=(get "HaveWindowsSupport") "1")+]
+dnl ***************************************************************************
+dnl Check for Windows
+dnl ***************************************************************************
+AC_CANONICAL_HOST
+
+case $host_os in
+ *mingw*)
+ platform_win32=yes
+ native_win32=yes
+ ;;
+ pw32* | *cygwin*)
+ platform_win32=yes
+ native_win32=no
+ ;;
+ *)
+ platform_win32=no
+ native_win32=no
+ ;;
+esac
+AM_CONDITIONAL(PLATFORM_WIN32, test x"$platform_win32" = "xyes")
+AM_CONDITIONAL(NATIVE_WIN32, test x"$native_win32" = "xyes")[+
+ENDIF+]
+
+[+IF (=(get "HaveSharedlib") "1")+][+
+IF (=(get "HaveWindowsSupport") "1")+]
+LT_INIT([win32-dll])[+
+ELSE+]
+LT_INIT[+
+ENDIF+][+
+ENDIF+]
[+IF (=(get "HavePackage") "1")+]
PKG_CHECK_MODULES([+NameCUpper+], [[+PackageModule1+] [+PackageModule2+]])
diff --git a/plugins/project-wizard/templates/vala-gtk.wiz.in
b/plugins/project-wizard/templates/vala-gtk.wiz.in
index a742961..d8f1d34 100644
--- a/plugins/project-wizard/templates/vala-gtk.wiz.in
+++ b/plugins/project-wizard/templates/vala-gtk.wiz.in
@@ -32,6 +32,7 @@
<property type="boolean" name="HaveSharedlib" _label="Add shared library support:"
_description="Adds support for building shared libraries in your project" default="1"/>
<property type="boolean" name="HavePackageExtra" _label="Configure external packages:"
_description="Use pkg-config to add library support from other packages" default="0"/>
<property type="boolean" name="HaveBuilderUI" _label="Use GtkBuilder for user interface:"
_description="Use GtkBuilder to create the user-interface in a graphical way and load it from xml files at
runtime" default="1"/>
+ <property type="boolean" name="HaveWindowsSupport" _label="Add Windows support:"
_description="Adds support for building on Windows platforms" default="0"/>
</page>
[+IF (=(get "HavePackageExtra") "1")+]
diff --git a/plugins/project-wizard/templates/vala-gtk/configure.ac.tpl
b/plugins/project-wizard/templates/vala-gtk/configure.ac.tpl
index debd2af..ef9ff48 100644
--- a/plugins/project-wizard/templates/vala-gtk/configure.ac.tpl
+++ b/plugins/project-wizard/templates/vala-gtk/configure.ac.tpl
@@ -12,9 +12,37 @@ AM_SILENT_RULES([yes])
AC_PROG_CC
-[+IF (=(get "HaveSharedlib") "1")+]
-LT_INIT
-[+ENDIF+]
+[+IF (=(get "HaveWindowsSupport") "1")+]
+dnl ***************************************************************************
+dnl Check for Windows
+dnl ***************************************************************************
+AC_CANONICAL_HOST
+
+case $host_os in
+ *mingw*)
+ platform_win32=yes
+ native_win32=yes
+ ;;
+ pw32* | *cygwin*)
+ platform_win32=yes
+ native_win32=no
+ ;;
+ *)
+ platform_win32=no
+ native_win32=no
+ ;;
+esac
+AM_CONDITIONAL(PLATFORM_WIN32, test x"$platform_win32" = "xyes")
+AM_CONDITIONAL(NATIVE_WIN32, test x"$native_win32" = "xyes")[+
+ENDIF+]
+
+[+IF (=(get "HaveSharedlib") "1")+][+
+IF (=(get "HaveWindowsSupport") "1")+]
+LT_INIT([win32-dll])[+
+ELSE+]
+LT_INIT[+
+ENDIF+][+
+ENDIF+]
dnl Check for vala
AM_PROG_VALAC([0.10.0])
diff --git a/plugins/project-wizard/templates/vala-gtk/src/Makefile.am.tpl
b/plugins/project-wizard/templates/vala-gtk/src/Makefile.am.tpl
index b8f89f9..7043748 100644
--- a/plugins/project-wizard/templates/vala-gtk/src/Makefile.am.tpl
+++ b/plugins/project-wizard/templates/vala-gtk/src/Makefile.am.tpl
@@ -26,11 +26,27 @@ bin_PROGRAMS = [+NameHLower+]
[+NameCLower+]_VALAFLAGS = [+IF (not (= (get "PackageModule2") ""))+] --pkg [+(string-substitute (get
"PackageModule2") " " " --pkg ")+] [+ENDIF+] \
--pkg gtk+-3.0
+[+IF (=(get "HaveWindowsSupport") "1")+]
+[+NameCLower+]_LDFLAGS =[+
+ELSE+]
[+NameCLower+]_LDFLAGS = \
- -Wl,--export-dynamic
+ -Wl,--export-dynamic[+
+ENDIF+]
[+NameCLower+]_LDADD = $([+NameCUpper+]_LIBS)
+[+IF (=(get "HaveWindowsSupport") "1")+]
+if PLATFORM_WIN32
+[+NameCLower+]_LDFLAGS += -Wl,--export-all-symbols
+else
+[+NameCLower+]_LDFLAGS += -Wl,--export-dynamic
+endif
+
+if NATIVE_WIN32
+[+NameCLower+]_LDFLAGS += -mwindows
+endif[+
+ENDIF+]
+
[+IF (=(get "HaveBuilderUI") "1")+]
EXTRA_DIST = $(ui_DATA)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]