[gtk/wip/chergert/quartz4u: 1/5] build: fix linking support on macOS with Clang



commit 7d395e6da79a41e68db14d13c61e322c3d2576c6
Author: Christian Hergert <chergert redhat com>
Date:   Fri Jul 17 17:57:17 2020 -0700

    build: fix linking support on macOS with Clang
    
    This was preventing any sort of building on macOS, even though the quartz
    backend is currently non-functional. Fixing this is a pre-requisite to
    getting a new macOS backend compiling.

 gdk/meson.build           | 11 ++++++-----
 gtk/meson.build           |  8 +++++++-
 meson.build               |  5 -----
 testsuite/gtk/meson.build |  6 +++++-
 4 files changed, 18 insertions(+), 12 deletions(-)
---
diff --git a/gdk/meson.build b/gdk/meson.build
index ac14c3b6fe..972ec0f166 100644
--- a/gdk/meson.build
+++ b/gdk/meson.build
@@ -216,6 +216,11 @@ if wayland_enabled or broadway_enabled
   endif
 endif
 
+libgdk_c_args = [
+  '-DGTK_COMPILATION',
+  '-DG_LOG_DOMAIN="Gdk"',
+]
+
 gdk_backends = []
 gdk_backends_gen_headers = []  # non-public generated headers
 foreach backend : ['broadway', 'quartz', 'wayland', 'win32', 'x11']
@@ -235,16 +240,12 @@ if gdk_backends.length() == 0
   error('No backends enabled')
 endif
 
-# FIXME: might have to add '-xobjective-c' to c_args for quartz backend?
 libgdk = static_library('gdk',
   sources: [gdk_sources, gdk_backends_gen_headers, gdkconfig],
   dependencies: gdk_deps + [libgtk_css_dep],
   link_with: [libgtk_css, ],
   include_directories: [confinc, gdkx11_inc, wlinc],
-  c_args: [
-    '-DGTK_COMPILATION',
-    '-DG_LOG_DOMAIN="Gdk"',
-  ] + common_cflags,
+  c_args: libgdk_c_args + common_cflags,
   link_whole: gdk_backends,
   link_args: common_ldflags)
 
diff --git a/gtk/meson.build b/gtk/meson.build
index bb08e506a8..9a209b468f 100644
--- a/gtk/meson.build
+++ b/gtk/meson.build
@@ -1053,6 +1053,12 @@ if cc.has_header('langinfo.h')
   endforeach
 endif
 
+# Maintain compatibility with autotools
+gtk_ldflags = []
+if os_darwin
+  gtk_ldflags += [ '-compatibility_version 1', '-current_version 1.0', ]
+endif
+
 # Library
 libgtk = library('gtk-4',
                  soversion: gtk_soversion,
@@ -1062,7 +1068,7 @@ libgtk = library('gtk-4',
                  include_directories: [confinc, gdkinc, gskinc, gtkinc],
                  dependencies: gtk_deps + [libgtk_css_dep, libgdk_dep, libgsk_dep],
                  link_with: [libgtk_css, libgdk, libgsk, ],
-                 link_args: common_ldflags,
+                 link_args: common_ldflags + gtk_ldflags,
                  install: true)
 
 gtk_dep_sources = [gtkversion, gtktypebuiltins_h]
diff --git a/meson.build b/meson.build
index 1b3358fe70..2d33e6fe34 100644
--- a/meson.build
+++ b/meson.build
@@ -314,11 +314,6 @@ if os_unix and not os_darwin
   endforeach
 endif
 
-# Maintain compatibility with autotools
-if os_darwin
-  common_ldflags += [ '-compatibility_version 1', '-current_version 1.0', ]
-endif
-
 confinc = include_directories('.')
 gdkinc = include_directories('gdk')
 gskinc = include_directories('gsk')
diff --git a/testsuite/gtk/meson.build b/testsuite/gtk/meson.build
index 8f1828aa0c..45bbf967d5 100644
--- a/testsuite/gtk/meson.build
+++ b/testsuite/gtk/meson.build
@@ -4,7 +4,11 @@ testdatadir = join_paths(installed_test_datadir, 'gtk')
 gtk_tests_export_dynamic_ldflag = []
 
 if cc.get_id() != 'msvc'
-  gtk_tests_export_dynamic_ldflag = ['-Wl,--export-dynamic']
+  if os_darwin
+    gtk_tests_export_dynamic_ldflag = ['-Wl,-export_dynamic']
+  else
+    gtk_tests_export_dynamic_ldflag = ['-Wl,--export-dynamic']
+  endif
 endif
 
 # Available keys for each test:


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