[libsoup/wip/remove-deprecations: 23/49] build: Link tests against static version of libsoup



commit 4191374182f00b94f2d7a8b62a0d4ef705893b5d
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 9241fe96..3df1d453 100644
--- a/libsoup/meson.build
+++ b/libsoup/meson.build
@@ -218,11 +218,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(),
@@ -234,7 +247,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 795381ed..f247e589 100644
--- a/meson.build
+++ b/meson.build
@@ -129,19 +129,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]