[gtkmm/use-dllexport-3-24-meson: 8/8] Meson: Fix building when gendef.exe is used



commit 15d7389bd912406fc46cccd67c39f9e90328d8ce
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Wed May 13 18:39:49 2020 +0800

    Meson: Fix building when gendef.exe is used
    
    When gendef.exe is used, the gtkmm library must link to the gdkmm library, as
    we do when gendef.exe is not used.  Also, make sure that we do apply
    '-DGDKMM_USE_GENDEF' and '-DGTKMM_USE_GENDEF' as necessary

 demos/gtk-demo/meson.build | 3 ++-
 gdk/gdkmm/meson.build      | 9 +++------
 gtk/gtkmm/meson.build      | 9 +++------
 meson.build                | 6 ++++++
 tests/meson.build          | 3 ++-
 5 files changed, 16 insertions(+), 14 deletions(-)
---
diff --git a/demos/gtk-demo/meson.build b/demos/gtk-demo/meson.build
index 3faf21a0..850d5ce8 100644
--- a/demos/gtk-demo/meson.build
+++ b/demos/gtk-demo/meson.build
@@ -1,6 +1,6 @@
 # demos/gtk-demo
 
-# Input: gtkmm_dep, epoxy_dep, build_demos, gui_app_ldflags
+# Input: gtkmm_dep, epoxy_dep, build_demos, gui_app_ldflags, gtkmm_extra_gendef_cpp_args
 # Output: -
 
 gtkmm_demo_cc_files = [
@@ -50,6 +50,7 @@ if epoxy_dep.found()
     gui_app: true,
     build_by_default: build_demos,
     link_args: gui_app_ldflags,
+    cpp_args: gtkmm_extra_gendef_cpp_args,
     install: false,
   )
 endif
diff --git a/gdk/gdkmm/meson.build b/gdk/gdkmm/meson.build
index 0e4b6169..22dc4648 100644
--- a/gdk/gdkmm/meson.build
+++ b/gdk/gdkmm/meson.build
@@ -3,7 +3,8 @@
 # Input: gdkmm_build_dep, gdkmm_pcname, maintainer_mode, project_source_root,
 #        generate_binding_py, m4_files, gtkmm_libversion, install_includedir,
 #        python3, gdkmm_rc, dummy_header_py, gmmproc_dir, build_shared_libs_directly,
-#        build_deprecated_api, gmmproc_extra_m4_dirs, is_host_windows
+#        build_deprecated_api, gmmproc_extra_m4_dirs, is_host_windows,
+#        gdkmm_extra_gendef_cpp_args
 # Output: gdkmm_hg_ccg_basenames, gdkmm_extra_h_files, built_files_root,
 #         gdkmm_built_h_file_targets, gdkmm_used_built_h_file_targets, gdkmm_dep
 
@@ -85,11 +86,7 @@ install_headers(gdkmm_extra_h_files, subdir: gdkmm_pcname / 'gdkmm')
 untracked_gdkmm = 'untracked' / 'gdk' / 'gdkmm'
 src_untracked_gdkmm = project_source_root / untracked_gdkmm
 
-gdkmm_cpp_args = [ '-DGDKMM_BUILD=1' ]
-
-if is_msvc and not build_shared_libs_directly
-  gdkmm_cpp_args += '-DGDKMM_USE_GENDEF'
-endif
+gdkmm_cpp_args = [ '-DGDKMM_BUILD=1' ] + gdkmm_extra_gendef_cpp_args
 
 if maintainer_mode
 
diff --git a/gtk/gtkmm/meson.build b/gtk/gtkmm/meson.build
index 596869d5..c8ffbd43 100644
--- a/gtk/gtkmm/meson.build
+++ b/gtk/gtkmm/meson.build
@@ -4,7 +4,7 @@
 #        generate_binding_py, m4_files, gtkmm_libversion, install_includedir,
 #        python3, gtkmm_rc, dummy_header_py, gmmproc_dir, build_shared_libs_directly,
 #        build_deprecated_api, build_x11_api, gmmproc_extra_m4_dirs, is_host_windows,
-#        gdkmm_library, gdkmm_used_built_h_file_targets
+#        gdkmm_library, gdkmm_used_built_h_file_targets, gtkmm_extra_gendef_cpp_args
 # Output: gtkmm_hg_ccg_basenames, gtkmm_extra_h_files, built_files_root,
 #         gtkmm_built_h_file_targets, gtkmm_dep
 
@@ -349,11 +349,7 @@ install_headers(gtkmm_extra_ph_files, subdir: gtkmm_pcname / 'gtkmm' / 'private'
 untracked_gtkmm = 'untracked' / 'gtk' / 'gtkmm'
 src_untracked_gtkmm = project_source_root / untracked_gtkmm
 
-gtkmm_cpp_args = [ '-DGTKMM_BUILD=1' ]
-
-if is_msvc and not build_shared_libs_directly
-  gtkmm_cpp_args += '-DGTKMM_USE_GENDEF'
-endif
+gtkmm_cpp_args = [ '-DGTKMM_BUILD=1' ] + gtkmm_extra_gendef_cpp_args
 
 if maintainer_mode
 
@@ -534,6 +530,7 @@ else
     dependencies: gtkmm_build_dep,
     link_depends: gtkmm_def,
     link_args: gtkmm_extra_link_args,
+    link_with: gdkmm_library,
     install: true,
   )
 endif
diff --git a/meson.build b/meson.build
index 5480533d..39ff925e 100644
--- a/meson.build
+++ b/meson.build
@@ -223,6 +223,8 @@ gtkmm_script_dir = project_source_root / 'tools'
 dummy_header_py = gtkmm_script_dir / 'dummy-header.py'
 
 # Do we build the gdkmm/gtkmm without using gendef.exe?
+gdkmm_extra_gendef_cpp_args = []
+gtkmm_extra_gendef_cpp_args = []
 if is_msvc
   add_project_arguments(cpp_compiler.get_supported_arguments([ '/utf-8', '/wd4828']), language: 'cpp')
   add_project_arguments(cpp_compiler.get_supported_arguments([ '/utf-8']), language: 'c')
@@ -245,6 +247,10 @@ if is_msvc
   # were generated using a recent enough gmmproc
   build_shared_libs_directly = run_command(check_gmmproc_ver_cmd).returncode() == 0
   message('Using __declspec(dllexport) to build gtkmm: @0@'.format(build_shared_libs_directly ? 'YES' : 
'NO'))
+  if not build_shared_libs_directly
+    gdkmm_extra_gendef_cpp_args += '-DGDKMM_USE_GENDEF'
+    gtkmm_extra_gendef_cpp_args = gdkmm_extra_gendef_cpp_args + [ '-DGTKMM_USE_GENDEF' ]
+  endif
 else
   build_shared_libs_directly = true
 endif
diff --git a/tests/meson.build b/tests/meson.build
index 23f9c32c..778cbffa 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -1,6 +1,6 @@
 # tests
 
-# Input: gdkmm_dep, gtkmm_dep, build_tests, gui_app_ldflags
+# Input: gdkmm_dep, gtkmm_dep, build_tests, gui_app_ldflags, gtkmm_extra_gendef_cpp_args
 # Output: -
 
 test_programs = [
@@ -38,6 +38,7 @@ foreach ex : test_programs
     gui_app: ex[3],
     build_by_default: build_tests,
     link_args: ex[3] ? gui_app_ldflags : [],
+    cpp_args: gtkmm_extra_gendef_cpp_args,
     install: false,
   )
 


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