[gtkmm/use-dllexport: 8/10] Meson: Build gtkmm directly for all builds



commit da3b0f71eef351ddcb3b3fccd76206d135c70905
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Fri Jun 5 16:45:55 2020 +0800

    Meson: Build gtkmm directly for all builds
    
    The gdkmm and gtkmm headers have GDKMM_API and GTKMM_API at all the needed
    points, so there is no longer need to build gtkmm first as a static library
    for Visual Studio builds.
    
    This also marks the end of using gendef.exe for Meson+Visual Studio builds

 demos/gtk-demo/meson.build |  3 +--
 gdk/gdkmm/meson.build      |  4 ++--
 gtk/gtkmm/meson.build      | 59 ++++++++++------------------------------------
 meson.build                | 13 ----------
 tests/meson.build          |  3 +--
 5 files changed, 16 insertions(+), 66 deletions(-)
---
diff --git a/demos/gtk-demo/meson.build b/demos/gtk-demo/meson.build
index c1510995..6e60c2b3 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, gtkmm_extra_gendef_cpp_args
+# Input: gtkmm_dep, epoxy_dep, build_demos, gui_app_ldflags
 # Output: -
 
 gtkmm_demo_cc_files = [
@@ -47,7 +47,6 @@ 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 293dc928..93ca9784 100644
--- a/gdk/gdkmm/meson.build
+++ b/gdk/gdkmm/meson.build
@@ -3,7 +3,7 @@
 # Input: gdkmm_build_dep, gtkmm_pcname, maintainer_mode, project_source_root,
 #        generate_binding_py, m4_files, install_includedir, python3,
 #        dummy_header_py, gmmproc_dir, build_deprecated_api,
-#        gmmproc_extra_m4_dirs, gdkmm_extra_gendef_cpp_args
+#        gmmproc_extra_m4_dirs
 # Output: gdkmm_hg_ccg_basenames, gdkmm_extra_h_files, built_files_root,
 #         gdkmm_built_h_file_targets, gdkmm_used_built_h_file_targets,
 #         gdkmm_library
@@ -110,7 +110,7 @@ install_headers(gdkmm_extra_h_files, subdir: gtkmm_pcname / 'gdkmm')
 untracked_gdkmm = 'untracked' / 'gdk' / 'gdkmm'
 src_untracked_gdkmm = project_source_root / untracked_gdkmm
 
-gdkmm_cpp_args = [ '-DGDKMM_BUILD=1' ] + gdkmm_extra_gendef_cpp_args
+gdkmm_cpp_args = [ '-DGDKMM_BUILD=1' ]
 
 if maintainer_mode
 
diff --git a/gtk/gtkmm/meson.build b/gtk/gtkmm/meson.build
index ac5461c4..b5db4346 100644
--- a/gtk/gtkmm/meson.build
+++ b/gtk/gtkmm/meson.build
@@ -2,9 +2,9 @@
 
 # Input: gtkmm_build_dep, gtkmm_pcname, maintainer_mode, project_source_root,
 #        generate_binding_py, m4_files, gtkmm_libversion, install_includedir,
-#        python3, gtkmm_rc, dummy_header_py, gmmproc_dir, build_shared_libs_directly,
+#        python3, gtkmm_rc, dummy_header_py, gmmproc_dir
 #        build_deprecated_api, gmmproc_extra_m4_dirs, is_host_windows,
-#        gdkmm_library, gdkmm_used_built_h_file_targets, gtkmm_extra_gendef_cpp_args
+#        gdkmm_library, gdkmm_used_built_h_file_targets
 # Output: gtkmm_hg_ccg_basenames, gtkmm_extra_h_files, built_files_root,
 #         gtkmm_built_h_file_targets, gtkmm_dep
 
@@ -312,7 +312,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' ] + gtkmm_extra_gendef_cpp_args
+gtkmm_cpp_args = [ '-DGTKMM_BUILD=1' ]
 
 if maintainer_mode
 
@@ -451,50 +451,15 @@ if is_host_windows
   extra_gtkmm_objects += gtkmm_res
 endif
 
-if build_shared_libs_directly
-  gtkmm_library = library(gtkmm_pcname, extra_gtkmm_objects,
-    gtk_gen_sources, built_dummy_h_file_target, gtkmm_extra_used_cc_files,
-    include_directories: extra_include_dirs,
-    cpp_args: gtkmm_cpp_args,
-    version: gtkmm_libversion,
-    dependencies: gtkmm_build_dep,
-    link_whole: gdkmm_library,
-    install: true,
-  )
-else
-  # TODO: Remove this section when headers and gmmproc files are updated
-  # to mark classes and APIs with GDKMM_API and GTKMM_API
-  gtk_int_lib = static_library('gtkmm-int',
-    gtk_gen_sources, built_dummy_h_file_target, gtkmm_extra_used_cc_files,
-    include_directories: extra_include_dirs,
-    cpp_args: gtkmm_cpp_args,
-    dependencies: gtkmm_build_dep,
-    link_with: gdkmm_library,
-    install: false,
-  )
-
-  gtkmm_def = custom_target('gtkmm.def',
-    output: 'gtkmm.def',
-    depends: [gdkmm_library, gtk_int_lib],
-    command: [ gendef,
-      '@OUTPUT@',
-      '@0@-@1@.dll'.format(gtkmm_pcname, gtkmm_libversion.split('.')[0]),
-      gdkmm_library.full_path(),
-      gtk_int_lib.full_path(),
-    ],
-    install: false,
-  )
-  gtkmm_extra_link_args = ['/def:@0@'.format(gtkmm_def.full_path())]
-
-  gtkmm_library = library(gtkmm_pcname, extra_gtkmm_objects,
-    version: gtkmm_libversion,
-    dependencies: gtkmm_build_dep,
-    link_depends: gtkmm_def,
-    link_args: gtkmm_extra_link_args,
-    link_whole: [gdkmm_library, gtk_int_lib],
-    install: true,
-  )
-endif
+gtkmm_library = library(gtkmm_pcname, extra_gtkmm_objects,
+  gtk_gen_sources, built_dummy_h_file_target, gtkmm_extra_used_cc_files,
+  include_directories: extra_include_dirs,
+  cpp_args: gtkmm_cpp_args,
+  version: gtkmm_libversion,
+  dependencies: gtkmm_build_dep,
+  link_whole: gdkmm_library,
+  install: true,
+)
 
 # Install built .h and _p.h files.
 meson.add_install_script(
diff --git a/meson.build b/meson.build
index e2b1b05e..7fcf7183 100644
--- a/meson.build
+++ b/meson.build
@@ -204,22 +204,9 @@ endif
 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?  TODO: Remove later
-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')
-
-  # Use gendef for now, for all gtkmm-4.x builds.  We will always use __declspec(dllexport)
-  # when the .hg's can be generated with GDKMM_API/GTKMM_API.
-  build_shared_libs_directly = false
-  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
 
 # Set compiler warnings.
diff --git a/tests/meson.build b/tests/meson.build
index 11717625..23d44cf5 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -1,6 +1,6 @@
 # tests
 
-# Input: gtkmm_dep, build_tests, gui_app_ldflags, gtkmm_extra_gendef_cpp_args
+# Input: gtkmm_dep, build_tests, gui_app_ldflags
 # Output: -
 
 test_programs = [
@@ -37,7 +37,6 @@ 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]