[pangomm/pangomm-2-42.meson-msvc: 7/10] Meson: Allow maintainer builds on Visual Studio too
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pangomm/pangomm-2-42.meson-msvc: 7/10] Meson: Allow maintainer builds on Visual Studio too
- Date: Tue, 10 Mar 2020 10:35:40 +0000 (UTC)
commit f14b434f9aa5e9091b91faa14ad2dfc625f843ae
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Thu Feb 27 11:50:35 2020 +0800
Meson: Allow maintainer builds on Visual Studio too
glibmm recently gained the ability to build with Visual Studio from a GIT
checkout and to install the PERL scripts used to generate the C++ sources from
the respective templates, so enable this support for pangomm as well as the
needed infrastructure are largely in place.
Note that a new configuration option has been added for Visual Studio builds
to specify the directory for gmmproc, since there is not yet Meson build
support for building glibmm, meaning glibmm built with Visual Studio does not
support generating pkg-config files.
Since some portions that we use for non-maintainer builds can be used for
maintainer builds as well, make them shared to keep additions minimal.
meson.build | 12 +++----
meson_options.txt | 2 ++
pango/pangomm/meson.build | 79 ++++++++++++++++++++++++-----------------------
3 files changed, 49 insertions(+), 44 deletions(-)
---
diff --git a/meson.build b/meson.build
index 5b1c3e4..f93f8da 100644
--- a/meson.build
+++ b/meson.build
@@ -55,10 +55,6 @@ sys.exit(os.path.isdir("@0@") or os.path.isfile("@0@"))
'''.format(project_source_root / '.git')
is_git_build = run_command(python3, '-c', cmd_py).returncode() != 0
-# Unfortunately due to m4 requirements, we cannot support MSVC builds
-# directly from GIT checkouts
-assert(not is_msvc or not is_git_build, 'Direct builds from GIT is not supported for MSVC builds')
-
# Options.
maintainer_mode_opt = get_option('maintainer-mode')
maintainer_mode = maintainer_mode_opt == 'true' or \
@@ -164,9 +160,13 @@ doxygen = find_program('doxygen', required: build_documentation)
dot = find_program('dot', required: build_documentation) # Used by Doxygen
xsltproc = find_program('xsltproc', required: build_documentation)
-# Where to find gmmproc and generate_wrap_init.pl. (N/A on MSVC builds)
-if not is_msvc
+# Where to find gmmproc and generate_wrap_init.pl.
+if glibmm_dep.type_name() == 'pkgconfig'
gmmproc_dir = glibmm_dep.get_pkgconfig_variable('gmmprocdir')
+else
+ if is_msvc
+ gmmproc_dir = get_option('gmmproc-dir')
+ endif
endif
script_dir = project_source_root / 'untracked' / 'build_scripts'
diff --git a/meson_options.txt b/meson_options.txt
index 1c4e122..e137e93 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -6,3 +6,5 @@ option('build-deprecated-api', type: 'boolean', value: true,
description: 'Build deprecated API and include it in the library')
option('build-documentation', type: 'combo', choices: ['false', 'if-maintainer-mode', 'true'],
value: 'if-maintainer-mode', description: 'Build and install the documentation')
+option('gmmproc-dir', type : 'string',
+ value : '', description : 'Directory containing gmmproc and its PERL modules (for MSVC builds only)')
diff --git a/pango/pangomm/meson.build b/pango/pangomm/meson.build
index 4ca20cb..f5898dc 100644
--- a/pango/pangomm/meson.build
+++ b/pango/pangomm/meson.build
@@ -121,12 +121,14 @@ if maintainer_mode
endforeach
extra_include_dirs = ['..']
- pangomm_library = library(pangomm_pcname,
+
+ # 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',
built_cc_file_targets, built_h_file_targets, extra_cc_files,
- version: pangomm_libversion,
include_directories: extra_include_dirs,
dependencies: pangomm_build_dep,
- install: true,
+ install: false,
)
built_h_cc_dir = meson.current_build_dir()
@@ -169,47 +171,48 @@ else # not maintainer_mode
built_cc_files, extra_cc_files,
include_directories: extra_include_dirs,
dependencies: pangomm_build_dep,
- install: false,)
-
- pangomm_def = []
- pangomm_extra_link_args = []
- extra_pangomm_objects = []
-
- if is_msvc
- pangomm_def = custom_target('pangomm.def',
- output: 'pangomm.def',
- depends: pango_int_lib,
- command: [ gendef,
- '@OUTPUT@',
- '@0@-@1@.dll'.format(pangomm_pcname,
- libtool_soversion[0] - libtool_soversion[2]),
- pango_int_lib.full_path(),
- ],
- 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
- 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: false,
)
built_h_cc_dir = src_untracked_pangomm
endif
+pangomm_def = []
+pangomm_extra_link_args = []
+extra_pangomm_objects = []
+
+if is_msvc
+ pangomm_def = custom_target('pangomm.def',
+ output: 'pangomm.def',
+ depends: pango_int_lib,
+ command: [ gendef,
+ '@OUTPUT@',
+ '@0@-@1@.dll'.format(pangomm_pcname,
+ libtool_soversion[0] - libtool_soversion[2]),
+ pango_int_lib.full_path(),
+ ],
+ 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
+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]