[libsoup] build: Link tests against static version of libsoup



commit 1b3b31371f01af8b6081e5358273b4b28ff3489b
Author: Patrick Griffis <pgriffis igalia com>
Date:   Mon Feb 24 13:50:06 2020 -0800

    build: Link tests against static version of libsoup
    
    This allows testing non-public APIs

 libsoup/meson.build | 24 ++++++++++++++++++++++--
 meson.build         |  5 -----
 tests/meson.build   |  2 +-
 3 files changed, 23 insertions(+), 8 deletions(-)
---
diff --git a/libsoup/meson.build b/libsoup/meson.build
index d0b8c645..7ebd5f99 100644
--- a/libsoup/meson.build
+++ b/libsoup/meson.build
@@ -219,11 +219,24 @@ libsoup = library('soup-@0@'.format(apiversion),
   version : libversion,
   soversion : soversion,
   darwin_versions: darwin_versions,
-  c_args : libsoup_c_args + hidden_visibility_flag,
+  c_args : libsoup_c_args,
   include_directories : configinc,
+  gnu_symbol_visibility: 'hidden',
   install : true,
   dependencies : deps)
 
+libsoup_static = static_library('soup-static',
+  sources : [
+    soup_sources,
+    soup_headers,
+    soup_enums,
+  ],
+  c_args : libsoup_c_args,
+  include_directories : configinc,
+  install : true,
+  dependencies : deps,
+)
+
 pkg.generate(libsoup,
   libraries : glib_deps,
   name : meson.project_name(),
@@ -235,7 +248,14 @@ pkg.generate(libsoup,
 libsoup_dep = declare_dependency(link_with : libsoup,
   include_directories : configinc,
   sources : soup_enum_h,
-  dependencies : [ platform_deps, glib_deps ])
+  dependencies : [ platform_deps, glib_deps ]
+)
+
+libsoup_static_dep = declare_dependency(link_with : libsoup_static,
+  include_directories : configinc,
+  sources : soup_enum_h,
+  dependencies : [ platform_deps, glib_deps ]
+)
 
 if enable_introspection or enable_vapi
   soup_gir_args = libsoup_c_args + ['-DLIBSOUP_USE_UNSTABLE_REQUEST_API']
diff --git a/meson.build b/meson.build
index d13a630d..60131e18 100644
--- a/meson.build
+++ b/meson.build
@@ -126,19 +126,14 @@ if brotlidec_dep.found()
 endif
 
 platform_deps = []
-hidden_visibility_flag = []
 is_static_library = get_option('default_library') == 'static'
 if not is_static_library
   if host_machine.system() == 'windows'
     platform_deps = [cc.find_library('ws2_32')]
     cdata.set('DLL_EXPORT', true)
     cdata.set('_SOUP_EXTERN', '__declspec(dllexport) extern')
-    if cc.get_id() != 'msvc'
-      hidden_visibility_flag += ['-fvisibility=hidden']
-    endif
   else
     cdata.set('_SOUP_EXTERN', '__attribute__((visibility("default"))) extern')
-    hidden_visibility_flag += ['-fvisibility=hidden']
   endif
 endif
 
diff --git a/tests/meson.build b/tests/meson.build
index 41d36656..0ce2ba80 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -176,7 +176,7 @@ foreach test: tests
     )
   endif
 
-  test_deps = [ libsoup_dep ] + test[2]
+  test_deps = [ libsoup_static_dep ] + test[2]
   test_target = executable(test_name,
     sources : [ test_name + '.c', test_resources ],
     link_with : test_utils,


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