[pangomm/use-dllexport-2-42] Meson: Build pangomm directly as shared library if possible



commit 79d35ffd60741cfbbb71fa44a23a2ea7f9f70d8a
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Thu Mar 19 18:24:55 2020 +0800

    Meson: Build pangomm directly as shared library if possible
    
    Make the build files directly build pangomm as a shared library on:
    -All non-Visual Studio builds
    -Visual Studio builds that have the headers generated from their .hg
     counterparts with gmmproc 2.64.0 or later

 pango/pangomm/meson.build | 68 ++++++++++++++++++++++++++++-------------------
 1 file changed, 40 insertions(+), 28 deletions(-)
---
diff --git a/pango/pangomm/meson.build b/pango/pangomm/meson.build
index 1d85190..c375b00 100644
--- a/pango/pangomm/meson.build
+++ b/pango/pangomm/meson.build
@@ -173,21 +173,40 @@ else # not maintainer_mode
 
 endif
 
-# We need this so that we can run gendef.exe to get the .def file
-# needed for obtaining the .lib file for the pangomm DLL
-pango_int_lib = static_library('pangomm-int',
-  pango_gen_sources, pango_built_headers, extra_cc_files,
-  include_directories: extra_include_dirs,
-  cpp_args: pangomm_cpp_args,
-  dependencies: pangomm_build_dep,
-  install: false,
-)
-
-pangomm_def = []
-pangomm_extra_link_args = []
 extra_pangomm_objects = []
 
-if is_msvc
+# Build the .rc file for Windows builds and link to it
+if host_machine.system() == 'windows'
+  windows = import('windows')
+  pangomm_res = windows.compile_resources(pangomm_rc)
+  extra_pangomm_objects += pangomm_res
+endif
+
+if build_shared_libs_directly
+  pangomm_library = library(pangomm_pcname, extra_pangomm_objects,
+    pango_gen_sources, pango_built_headers, extra_cc_files,
+    include_directories: extra_include_dirs,
+    cpp_args: pangomm_cpp_args,
+    version: pangomm_libversion,
+    dependencies: pangomm_build_dep,
+    install: true,
+  )
+else
+  # Building with headers generated from *.hg files with
+  # gmmproc < 2.64.0 on Visual Studio: We need this so
+  # that we can run gendef.exe to get the .def file
+  # needed for obtaining the .lib file for the pangomm DLL
+  pango_int_lib = static_library('pangomm-int',
+    pango_gen_sources, pango_built_headers, extra_cc_files,
+    include_directories: extra_include_dirs,
+    cpp_args: pangomm_cpp_args,
+    dependencies: pangomm_build_dep,
+    install: false,
+  )
+
+  pangomm_def = []
+  pangomm_extra_link_args = []
+
   pangomm_def = custom_target('pangomm.def',
     output: 'pangomm.def',
     depends: pango_int_lib,
@@ -200,24 +219,17 @@ if is_msvc
     install: false,
   )
   pangomm_extra_link_args = ['/def:@0@'.format(pangomm_def.full_path())]
-endif
 
-# Build the .rc file for Windows builds and link to it
-if host_machine.system() == 'windows'
-  windows = import('windows')
-  pangomm_res = windows.compile_resources(pangomm_rc)
-  extra_pangomm_objects += pangomm_res
+  pangomm_library = library(pangomm_pcname, extra_pangomm_objects,
+    objects: pango_int_lib.extract_all_objects(),
+    version: pangomm_libversion,
+    dependencies: pangomm_build_dep,
+    link_depends: pangomm_def,
+    link_args: pangomm_extra_link_args,
+    install: true,
+  )
 endif
 
-pangomm_library = library(pangomm_pcname, extra_pangomm_objects,
-  objects: pango_int_lib.extract_all_objects(),
-  version: pangomm_libversion,
-  dependencies: pangomm_build_dep,
-  link_depends: pangomm_def,
-  link_args: pangomm_extra_link_args,
-  install: true,
-)
-
 # Install built .h and _p.h files.
 meson.add_install_script(
   python3.path(), generate_binding, 'install_built_h_files',


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