[pangomm/wip/kjellahl/meson-build] pango/pangomm/meson.build: Fix output from declare_dependency()



commit f5e32e0453c423de05aff550559c6eae16df1dcd
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Mon Oct 14 16:24:12 2019 +0200

    pango/pangomm/meson.build: Fix output from declare_dependency()
    
    * meson.build: Rename pangomm_deps -> pangomm_build_dep to avoid mix-up
    with pangomm_dep in pango/pangomm/meson.build.
    * pango/pangomm/meson.build: Add correct include directories in
    declare_dependency() when maintainer_mode is false. Simplify the code.
    * tools/extra_defs_gen/meson.build: Depend on pangomm_build_dep.

 meson.build                      |  5 ++-
 pango/pangomm/meson.build        | 78 +++++++++++++++++-----------------------
 tools/extra_defs_gen/meson.build |  4 +--
 3 files changed, 39 insertions(+), 48 deletions(-)
---
diff --git a/meson.build b/meson.build
index 5389a54..14f1f27 100644
--- a/meson.build
+++ b/meson.build
@@ -73,13 +73,16 @@ install_datadir = get_option('datadir')
 install_pkgconfigdir = install_libdir / 'pkgconfig'
 
 # Dependencies.
+# pangomm_build_dep: Dependencies when building the pangomm library.
+# pangomm_dep (created in pango/pangomm/meson.build):
+#   Dependencies when using the pangomm library.
 glibmm_req = '>= 2.63.1'
 cairomm_req = '>= 1.15.1'
 pangocairo_req = '>= 1.41.0'
 glibmm_dep = dependency('glibmm-2.64', version: glibmm_req)
 cairomm_dep = dependency('cairomm-1.16', version: cairomm_req)
 pangocairo_dep = dependency('pangocairo', version: pangocairo_req)
-pangomm_deps = [glibmm_dep, cairomm_dep, pangocairo_dep]
+pangomm_build_dep = [glibmm_dep, cairomm_dep, pangocairo_dep]
 pangomm_requires = ' '.join([
   'glibmm-2.64', glibmm_req,
   'cairomm-1.16', cairomm_req,
diff --git a/pango/pangomm/meson.build b/pango/pangomm/meson.build
index 47d723d..16c4f92 100644
--- a/pango/pangomm/meson.build
+++ b/pango/pangomm/meson.build
@@ -1,9 +1,10 @@
 # pango/pangomm
 
-# Input: pangomm_deps, pangomm_pcname, maintainer_mode, project_source_root,
+# Input: pangomm_build_dep, pangomm_pcname, maintainer_mode, project_source_root,
 #        generate_binding, m4_files, pangomm_libversion, install_includedir,
 #        dist_cmd, python3
-# Output: hg_ccg_basenames, extra_h_files, built_file_targets, built_files_root
+# Output: hg_ccg_basenames, extra_h_files, built_file_targets, built_files_root,
+#         pangomm_dep
 
 defs_basefiles = [
   'pango.defs',
@@ -116,33 +117,16 @@ if maintainer_mode
     )
   endforeach
 
+  extra_include_dirs = ['..']
   pangomm_library = library(pangomm_pcname,
     wrap_init_target, built_file_targets, extra_cc_files,
     version: pangomm_libversion,
-    include_directories: '..',
-    dependencies: pangomm_deps,
+    include_directories: extra_include_dirs,
+    dependencies: pangomm_build_dep,
     install: true,
   )
 
-  # Install built .h and _p.h files.
-  meson.add_install_script(
-    python3.path(), generate_binding, 'install_built_h_files',
-    meson.current_build_dir(),
-    install_includedir / pangomm_pcname / 'pangomm', # subdir below {prefix}
-    hg_ccg_basenames
-  )
-
-  if not meson.is_subproject()
-    # Distribute built files.
-    # (add_dist_script() is not allowed in a subproject)
-    meson.add_dist_script(
-      python3.path(), dist_cmd,
-      python3.path(), generate_binding, 'dist_built_files',
-      meson.current_build_dir(),
-      untracked_pangomm,
-      hg_ccg_basenames,
-    )
-  endif
+  built_h_cc_dir = meson.current_build_dir()
 
 else # not maintainer_mode
 
@@ -174,39 +158,43 @@ else # not maintainer_mode
     built_cc_files += src_untracked_pangomm / file + '.cc'
   endforeach
 
+  extra_include_dirs = [ '..', '..' / '..' / 'untracked' / 'pango' ]
   pangomm_library = library(pangomm_pcname,
     built_cc_files, extra_cc_files,
     version: pangomm_libversion,
-    include_directories: [ '..', '..' / '..' / 'untracked' / 'pango' ],
-    dependencies: pangomm_deps,
+    include_directories: extra_include_dirs,
+    dependencies: pangomm_build_dep,
     install: true,
   )
 
-  # Install built .h and _p.h files.
-  meson.add_install_script(
-    python3.path(), generate_binding, 'install_built_h_files',
-    src_untracked_pangomm,
-    install_includedir / pangomm_pcname / 'pangomm', # subdir below {prefix}
-    hg_ccg_basenames
-  )
+  built_h_cc_dir = src_untracked_pangomm
 
-  if not meson.is_subproject()
-    # Distribute built files.
-    # (add_dist_script() is not allowed in a subproject)
-    meson.add_dist_script(
-      python3.path(), dist_cmd,
-      python3.path(), generate_binding, 'dist_built_files',
-      src_untracked_pangomm,
-      untracked_pangomm,
-      hg_ccg_basenames,
-    )
-  endif
+endif
+
+# Install built .h and _p.h files.
+meson.add_install_script(
+  python3.path(), generate_binding, 'install_built_h_files',
+  built_h_cc_dir,
+  install_includedir / pangomm_pcname / 'pangomm', # subdir below {prefix}
+  hg_ccg_basenames
+)
 
+if not meson.is_subproject()
+  # Distribute built files.
+  # (add_dist_script() is not allowed in a subproject)
+  meson.add_dist_script(
+    python3.path(), dist_cmd,
+    python3.path(), generate_binding, 'dist_built_files',
+    built_h_cc_dir,
+    untracked_pangomm,
+    hg_ccg_basenames,
+  )
 endif
 
 # This is useful in the main project when pangomm is used as a subproject.
+# It can also be used if there are example programs and test programs to build.
 pangomm_dep = declare_dependency(
   link_with: pangomm_library,
-  include_directories: '..',
-  dependencies: pangomm_deps
+  include_directories: extra_include_dirs,
+  dependencies: pangomm_build_dep
 )
diff --git a/tools/extra_defs_gen/meson.build b/tools/extra_defs_gen/meson.build
index e4764c9..03d2cd8 100644
--- a/tools/extra_defs_gen/meson.build
+++ b/tools/extra_defs_gen/meson.build
@@ -1,6 +1,6 @@
 # tools/extra_defs_gen
 
-# Input: cpp_compiler, glibmm_dep, pangocairo_dep, install_libdir, pangomm_pcname
+# Input: cpp_compiler, pangomm_build_dep, install_libdir, pangomm_pcname
 # Output: m4_files, install_m4dir
 
 glibmm_generate_extra_defs_dep = cpp_compiler.find_library(
@@ -8,7 +8,7 @@ glibmm_generate_extra_defs_dep = cpp_compiler.find_library(
 )
 
 executable('generate_extra_defs', 'generate_defs_pango.cc',
-  dependencies: [glibmm_dep, pangocairo_dep, glibmm_generate_extra_defs_dep],
+  dependencies: [pangomm_build_dep, glibmm_generate_extra_defs_dep],
   install: false,
 )
 


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