[pangomm/kjellahl/meson-build-1-4] Add support for building pangomm with Meson
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pangomm/kjellahl/meson-build-1-4] Add support for building pangomm with Meson
- Date: Sun, 3 Nov 2019 15:19:33 +0000 (UTC)
commit 5df7bf767d53e402a5fb23e4b23117d2e4700cb6
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Sun Nov 3 16:08:33 2019 +0100
Add support for building pangomm with Meson
pangomm-1.4 can be built with either Autotools or Meson.
New and modified files have been copied from the master branch.
Version info in meson.build, README.win32 and untracked/README has been
updated to fit pangomm-1.4.
See MR !7
.gitignore | 3 +
MSVC_NMake/filelist.am | 30 +--
MSVC_NMake/gendef/meson.build | 9 +
MSVC_NMake/pangomm/copy-pangommconfig-h.py | 13 ++
MSVC_NMake/pangomm/meson.build | 17 ++
Makefile.am | 13 ++
README.win32 | 190 ++++++++++++-------
docs/reference/meson.build | 168 +++++++++++++++++
meson.build | 282 +++++++++++++++++++++++++++++
meson_options.txt | 8 +
pango/meson.build | 49 +++++
pango/pangomm/meson.build | 236 ++++++++++++++++++++++++
pango/pangommconfig.h.meson | 19 ++
tools/dist-cmd.py | 12 ++
tools/extra_defs_gen/meson.build | 29 +++
untracked/README | 36 ++++
16 files changed, 1036 insertions(+), 78 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 3c58005..7b930fe 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,3 +25,6 @@ stamp-h?
/tools/extra_defs_gen/generate_extra_defs
/MSVC_NMake/pangomm/pangomm.rc
/MSVC_NMake/pangomm/pangommconfig.h
+untracked/build_scripts/
+untracked/docs/
+untracked/pango/
diff --git a/MSVC_NMake/filelist.am b/MSVC_NMake/filelist.am
index dc21615..50aa019 100644
--- a/MSVC_NMake/filelist.am
+++ b/MSVC_NMake/filelist.am
@@ -1,15 +1,17 @@
-## This file is part of atkmm.
+## This file is part of pangomm.
-msvc_nmake_data = \
- gendef/gendef.cc \
- pangomm/pangomm.rc \
- pangomm/pangommconfig.h \
- build-rules-msvc.mak \
- config-msvc.mak \
- create-lists-msvc.mak \
- create-lists.bat \
- detectenv-msvc.mak \
- generate-msvc.mak \
- info-msvc.mak \
- install.mak \
- Makefile.vc
+msvc_nmake_data = \
+ build-rules-msvc.mak \
+ config-msvc.mak \
+ create-lists-msvc.mak \
+ create-lists.bat \
+ detectenv-msvc.mak \
+ gendef/gendef.cc \
+ gendef/meson.build \
+ generate-msvc.mak \
+ info-msvc.mak \
+ install.mak \
+ Makefile.vc \
+ pangomm/pangomm.rc \
+ pangomm/copy-pangommconfig-h.py \
+ pangomm/pangommconfig.h
diff --git a/MSVC_NMake/gendef/meson.build b/MSVC_NMake/gendef/meson.build
new file mode 100644
index 0000000..11c1c2f
--- /dev/null
+++ b/MSVC_NMake/gendef/meson.build
@@ -0,0 +1,9 @@
+# MSVC_NMake/gendef
+
+# Input: -
+# Output: -
+
+# Used to generate the .def file required to obtain the import .lib file
+if is_msvc
+ gendef = executable('gendef', 'gendef.cc', install: false,)
+endif
diff --git a/MSVC_NMake/pangomm/copy-pangommconfig-h.py b/MSVC_NMake/pangomm/copy-pangommconfig-h.py
new file mode 100644
index 0000000..9a1920e
--- /dev/null
+++ b/MSVC_NMake/pangomm/copy-pangommconfig-h.py
@@ -0,0 +1,13 @@
+#! /usr/bin/env python3
+
+import os
+import sys
+from shutil import copyfile
+
+if len(sys.argv) != 3:
+ raise ValueError('build root directory and current build directory required')
+
+srcfile = os.path.join(sys.argv[1], 'pango', 'pangommconfig.h')
+destfile = os.path.join(sys.argv[2], 'pangommconfig.h')
+
+copyfile(srcfile, destfile)
diff --git a/MSVC_NMake/pangomm/meson.build b/MSVC_NMake/pangomm/meson.build
new file mode 100644
index 0000000..34c5ce6
--- /dev/null
+++ b/MSVC_NMake/pangomm/meson.build
@@ -0,0 +1,17 @@
+# MSVC_NMake/pangomm
+
+# Input: pkg_conf_data, project_build_root
+# Output: pangomm_rc
+
+pangomm_rc = configure_file(
+ input: 'pangomm.rc.in',
+ output: '@BASENAME@',
+ configuration: pkg_conf_data,
+)
+
+# Copy the generated configuration header into the MSVC project directory.
+meson.add_postconf_script(
+ 'copy-pangommconfig-h.py',
+ project_build_root,
+ meson.current_build_dir(),
+)
diff --git a/Makefile.am b/Makefile.am
index b81a588..f5bb023 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -48,5 +48,18 @@ dist_noinst_SCRIPTS = autogen.sh
DISTCLEANFILES = MSVC_NMake/pangomm/pangommconfig.h
+# Distribute files needed when building mm-common with meson.
+EXTRA_DIST = \
+ meson.build \
+ meson_options.txt \
+ MSVC_NMake/pangomm/meson.build \
+ docs/reference/meson.build \
+ pango/meson.build \
+ pango/pangomm/meson.build \
+ pango/pangommconfig.h.meson \
+ tools/dist-cmd.py \
+ tools/extra_defs_gen/meson.build \
+ untracked/README
+
# Optional: auto-generate the ChangeLog file from the git log on make dist
include $(top_srcdir)/build/dist-changelog.am
diff --git a/README.win32 b/README.win32
index 9470ab5..8485cc5 100644
--- a/README.win32
+++ b/README.win32
@@ -1,64 +1,126 @@
-Building gtkmm on Win32
-===========================
-
-Currently, both the mingw (native win32) gcc compiler and MS Visual
-Studio 2013 are supported. gtkmm can be built with mingw32-gcc using
-the gnu autotools (automake, autoconf, libtool). As explicitly
-stated in the gtk+ for win32 distribution (http://www.gimp.org/win32/),
-the gcc compiler provided by the cygwin distribution should not be
-used to build gtk+/gtkmm libraries and/or applications (see the
-README.win32 that comes with the gtk+ DLLs). This MIGHT cause
-conflicts between the cygwin and msvcrt runtime environments.
-
-1. Mingw
-
-The mingw distribution which has been tested with this release is the
-following :
-
-* MinGW-4.1 as the base distribution.
-
-The bare mingw distribution does not provide the necessary tools (sh, perl, m4
-, autoconf, automake, ..) to run the provided configure script "as is". One
-(currently non supported) solution is to use mingw in conjunction with msys,
-which is readily available on the mingw website (http://www.mingw.org/).
-
-The preferred method is to combine the cygwin distribution (for the unix tools
-that were mentioned above) with mingw by making sure that the mingw
-tools (gcc, ld, dlltool, ..) are called first.
-
-First, make sure that you have working distribution of the native port
-of both libsigc++-2.0.x and gtk+-2.0 on win32 (see
-http://www.gimp.org/win32). If you can't compile a simple gtk+ example
-using gcc and `pkg-config --cflags --libs`, you should not even think
-about trying to compile gtkmm, let alone using precompiled libgtkmm
-DLLs to port your gtkmm application !
-
-The configure script can then be called using (as an example) the
-following options
-
-./configure --prefix=/target --build=i386-pc-mingw32 --disable-static
-
-then
-
-make
-make check
-make install
-
-2. MS Visual Studio 2013
-
-Open the pangomm.sln solution file in the MSVC_Net2013 directory. In
-the Tools/Options panel, add the appropriate GTK+ and glibmm include
-and lib directories to the Projects and Solutions/VC++ directories,
-if they are not in the locations specified by the property sheets,
-i.e. $(srcroot)\..\vs12\$(Platform). Build the solution. The option
-/vd2 should not be used in these builds, unlike previous builds, as
-that would cause broken binaries to be built, causing crashes.
-
-3. Gtkmm methods and signals not available on win32
-
-All gtkmm methods and signals are available on win32.
-
-4. Gtkmm examples and demos on win32
-
-All demos and examples compile/run on win32
-
+Building gtkmm on Win32
+===========================
+
+Currently, both the mingw (native win32) gcc compiler and MS Visual
+Studio 2017 are supported. gtkmm can be built with mingw32-gcc using
+the gnu autotools (automake, autoconf, libtool). As explicitly
+stated in the gtk+ for win32 distribution (http://www.gimp.org/win32/),
+the gcc compiler provided by the cygwin distribution should not be
+used to build gtk+/gtkmm libraries and/or applications (see the
+README.win32 that comes with the gtk+ DLLs). This MIGHT cause
+conflicts between the cygwin and msvcrt runtime environments.
+
+1. Mingw
+
+The mingw distribution which has been tested with this release is the
+following :
+
+* MinGW-4.1 as the base distribution.
+
+The bare mingw distribution does not provide the necessary tools (sh, perl, m4
+, autoconf, automake, ..) to run the provided configure script "as is". One
+(currently non supported) solution is to use mingw in conjunction with msys,
+which is readily available on the mingw website (http://www.mingw.org/).
+
+The preferred method is to combine the cygwin distribution (for the unix tools
+that were mentioned above) with mingw by making sure that the mingw
+tools (gcc, ld, dlltool, ..) are called first.
+
+First, make sure that you have working distribution of the native port
+of both libsigc++-2.x and gtk+-3.0 on win32 (see
+http://www.gimp.org/win32). If you can't compile a simple gtk+ example
+using gcc and `pkg-config --cflags --libs`, you should not even think
+about trying to compile gtkmm, let alone using precompiled libgtkmm
+DLLs to port your gtkmm application !
+
+The configure script can then be called using (as an example) the
+following options
+
+./configure --prefix=/target --build=i386-pc-mingw32 --disable-static
+
+then
+
+make
+make check
+make install
+
+2. MS Visual Studio 2017 15.7.0 or later
+
+Open a Visual Studio command prompt suitable for your intended build
+configuration, and change to the MSVC_NMake directory. Ensure that
+all the depedent libraries could be found in $(PREFIX), which is at
+$(srcroot)\..\vs15\$(Platform) by default. Run
+'nmake /f Makefile.vc CFG=[release|debug]' to build pangomm. If a
+different $(PREFIX) is desired rather than the aforementioned default,
+pass in PREFIX=$(PATH) into your command line.
+
+A 'clean' target is supported to remove all the built object files and
+intermediate files that are generated during the build, while an
+'install' target is supported to copy the built DLL and PDB, .lib and
+headers to their appropriate locations under $(PREFIX).
+
+3. Using Meson
+
+3.1 Meson with Visual Studio 2017 15.7.0 or later
+
+Note that currently it is not possible to build pangomm directly
+from a GIT checkout with Visual Studio using Meson.
+
+You will need to have Python 3.5.x or later installed with Meson 0.50.0
+or later in order to use this build option, in addition to glibmm,
+cairomm and libsigc++-2.x (built with Visual Studio) and PangoCairo,
+with all of their required dependencies. The Ninja build tool is
+also required if not using --backend=[vs2017|vs2019] in the Meson
+command line, as noted towards the end of this section.
+
+Open a Visual Studio command prompt and ensure these header files can be
+found in the paths indicated by INCLUDE. The repetitions below are
+necessary so that we reduce the likelihood that pre-C++-11 versions
+of the headers of glibmm, cairomm and libsigc++ are included, which will
+most likely not work.
+
+-glibmm.h (from glibmm-2.62.x or later)
+-glibmm-2.4\glibmm.h (the *same* glibmm as the previous line)
+-cairomm (from cairomm-1.13.x or later)
+-cairomm-1.0\cairomm.h (the *same* cairomm as the previous line)
+-glibmmconfig.h (from glibmm-2.63.x or later)
+-glibmm-2.4\include\glibmmconfig.h (the *same* glibmmconfig as the previous line)
+-cairommconfig.h (from cairomm-1.13.x or later)
+-cairomm-1.0\include\cairommconfig.h (the *same* cairommconfig as the previous line)
+-sigc++\sigc++.h (from libsigc++-2.x or later)
+-sigc++-2.0\sigc++\sigc++.h (the *same* sigc++\sigc++.h as the previous line)
+-sigc++config.h (from libsigc++-2.x or later)
+-sigc++-2.0\include\sigc++config.h (the *same* sigc++config.h as the previous line)
+
+Ensure that the import libraries of glibmm, cairomm and libsigc++-2.x
+can be found in the paths indicated by LIB. Note that Visual Studio
+2019 can use 2017-built libraries without problems; but MSVC builds
+cannot make use of MinGW-built versions of these dependencies. Note
+that debug builds require debug builds of these dependencies, but
+all other builds, including debugoptimized require release builds
+of these dependencies.
+
+You will need to have a working copy of PangoCairo's pkg-config files,
+which point to the corresponding locations of its headers and .lib's
+and the headers and .lib's of all of its dependencies.
+
+To carry out a build, do this in the same command prompt, with
+the Python interpreter, Meson executable script and Ninja executable
+(if not using --backend=[2017|2019]) in your PATH:
+-Create an empty build directory and cd to it.
+-Run "meson <path-to-pangomm-sources> --buildtype=<buildtype> --prefix=<prefix> [--backend=[2017|2019]]"
without the quotes.
+-Perform the build using ninja or Visual Studio (if --backend=[2017|2019])
+ is used. Install the build results after the build succeeds.
+
+3.2 Meson with MinGW
+The standard Meson build instructions for *NIX should work, although it
+is untested at the time of writing.
+
+4. Gtkmm methods and signals not available on win32
+
+All gtkmm methods and signals are available on win32.
+
+5. Gtkmm examples and demos on win32
+
+All demos and examples compile/run on win32
+
diff --git a/docs/reference/meson.build b/docs/reference/meson.build
new file mode 100644
index 0000000..eaa9a44
--- /dev/null
+++ b/docs/reference/meson.build
@@ -0,0 +1,168 @@
+# docs/reference
+
+# Input: built_files_root, project_source_root, pangomm_pcname, perl,
+# hg_ccg_basenames, extra_h_files, built_file_targets, install_datadir,
+# dist_cmd, python3
+# Output: install_docdir, install_devhelpdir
+
+tag_file_modules = [
+ 'mm-common-libstdc++',
+ 'sigc++-3.0',
+ 'glibmm-2.64',
+ 'cairomm-1.16',
+]
+doxygen_tagfiles = ''
+docinstall_flags = []
+foreach module : tag_file_modules
+ depmod = dependency(module, required: false)
+ if depmod.found()
+ doxytagfile = depmod.get_pkgconfig_variable('doxytagfile')
+ htmlrefpub = depmod.get_pkgconfig_variable('htmlrefpub', default: '')
+ htmlrefdir = depmod.get_pkgconfig_variable('htmlrefdir', default: '')
+ if htmlrefpub == ''
+ htmlrefpub = htmlrefdir
+ elif htmlrefdir == ''
+ htmlrefdir = htmlrefpub
+ endif
+ doxygen_tagfiles += ' "' + doxytagfile + '=' + htmlrefpub + '"'
+ if not htmlrefdir.endswith('/')
+ htmlrefdir += '/'
+ endif
+ docinstall_flags += ['-l', doxytagfile.split('/')[-1] + '@' + htmlrefdir]
+ endif
+endforeach
+
+book_name = pangomm_pcname
+book_title = meson.project_name() + ' Reference Manual'
+
+# Configuration data for Doxyfile.
+doc_conf_data = configuration_data()
+doc_conf_data.set('configure_input',
+ 'docs/reference/Doxyfile. Generated from Doxyfile.in by meson.configure_file().')
+doc_conf_data.set('PACKAGE_NAME', meson.project_name())
+doc_conf_data.set('PACKAGE_VERSION', meson.project_version())
+doc_conf_data.set('abs_top_builddir', built_files_root)
+doc_conf_data.set('abs_top_srcdir', project_source_root)
+doc_conf_data.set('PANGOMM_MODULE_NAME', book_name)
+doc_conf_data.set('DOXYGEN_TAGFILES', doxygen_tagfiles)
+doc_conf_data.set('PERL', perl.path())
+
+configure_file(
+ input: 'Doxyfile.in',
+ output: '@BASENAME@',
+ configuration: doc_conf_data,
+)
+
+# Installation directories relative to {prefix}.
+install_docdir = install_datadir / 'doc' / book_name
+install_reference_docdir = install_docdir / 'reference'
+install_image_docdir = install_docdir / 'images'
+install_devhelpdir = install_datadir / 'devhelp' / 'books' / book_name
+
+if not build_documentation
+ # Documentation shall not be built or installed.
+ # Return to the calling meson.build file.
+ subdir_done()
+endif
+
+# Built input .h files to Doxygen.
+built_h_files = []
+foreach file : hg_ccg_basenames
+ built_h_files += built_files_root / 'pango' / 'pangomm' / file + '.h'
+endforeach
+
+# Hand-coded input .h files to Doxygen.
+src_h_files = []
+foreach file : extra_h_files
+ if file != 'wrap_init.h'
+ src_h_files += project_source_root / 'pango' / 'pangomm' / file
+ endif
+endforeach
+src_h_files += project_source_root / 'pango' / 'pangomm.h'
+
+doctool_dir = project_source_root / 'untracked' / 'docs' # MMDOCTOOLDIR
+doctool_dist_dir = 'untracked' / 'docs' # Relative to MESON_DIST_ROOT
+
+if built_file_targets.length() > 0
+ # .h files have been generated from .hg files (maintainer mode).
+ tag_file = custom_target('html_and_tag',
+ input: src_h_files,
+ output: book_name + '.tag',
+ command: [
+ python3, doc_reference, 'doxygen',
+ doctool_dir,
+ '@OUTPUT@',
+ built_h_files,
+ '@INPUT@',
+ ],
+ build_by_default: build_documentation,
+ depends: built_file_targets,
+ install: true,
+ install_dir: install_reference_docdir,
+ )
+else
+ # All .h files are stored in the source tree (not maintainer mode).
+ tag_file = custom_target('html_and_tag',
+ input: src_h_files + built_h_files,
+ output: book_name + '.tag',
+ command: [
+ python3, doc_reference, 'doxygen',
+ doctool_dir,
+ '@OUTPUT@',
+ '@INPUT@',
+ ],
+ build_by_default: build_documentation,
+ install: true,
+ install_dir: install_reference_docdir,
+ )
+endif
+
+devhelp_file = custom_target('devhelp',
+ input: tag_file,
+ output: book_name + '.devhelp2',
+ command: [
+ python3, doc_reference, 'devhelp',
+ doctool_dir,
+ '@INPUT@',
+ '@OUTPUT@',
+ book_name,
+ book_title,
+ ],
+ build_by_default: build_documentation,
+)
+
+# Install Devhelp file and html files.
+meson.add_install_script(
+ python3.path(), doc_reference, 'install_doc',
+ doctool_dir,
+ devhelp_file.full_path(),
+ install_devhelpdir,
+ install_reference_docdir / 'html',
+ docinstall_flags
+)
+
+# Install images.
+image_basefiles = [
+ 'gtkmm_logo.gif',
+ 'top.gif',
+]
+image_files = []
+foreach file : image_basefiles
+ image_files += '..' / 'images' / file
+endforeach
+
+install_data(image_files, install_dir: install_image_docdir)
+
+if not meson.is_subproject()
+ # Distribute built files and files copied by mm-common-prepare.
+ # (add_dist_script() is not allowed in a subproject)
+ meson.add_dist_script(
+ python3.path(), dist_cmd,
+ python3.path(), doc_reference, 'dist_doc',
+ doctool_dir,
+ doctool_dist_dir,
+ meson.current_build_dir(),
+ tag_file.full_path(),
+ devhelp_file.full_path(),
+ )
+endif
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..694356a
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,282 @@
+# This file is part of pangomm.
+
+project('pangomm', 'cpp',
+ version: '2.42.0',
+ license: 'LGPLv2.1+',
+ default_options: [
+ 'cpp_std=c++11'
+ ],
+ meson_version: '>= 0.50.0', # required for python3.path()
+)
+
+pangomm_api_version = '1.4'
+pangomm_pcname = meson.project_name() + '-' + pangomm_api_version
+
+pangomm_version_array = meson.project_version().split('.')
+pangomm_major_version = pangomm_version_array[0].to_int()
+pangomm_minor_version = pangomm_version_array[1].to_int()
+pangomm_micro_version = pangomm_version_array[2].to_int()
+
+# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
+# The relation between libtool's current:revison:age interface versioning
+# and the .so filename, .so.x.y.z, is
+# x = current - age
+# y = age
+# z = revision
+# If libtool_soversion is updated as described in libtool's documentation,
+# x.y.z will usually *not* be equal to meson.project_version().
+libtool_soversion = [1, 30, 0]
+pangomm_libversion = '@0@.@1@.@2@'.format(
+ libtool_soversion[0] - libtool_soversion[2],
+ libtool_soversion[2],
+ libtool_soversion[1])
+
+# Use these instead of meson.source_root() and meson.build_root() in subdirectories.
+# source_root() and build_root() are not useful, if this is a subproject.
+project_source_root = meson.current_source_dir()
+project_build_root = meson.current_build_dir()
+
+cpp_compiler = meson.get_compiler('cpp')
+is_msvc = cpp_compiler.get_id() == 'msvc'
+python3 = import('python').find_installation('python3')
+
+python_version = python3.language_version()
+python_version_req = '>= 3.5'
+if not python_version.version_compare(python_version_req)
+ error('Requires Python @0@, found @1@.'.format(python_version_req, python_version))
+endif
+
+# Do we build from a git repository?
+# Suppose we do if and only if a .git directory exists.
+cmd_py = '''
+import os
+import sys
+sys.exit(0 if os.path.isdir("@0@") else 1)
+'''.format(project_source_root / '.git')
+is_git_build = run_command(python3, '-c', cmd_py).returncode() == 0
+
+# In Unix-like system, an alternative is
+# is_git_build = run_command('test', '-d', project_source_root / '.git').returncode() == 0
+# Python code can be used in all operating sytems where Meson can run.
+
+# 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 \
+ (maintainer_mode_opt == 'if-git-build' and is_git_build)
+warning_level = get_option('warnings')
+build_deprecated_api = get_option('build-deprecated-api')
+build_documentation_opt = get_option('build-documentation')
+build_documentation = build_documentation_opt == 'true' or \
+ (build_documentation_opt == 'if-maintainer-mode' and maintainer_mode)
+
+# Installation directories are relative to {prefix}.
+install_prefix = get_option('prefix')
+install_includedir = get_option('includedir')
+install_libdir = get_option('libdir')
+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.
+
+# Pango supported pkg-config files on MSVC files for a good while,
+# so just use that
+pangocairo_req = '>= 1.41.0'
+pangocairo_dep = dependency('pangocairo', version: pangocairo_req)
+
+# The -mm libraries do not yet have pkg-config files for MSVC builds,
+# so check for them manually
+glibmm_req_minor_ver = '4'
+cairomm_req_minor_ver = '0'
+
+if is_msvc
+ # We must have Visual Studio 2017 15.7 or later...
+ assert(cpp_compiler.version().split('.')[0].to_int() >= 19 and
cpp_compiler.version().split('.')[1].to_int() >= 15, 'Visual Studio 2017 15.7 or later is required')
+
+ assert(cpp_compiler.has_header('sigc++-2.0/sigc++/sigc++.h') and
cpp_compiler.has_header('sigc++-2.0/include/sigc++config.h'),
+ 'sigc++-2.x headers are required')
+ assert(cpp_compiler.has_header('glibmm-2.@0@/glibmm.h'.format(glibmm_req_minor_ver)) and
cpp_compiler.has_header('glibmm-2.@0@/include/glibmmconfig.h'.format(glibmm_req_minor_ver)),
+ 'glibmm-2.@0@ headers are required'.format(glibmm_req_minor_ver))
+ assert(cpp_compiler.has_header('cairomm-1.@0@/cairomm/cairomm.h'.format(cairomm_req_minor_ver)) and
cpp_compiler.has_header('cairomm-1.@0@/include/cairommconfig.h'.format(cairomm_req_minor_ver)),
+ 'cairomm-1.@0@ headers are required'.format(cairomm_req_minor_ver))
+ message('Ensure your INCLUDE and LIB contain the paths that lead to the appropriate headers and .lib\'s
for glibmm-2.@0@, cairomm-1.@1@ and libsigc++-2.x'.format(glibmm_req_minor_ver, cairomm_req_minor_ver))
+
+ # Visual Studio 2019 can consume libraries built with 2017, so check for
+ # 2017-built libraries as well if 2019-built libraries cannot be found
+ msvc_check_range = [15]
+ msvc_minor = cpp_compiler.version().split('.')[1].to_int()
+ if msvc_minor >= 20
+ msvc_check_range = [16, 15]
+ endif
+
+ debugsuffix = ''
+ if get_option('buildtype') == 'debug'
+ debugsuffix = '-d'
+ endif
+
+ # We can be looking for MSVC 2017-built libraries on 2019 builds as well,
+ # so we can't just assume that libraries exist, but check that compatible
+ # versions are really found
+ glibmm_dep = dependency('', required: false)
+ cairomm_dep = dependency('', required: false)
+ sigc_dep = dependency('', required: false)
+
+ foreach v : msvc_check_range
+ glibmm_dep = glibmm_dep.found() ? glibmm_dep :
cpp_compiler.find_library('glibmm-vc@0@0@1@-2_@2@'.format(v.to_string(), debugsuffix, glibmm_req_minor_ver),
required: false)
+ cairomm_dep = cairomm_dep.found() ? cairomm_dep :
cpp_compiler.find_library('cairomm-vc@0@0@1@-1_@2@'.format(v.to_string(), debugsuffix,
cairomm_req_minor_ver), required: false)
+ sigc_dep = sigc_dep.found() ? sigc_dep :
cpp_compiler.find_library('sigc-vc@0@0@1@-2_0'.format(v.to_string(), debugsuffix), required: false)
+ endforeach
+
+ # Now make sure the appropriate -mm libraries are found
+ assert(glibmm_dep.found() and cairomm_dep.found() and sigc_dep.found(), 'Appropriate
glibmm-vcxx0@0@-2_@1@.lib, cairomm-vcxx0@0@-1_@2@.lib and sigc-vcxx0@0@-2_0.lib are
required'.format(debugsuffix, glibmm_req_minor_ver, cairomm_req_minor_ver))
+
+ pangomm_requires = ' '.join([
+ 'pangocairo', pangocairo_req,
+ ])
+
+ pangomm_build_dep = [glibmm_dep, cairomm_dep, sigc_dep, pangocairo_dep]
+else
+ glibmm_req = '>= 2.48.0'
+ cairomm_req = '>= 1.2.2'
+ glibmm_dep = dependency('glibmm-2.@0@'.format(glibmm_req_minor_ver), version: glibmm_req)
+ cairomm_dep = dependency('cairomm-1.@0@'.format(cairomm_req_minor_ver), version: cairomm_req)
+ pangomm_build_dep = [glibmm_dep, cairomm_dep, pangocairo_dep]
+ pangomm_requires = ' '.join([
+ 'glibmm-2.@0@'.format(glibmm_req_minor_ver), glibmm_req,
+ 'cairomm-1.@0@'.format(cairomm_req_minor_ver), cairomm_req,
+ 'pangocairo', pangocairo_req,
+ ])
+endif
+
+# Some dependencies are required only in maintainer mode and/or if
+# reference documentation shall be built.
+mm_common_get = find_program('mm-common-get', required: maintainer_mode)
+m4 = find_program('m4', required: maintainer_mode) # Used by gmmproc (in glibmm)
+perl = find_program('perl', required: maintainer_mode or build_documentation)
+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
+ gmmproc_dir = glibmm_dep.get_pkgconfig_variable('gmmprocdir')
+endif
+
+script_dir = project_source_root / 'untracked' / 'build_scripts'
+generate_binding = script_dir / 'generate-binding.py'
+doc_reference = script_dir / 'doc-reference.py'
+dist_changelog = script_dir / 'dist-changelog.py'
+dist_build_scripts = script_dir / 'dist-build-scripts.py'
+dist_cmd = project_source_root / 'tools' / 'dist-cmd.py' # Must be committed to git.
+
+if maintainer_mode and mm_common_get.found()
+ # Copy files to untracked/build_scripts and untracked/docs.
+ run_command(mm_common_get, '--force', script_dir,
+ project_source_root / 'untracked' / 'docs')
+endif
+
+# Set compiler warnings.
+warning_flags = []
+if warning_level == 'min'
+ if is_msvc
+ warning_flags = ['/W3']
+ else
+ warning_flags = ['-Wall']
+ endif
+elif warning_level == 'max' or warning_level == 'fatal'
+ if is_msvc
+ warning_flags = ['/W4']
+ else
+ warning_flags = '-pedantic -Wall -Wextra -Wformat-security -Wsuggest-override -Wshadow
-Wno-long-long'.split()
+ endif
+ if warning_level == 'fatal'
+ if is_msvc
+ warning_flags += ['/WX']
+ else
+ warning_flags += ['-Werror']
+ endif
+ deprecations = 'G PANGO GLIBMM SIGCXX'.split()
+ foreach d : deprecations
+ warning_flags += '-D@0@_DISABLE_DEPRECATED'.format(d)
+ endforeach
+ endif
+endif
+
+warning_flags = cpp_compiler.get_supported_arguments(warning_flags)
+add_project_arguments(warning_flags, language: 'cpp')
+
+# MSVC: Ignore warnings that aren't really harmful, but make those
+# that should not be overlooked stand out.
+if is_msvc
+ foreach wd : ['/FImsvc_recommended_pragmas.h', '/wd4267', '/wd4530']
+ disabled_warning = cpp_compiler.get_supported_arguments(wd)
+ add_project_arguments(disabled_warning, language: 'cpp')
+ endforeach
+endif
+
+subdir('tools/extra_defs_gen')
+subdir('MSVC_NMake/gendef')
+subdir('pango')
+subdir('MSVC_NMake/pangomm')
+subdir('pango/pangomm')
+subdir('docs/reference')
+
+if not meson.is_subproject()
+ # Add a ChangeLog file to the distribution directory.
+ # (add_dist_script() is not allowed in a subproject)
+ meson.add_dist_script(
+ python3.path(), dist_cmd,
+ python3.path(), dist_changelog,
+ project_source_root,
+ )
+ # Add build scripts to the distribution directory, and delete .gitignore
+ # files and an empty $MESON_DIST_ROOT/build/ directory.
+ meson.add_dist_script(
+ python3.path(), dist_cmd,
+ python3.path(), dist_build_scripts,
+ project_source_root,
+ 'untracked' / 'build_scripts',
+ )
+endif
+
+# Print a summary.
+real_maintainer_mode = ''
+if maintainer_mode_opt == 'if-git-build'
+ real_maintainer_mode = ' (@0@)'.format(maintainer_mode)
+endif
+
+real_build_documentation = ''
+if build_documentation_opt == 'if-maintainer-mode'
+ real_build_documentation = ' (@0@)'.format(build_documentation)
+endif
+
+summary = [
+ '',
+ '------',
+ meson.project_name() + ' ' + meson.project_version(),
+ '',
+ ' Maintainer mode: @0@@1@'.format(maintainer_mode_opt, real_maintainer_mode),
+ ' Compiler warnings: @0@'.format(warning_level),
+ ' Build deprecated API: @0@'.format(build_deprecated_api),
+ 'Build HTML documentation: @0@@1@'.format(build_documentation_opt, real_build_documentation),
+ 'Directories:',
+ ' prefix: @0@'.format(install_prefix),
+ ' includedir: @0@'.format(install_prefix / install_includedir),
+ ' includepangommdir: @0@'.format(install_prefix / install_includedir / pangomm_pcname),
+ ' libdir: @0@'.format(install_prefix / install_libdir),
+ ' includeconfigdir: @0@'.format(install_prefix / install_includeconfigdir),
+ ' m4dir: @0@'.format(install_prefix / install_m4dir),
+ ' pkgconfigdir: @0@'.format(install_prefix / install_pkgconfigdir),
+ ' datadir: @0@'.format(install_prefix / install_datadir),
+ ' docdir: @0@'.format(install_prefix / install_docdir),
+ ' devhelpdir: @0@'.format(install_prefix / install_devhelpdir),
+ '------'
+]
+
+message('\n'.join(summary))
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..1c4e122
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,8 @@
+option('maintainer-mode', type: 'combo', choices: ['false', 'if-git-build', 'true'],
+ value: 'if-git-build', description: 'Generate source code from .hg and .ccg files')
+option('warnings', type: 'combo', choices: ['no', 'min', 'max', 'fatal'], value: 'fatal',
+ description: 'Compiler warning level')
+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')
diff --git a/pango/meson.build b/pango/meson.build
new file mode 100644
index 0000000..368bd35
--- /dev/null
+++ b/pango/meson.build
@@ -0,0 +1,49 @@
+# pango
+
+# Input: install_prefix, install_datadir, install_includedir,
+# pangomm_pcname, pangomm_api_version, pangomm_requires,
+# install_pkgconfigdir, install_libdir, build_deprecated_api,
+# pangomm_major_version, pangomm_minor_version, pangomm_micro_version
+# Output: pkg_conf_data, install_includeconfigdir
+
+pkg_conf_data = configuration_data()
+pkg_conf_data.set('prefix', install_prefix)
+pkg_conf_data.set('exec_prefix', '${prefix}')
+pkg_conf_data.set('libdir', '${prefix}' / install_libdir)
+pkg_conf_data.set('datarootdir', '${prefix}' / install_datadir)
+pkg_conf_data.set('datadir', '${datarootdir}')
+pkg_conf_data.set('includedir', '${prefix}' / install_includedir)
+pkg_conf_data.set('srcdir', meson.current_source_dir())
+pkg_conf_data.set('PACKAGE_TARNAME', meson.project_name())
+pkg_conf_data.set('PACKAGE_VERSION', meson.project_version())
+pkg_conf_data.set('PANGOMM_MODULE_NAME', pangomm_pcname)
+pkg_conf_data.set('PANGOMM_API_VERSION', pangomm_api_version)
+pkg_conf_data.set('PANGOMM_MODULES', pangomm_requires)
+
+if not build_deprecated_api
+ pkg_conf_data.set('PANGOMM_DISABLE_DEPRECATED', true)
+endif
+pkg_conf_data.set('PANGOMM_MAJOR_VERSION', pangomm_major_version)
+pkg_conf_data.set('PANGOMM_MINOR_VERSION', pangomm_minor_version)
+pkg_conf_data.set('PANGOMM_MICRO_VERSION', pangomm_micro_version)
+
+configure_file(
+ input: 'pangomm.pc.in',
+ output: pangomm_pcname + '.pc',
+ configuration: pkg_conf_data,
+ install_dir: install_pkgconfigdir,
+)
+
+configure_file(
+ input: 'pangomm-uninstalled.pc.in',
+ output: pangomm_pcname + '-uninstalled.pc',
+ configuration: pkg_conf_data,
+)
+
+install_includeconfigdir = install_libdir / pangomm_pcname / 'include'
+configure_file(
+ input: 'pangommconfig.h.meson',
+ output: 'pangommconfig.h',
+ configuration: pkg_conf_data,
+ install_dir: install_includeconfigdir,
+)
diff --git a/pango/pangomm/meson.build b/pango/pangomm/meson.build
new file mode 100644
index 0000000..894c9e3
--- /dev/null
+++ b/pango/pangomm/meson.build
@@ -0,0 +1,236 @@
+# pango/pangomm
+
+# Input: pangomm_build_dep, pangomm_pcname, maintainer_mode, project_source_root,
+# generate_binding, m4_files, pangomm_libversion, install_includedir,
+# dist_cmd, python3, pangomm_rc
+# Output: hg_ccg_basenames, extra_h_files, built_file_targets, built_files_root,
+# pangomm_dep
+
+defs_basefiles = [
+ 'pango.defs',
+ 'pango_methods.defs',
+ 'pango_enums.defs',
+ 'pango_vfuncs.defs',
+ 'pango_extra_objects.defs',
+ 'pango_docs.xml',
+ 'pango_docs_override.xml',
+]
+
+defs_files = []
+foreach file : defs_basefiles
+ defs_files += '..' / 'src' / file
+endforeach
+
+hg_ccg_basenames = [
+ 'attributes',
+ 'attriter',
+ 'attrlist',
+ 'cairofontmap',
+ 'color',
+ 'context',
+ 'coverage',
+ 'font',
+ 'fontdescription',
+ 'fontface',
+ 'fontfamily',
+ 'fontmap',
+ 'fontmetrics',
+ 'fontset',
+ 'glyph',
+ 'glyphstring',
+ 'item',
+ 'language',
+ 'layout',
+ 'layoutiter',
+ 'layoutline',
+ 'layoutrun',
+ 'rectangle',
+ 'renderer',
+ 'tabarray',
+]
+
+extra_cc_files = [
+ 'init.cc',
+]
+
+extra_h_files = [
+ 'init.h',
+ 'types.h',
+ 'wrap_init.h',
+]
+
+install_headers('..' / 'pangomm.h', subdir: pangomm_pcname)
+install_headers(extra_h_files, subdir: pangomm_pcname / 'pangomm')
+
+untracked_pangomm = 'untracked' / 'pango' / 'pangomm'
+src_untracked_pangomm = project_source_root / untracked_pangomm
+
+if maintainer_mode
+
+ # Maintainer mode. Generate .h and .cc files from .hg and .ccg files in ../src.
+
+ # docs/reference/meson.build needs this.
+ built_files_root = project_build_root
+
+ hg_files = []
+ foreach file : hg_ccg_basenames
+ hg_files += '..' / 'src' / file + '.hg'
+ endforeach
+
+ # Create wrap_init.cc in project_build_root/pango/pangomm.
+ wrap_init_target = custom_target('wrap_init.cc',
+ input: hg_files,
+ output: 'wrap_init.cc',
+ command: [
+ python3, generate_binding, 'generate_wrap_init',
+ gmmproc_dir,
+ '@OUTPUT@',
+ 'Pango', # namespace
+ '@INPUT@',
+ ],
+ build_by_default: maintainer_mode,
+ install: false,
+ )
+
+ # Force meson+ninja to generate source files before anything is compiled.
+ # Compilation must depend on these targets.
+ built_file_targets = []
+
+ # Create .h/_p.h/.cc files from .hg/.ccg files in project_build_root/pango/pangomm.
+ foreach file : hg_ccg_basenames
+ hg_file = '..' / 'src' / file + '.hg'
+ ccg_file = '..' / 'src' / file + '.ccg'
+ built_file_targets += custom_target(file + '.cc',
+ input: [hg_file, ccg_file],
+ output: [file + '.stamp', file + '.cc'],
+ command: [
+ python3, generate_binding, 'gmmproc',
+ gmmproc_dir,
+ '@OUTPUT0@',
+ file,
+ meson.current_source_dir() / '..' / 'src',
+ project_source_root / 'tools' / 'm4',
+ ],
+ depend_files: defs_files + m4_files,
+ build_by_default: maintainer_mode,
+ install: false,
+ )
+ endforeach
+
+ extra_include_dirs = ['..']
+ pangomm_library = library(pangomm_pcname,
+ wrap_init_target, built_file_targets, extra_cc_files,
+ version: pangomm_libversion,
+ include_directories: extra_include_dirs,
+ dependencies: pangomm_build_dep,
+ install: true,
+ )
+
+ built_h_cc_dir = meson.current_build_dir()
+
+else # not maintainer_mode
+
+ # Not maintainer mode. Compile built source code files in
+ # project_source_root/untracked/pango/pangomm.
+
+ # docs/reference/meson.build needs these.
+ built_file_targets = []
+ built_files_root = project_source_root / 'untracked'
+
+ # Two cases:
+ # 1. The source code comes from a tarball, where the built files
+ # are stored in project_source_root/untracked.
+ # There are no built files in the build tree.
+ # 2. Files have been built in the build tree. Then maintainer_mode has
+ # been changed from true to false. Files that are missing or not up to date
+ # in project_source_root/untracked are copied from the build tree.
+
+ # Try to copy built source code files to the source tree.
+ run_command(
+ python3, generate_binding, 'copy_built_files',
+ meson.current_build_dir(),
+ src_untracked_pangomm,
+ hg_ccg_basenames,
+ )
+
+ built_cc_files = [ src_untracked_pangomm / 'wrap_init.cc' ]
+ foreach file : hg_ccg_basenames
+ built_cc_files += src_untracked_pangomm / file + '.cc'
+ endforeach
+
+ extra_include_dirs = [ '..', '..' / '..' / 'untracked' / 'pango' ]
+
+ # 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_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,
+ )
+
+ built_h_cc_dir = src_untracked_pangomm
+
+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: extra_include_dirs,
+ dependencies: pangomm_build_dep
+)
diff --git a/pango/pangommconfig.h.meson b/pango/pangommconfig.h.meson
new file mode 100644
index 0000000..e28f310
--- /dev/null
+++ b/pango/pangommconfig.h.meson
@@ -0,0 +1,19 @@
+/* This file is part of pangomm. */
+#ifndef PANGOMM_PANGOMMCONFIG_H_INCLUDED
+#define PANGOMM_PANGOMMCONFIG_H_INCLUDED
+
+#include <glibmmconfig.h>
+
+/* Define to omit deprecated API from the library. */
+#mesondefine PANGOMM_DISABLE_DEPRECATED
+
+/* Major version number of pangomm. */
+#mesondefine PANGOMM_MAJOR_VERSION
+
+/* Minor version number of pangomm. */
+#mesondefine PANGOMM_MINOR_VERSION
+
+/* Micro version number of pangomm. */
+#mesondefine PANGOMM_MICRO_VERSION
+
+#endif /* !PANGOMM_PANGOMMCONFIG_H_INCLUDED */
diff --git a/tools/dist-cmd.py b/tools/dist-cmd.py
new file mode 100755
index 0000000..30da5da
--- /dev/null
+++ b/tools/dist-cmd.py
@@ -0,0 +1,12 @@
+#!/usr/bin/env python3
+
+# External command, intended to be called with meson.add_dist_script() in meson.build.
+# meson.add_dist_script() can't call a script that's not committed to git.
+# This script shall be committed. It can be used for calling other non-committed scripts.
+
+# dist-cmd.py <cmd> <args>...
+
+import sys
+import subprocess
+
+sys.exit(subprocess.run(sys.argv[1:]).returncode)
diff --git a/tools/extra_defs_gen/meson.build b/tools/extra_defs_gen/meson.build
new file mode 100644
index 0000000..35d9315
--- /dev/null
+++ b/tools/extra_defs_gen/meson.build
@@ -0,0 +1,29 @@
+# tools/extra_defs_gen
+
+# Input: cpp_compiler, pangomm_build_dep, install_libdir, pangomm_pcname
+# Output: m4_files, install_m4dir
+
+if not is_msvc
+ glibmm_generate_extra_defs_dep = cpp_compiler.find_library(
+ 'glibmm_generate_extra_defs-2.64',
+ )
+
+ executable('generate_extra_defs', 'generate_defs_pango.cc',
+ dependencies: [pangomm_build_dep, glibmm_generate_extra_defs_dep],
+ install: false,
+ )
+endif
+
+# Install m4 files for reuse by other *mm projects, when building from git.
+m4_basefiles = [
+ 'convert.m4',
+ 'convert_pango.m4',
+ 'convert_pangomm.m4',
+]
+m4_files = []
+foreach file : m4_basefiles
+ m4_files += '..' / 'm4' / file
+endforeach
+m4_files = files(m4_files)
+install_m4dir = install_libdir / pangomm_pcname / 'proc' / 'm4'
+install_data(m4_files, install_dir: install_m4dir)
diff --git a/untracked/README b/untracked/README
new file mode 100644
index 0000000..4b91cc4
--- /dev/null
+++ b/untracked/README
@@ -0,0 +1,36 @@
+untracked/README
+
+This directory contains files not tracked by a source code control program,
+such as git. (This README file is the exception.)
+
+The files can have one of two origins.
+
+1. Copied by the mm-common-get command.
+2. Generated when pangomm is built.
+
+Files of type 2 exist here only if pangomm is built with maintainer-mode=false,
+or the directory comes from a tarball.
+Files of both types exist here only if pangomm is built with Meson,
+or the tarball is created with Meson.
+
+1. Files copied by mm-common-get
+--------------------------------
+untracked/docs/doc-install.pl
+ doc-postprocess.pl
+ doxygen-extra.css
+ tagfile-to-devhelp2.xsl
+untracked/build_scripts/dist-build-scripts.py
+ dist-changelog.py
+ doc-reference.py
+ generate-binding.py
+
+mm-common-get may copy more files, but they are not used by pangomm.
+
+2. Generated files
+------------------
+untracked/pango/pangomm/*.h
+ *.cc
+ private/*_p.h
+untracked/docs/reference/pangomm-1.4.devhelp2
+ pangomm-1.4.tag
+ html/*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]