summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-07-17 17:45:43 -0400
committerDavid Robillard <d@drobilla.net>2022-07-18 21:06:35 -0400
commit68293752dbfd80016dc7543b88f22c602427fa75 (patch)
tree4c3e93bb6f345de27e0e8b7403fea50d54639ff8
parent0d018befdaa9b59ddcc53d21b01bef1439a237e3 (diff)
downloadsuil-68293752dbfd80016dc7543b88f22c602427fa75.tar.gz
suil-68293752dbfd80016dc7543b88f22c602427fa75.tar.bz2
suil-68293752dbfd80016dc7543b88f22c602427fa75.zip
Switch to meson build system
-rw-r--r--.gitignore2
-rw-r--r--.gitmodules3
-rw-r--r--INSTALL59
-rw-r--r--INSTALL.md72
-rw-r--r--NEWS4
-rw-r--r--doc/c/Doxyfile.in (renamed from doc/c/Doxyfile)8
-rw-r--r--doc/c/api/meson.build6
-rw-r--r--doc/c/index.rst9
-rw-r--r--doc/c/meson.build48
-rw-r--r--doc/c/wscript39
-rw-r--r--doc/c/xml/meson.build18
-rw-r--r--doc/meson.build15
-rw-r--r--doc/summary.rst (renamed from doc/suil.rst)4
-rw-r--r--meson.build328
-rw-r--r--meson/library/meson.build31
-rw-r--r--meson/suppressions/meson.build106
-rw-r--r--meson/warnings/meson.build245
-rw-r--r--meson_options.txt23
-rw-r--r--suil.pc.in11
-rwxr-xr-xwaf27
m---------waflib0
-rw-r--r--wscript473
22 files changed, 907 insertions, 624 deletions
diff --git a/.gitignore b/.gitignore
index 204c242..467d5b5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,2 @@
build/**
-.waf-*
-.lock-waf*
__pycache__
diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644
index cc8b569..0000000
--- a/.gitmodules
+++ /dev/null
@@ -1,3 +0,0 @@
-[submodule "waflib"]
- path = waflib
- url = ../../drobilla/autowaf.git
diff --git a/INSTALL b/INSTALL
deleted file mode 100644
index 623cddd..0000000
--- a/INSTALL
+++ /dev/null
@@ -1,59 +0,0 @@
-Installation Instructions
-=========================
-
-Basic Installation
-------------------
-
-Building this software requires only Python. To install with default options:
-
- ./waf configure
- ./waf
- ./waf install
-
-You may need to become root for the install stage, for example:
-
- sudo ./waf install
-
-Configuration Options
----------------------
-
-All supported options can be viewed using the command:
-
- ./waf --help
-
-Most options only need to be passed during the configure stage, for example:
-
- ./waf configure --prefix=/usr
- ./waf
- ./waf install
-
-Compiler Configuration
-----------------------
-
-Several standard environment variables can be used to control how compilers are
-invoked:
-
- * CC: Path to C compiler
- * CFLAGS: C compiler options
- * CXX: Path to C++ compiler
- * CXXFLAGS: C++ compiler options
- * CPPFLAGS: C preprocessor options
- * LINKFLAGS: Linker options
-
-Installation Directories
-------------------------
-
-The --prefix option (or the PREFIX environment variable) can be used to change
-the prefix which all files are installed under. There are also several options
-allowing for more fine-tuned control, see the --help output for details.
-
-Packaging
----------
-
-Everything can be installed to a specific root directory by passing a --destdir
-option to the install stage (or setting the DESTDIR environment variable),
-which adds a prefix to all install paths. For example:
-
- ./waf configure --prefix=/usr
- ./waf
- ./waf install --destdir=/tmp/package
diff --git a/INSTALL.md b/INSTALL.md
new file mode 100644
index 0000000..400391f
--- /dev/null
+++ b/INSTALL.md
@@ -0,0 +1,72 @@
+Installation Instructions
+=========================
+
+Prerequisites
+-------------
+
+To build from source, you will need:
+
+ * A relatively modern C compiler (GCC, Clang, and MSVC are known to work).
+
+ * [Meson](http://mesonbuild.com/), which depends on
+ [Python](http://python.org/).
+
+This is a brief overview of building this project with meson. See the meson
+documentation for more detailed information.
+
+Configuration
+-------------
+
+The build is configured with the `setup` command, which creates a new build
+directory with the given name:
+
+ meson setup build
+
+Some environment variables are read during `setup` and stored with the
+configuration:
+
+ * `CC`: Path to C compiler.
+ * `CFLAGS`: C compiler options.
+ * `CXX`: Path to C++ compiler.
+ * `CXXFLAGS`: C++ compiler options.
+ * `LDFLAGS`: Linker options.
+
+However, it is better to use meson options for configuration. All options can
+be inspected with the `configure` command from within the build directory:
+
+ cd build
+ meson configure
+
+Options can be set by passing C-style "define" options to `configure`:
+
+ meson configure -Dc_args="-march=native" -Dprefix="/opt/mypackage/"
+
+Building
+--------
+
+From within a configured build directory, everything can be built with the
+`compile` command:
+
+ meson compile
+
+Similarly, tests can be run with the `test` command:
+
+ meson test
+
+Meson can also generate a project for several popular IDEs, see the `backend`
+option for details.
+
+Installation
+------------
+
+A compiled project can be installed with the `install` command:
+
+ meson install
+
+You may need to acquire root permissions to install to a system-wide prefix.
+For packaging, the installation may be staged to a directory using the
+`DESTDIR` environment variable or the `--destdir` option:
+
+ DESTDIR=/tmp/mypackage/ meson install
+
+ meson install --destdir=/tmp/mypackage/
diff --git a/NEWS b/NEWS
index 9798959..77d60a8 100644
--- a/NEWS
+++ b/NEWS
@@ -1,9 +1,11 @@
suil (0.10.13) unstable;
* Fix MacOS build
+ * Fix documentation install path
* Remove dead Qt4 support code
+ * Switch to meson build system
- -- David Robillard <d@drobilla.net> Fri, 17 Jun 2022 00:38:46 +0000
+ -- David Robillard <d@drobilla.net> Fri, 08 Jul 2022 21:34:54 +0000
suil (0.10.12) stable;
diff --git a/doc/c/Doxyfile b/doc/c/Doxyfile.in
index ee7a427..326308b 100644
--- a/doc/c/Doxyfile
+++ b/doc/c/Doxyfile.in
@@ -19,8 +19,10 @@ XML_PROGRAMLISTING = NO
SHOW_FILES = NO
MACRO_EXPANSION = YES
-PREDEFINED = SUIL_API \
+PREDEFINED = SUIL_API
-INPUT = ../../include/suil/suil.h
+RECURSIVE = YES
+STRIP_FROM_PATH = @SUIL_SRCDIR@
+INPUT = @SUIL_SRCDIR@/include
-OUTPUT_DIRECTORY = .
+OUTPUT_DIRECTORY = @DOX_OUTPUT@
diff --git a/doc/c/api/meson.build b/doc/c/api/meson.build
new file mode 100644
index 0000000..4a9340f
--- /dev/null
+++ b/doc/c/api/meson.build
@@ -0,0 +1,6 @@
+c_suil_rst = custom_target(
+ 'suil.rst',
+ command: [dox_to_sphinx, '-f', '@INPUT0@', '@OUTDIR@'],
+ input: [c_index_xml] + c_rst_files,
+ output: 'suil.rst',
+)
diff --git a/doc/c/index.rst b/doc/c/index.rst
index b616761..1aefcb1 100644
--- a/doc/c/index.rst
+++ b/doc/c/index.rst
@@ -1,5 +1,10 @@
+####
+Suil
+####
+
+.. include:: summary.rst
+
.. toctree::
- suil
overview
- reference
+ api/suil
diff --git a/doc/c/meson.build b/doc/c/meson.build
new file mode 100644
index 0000000..64d1f4c
--- /dev/null
+++ b/doc/c/meson.build
@@ -0,0 +1,48 @@
+config = configuration_data()
+config.set('SUIL_VERSION', meson.project_version())
+
+conf_py = configure_file(
+ configuration: config,
+ input: files('../conf.py.in'),
+ output: 'conf.py',
+)
+
+configure_file(
+ copy: true,
+ input: files('../summary.rst'),
+ output: 'summary.rst',
+)
+
+c_rst_files = files(
+ 'index.rst',
+ 'overview.rst',
+)
+
+foreach f : c_rst_files
+ configure_file(copy: true, input: f, output: '@PLAINNAME@')
+endforeach
+
+subdir('xml')
+subdir('api')
+
+docs = custom_target(
+ 'singlehtml',
+ build_by_default: true,
+ command: [sphinx_build, '-M', 'singlehtml', '@OUTDIR@', '@OUTDIR@',
+ '-E', '-q', '-t', 'singlehtml'],
+ input: [c_rst_files, c_suil_rst, c_index_xml],
+ install: true,
+ install_dir: docdir / 'suil-0',
+ output: 'singlehtml',
+)
+
+docs = custom_target(
+ 'html',
+ build_by_default: true,
+ command: [sphinx_build, '-M', 'html', '@OUTDIR@', '@OUTDIR@',
+ '-E', '-q', '-t', 'html'],
+ input: [c_rst_files, c_suil_rst, c_index_xml],
+ install: true,
+ install_dir: docdir / 'suil-0',
+ output: 'html',
+)
diff --git a/doc/c/wscript b/doc/c/wscript
deleted file mode 100644
index ae074bc..0000000
--- a/doc/c/wscript
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/env python
-
-def build(bld):
- dox_to_sphinx = bld.path.find_node("../../scripts/dox_to_sphinx.py")
- index_xml = bld.path.get_bld().make_node("xml/index.xml")
-
- files = [
- ("../suil.rst", "sphinx/suil.rst"),
- ("index.rst", "sphinx/index.rst"),
- ("overview.rst", "sphinx/overview.rst"),
- ("reference.rst", "sphinx/reference.rst"),
- ]
-
- # Run Doxygen to generate XML documentation
- bld(features="doxygen", doxyfile="Doxyfile")
-
- # Substitute variables to make Sphinx configuration file
- bld(features="subst",
- source="../conf.py.in",
- target="sphinx/conf.py",
- SERD_VERSION=bld.env.SERD_VERSION)
-
- # Copy static documentation files to Sphinx build directory
- for f in files:
- bld(features="subst", is_copy=True, source=f[0], target=f[1])
-
- # Generate Sphinx markup from Doxygen XML
- bld.add_group()
- bld(rule="${PYTHON} " + dox_to_sphinx.abspath() + " -f ${SRC} ${TGT}",
- source=index_xml,
- target="sphinx/api/")
-
- # Run Sphinx to generate HTML documentation
- doc_dir = bld.env.DOCDIR + "/suil-%s/" % bld.env.SUIL_MAJOR_VERSION
- bld(features="sphinx",
- sphinx_source=bld.path.get_bld().make_node("sphinx"),
- sphinx_output_format="singlehtml",
- sphinx_options=["-E", "-q", "-t", "singlehtml"],
- install_path=doc_dir + "c/singlehtml/")
diff --git a/doc/c/xml/meson.build b/doc/c/xml/meson.build
new file mode 100644
index 0000000..c6c454e
--- /dev/null
+++ b/doc/c/xml/meson.build
@@ -0,0 +1,18 @@
+doxygen = find_program('doxygen')
+
+config = configuration_data()
+config.set('SUIL_SRCDIR', suil_src_root)
+config.set('DOX_OUTPUT', meson.current_build_dir() / '..')
+
+c_doxyfile = configure_file(
+ configuration: config,
+ input: files('../Doxyfile.in'),
+ output: 'Doxyfile',
+)
+
+c_index_xml = custom_target(
+ 'index.xml',
+ command: [doxygen, '@INPUT0@'],
+ input: [c_doxyfile] + c_headers,
+ output: 'index.xml',
+)
diff --git a/doc/meson.build b/doc/meson.build
new file mode 100644
index 0000000..46fc3bb
--- /dev/null
+++ b/doc/meson.build
@@ -0,0 +1,15 @@
+docdir = get_option('datadir') / 'doc'
+
+doxygen = find_program('doxygen', required: get_option('docs'))
+dox_to_sphinx = files('../scripts/dox_to_sphinx.py')
+sphinx_build = find_program('sphinx-build', required: get_option('docs'))
+
+build_docs = doxygen.found() and sphinx_build.found()
+
+if build_docs
+ subdir('c')
+endif
+
+if not meson.is_subproject()
+ summary('Documentation', build_docs, bool_yn: true)
+endif
diff --git a/doc/suil.rst b/doc/summary.rst
index c5dc5ab..fa94886 100644
--- a/doc/suil.rst
+++ b/doc/summary.rst
@@ -1,7 +1,3 @@
-####
-Suil
-####
-
Suil is a library for loading and wrapping LV2 plugin UIs.
With Suil,
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..866c382
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,328 @@
+project('suil', ['c', 'cpp'],
+ version: '0.10.13',
+ license: 'ISC',
+ meson_version: '>= 0.56.0',
+ default_options: [
+ 'b_ndebug=if-release',
+ 'buildtype=release',
+ 'c_std=c99',
+ 'cpp_std=c++14',
+ ])
+
+suil_src_root = meson.current_source_dir()
+major_version = meson.project_version().split('.')[0]
+version_suffix = '-@0@'.format(major_version)
+versioned_name = 'suil' + version_suffix
+suil_module_dir = get_option('libdir') / versioned_name
+
+#######################
+# Compilers and Flags #
+#######################
+
+# Load build tools
+pkg = import('pkgconfig')
+cc = meson.get_compiler('c')
+cpp = meson.get_compiler('cpp')
+
+# Enable Objective C support if we're building for MacOS
+if host_machine.system() == 'darwin'
+ add_languages(['objcpp'], native: false)
+ objcpp = meson.get_compiler('objcpp')
+endif
+
+# Set global warning flags
+if get_option('strict') and not meson.is_subproject()
+ subdir('meson/warnings')
+endif
+subdir('meson/suppressions')
+
+################
+# Dependencies #
+################
+
+dl_dep = cc.find_library('dl', required: false)
+
+lv2_dep = dependency(
+ 'lv2',
+ version: '>= 1.18.3',
+ fallback: ['lv2', 'lv2_dep'],
+)
+
+x11_dep = dependency(
+ 'x11',
+ required: get_option('x11'),
+)
+
+gtk2_dep = dependency(
+ 'gtk+-2.0',
+ include_type: 'system',
+ version: '>=2.18.0',
+ required: get_option('gtk2').enabled(),
+)
+
+gtk2_x11_dep = dependency(
+ 'gtk+-x11-2.0',
+ include_type: 'system',
+ required: get_option('gtk2').enabled() and get_option('x11').enabled(),
+)
+
+gtk2_quartz_dep = dependency(
+ 'gtk+-quartz-2.0',
+ include_type: 'system',
+ required: get_option('gtk2').enabled() and get_option('cocoa').enabled(),
+)
+
+gtk3_dep = dependency(
+ 'gtk+-3.0',
+ include_type: 'system',
+ version: '>=3.14.0',
+ required: get_option('gtk3'),
+)
+
+gtk3_x11_dep = dependency(
+ 'gtk+-x11-3.0',
+ include_type: 'system',
+ version: '>=3.14.0',
+ required: get_option('gtk3').enabled() and get_option('x11').enabled(),
+)
+
+qt5_dep = dependency(
+ 'Qt5Widgets',
+ include_type: 'system',
+ version: '>=5.1.0',
+ required: get_option('qt5'),
+)
+
+qt5_x11_dep = dependency(
+ 'Qt5X11Extras',
+ include_type: 'system',
+ version: '>=5.1.0',
+ required: get_option('qt5').enabled() and get_option('x11').enabled(),
+)
+
+if host_machine.system() == 'darwin' and not get_option('cocoa').disabled()
+ objcpp.has_header(
+ 'QMacCocoaViewContainer',
+ dependencies: qt5_dep,
+ required: get_option('qt5').enabled() and get_option('cocoa').enabled(),
+ )
+endif
+
+###########
+# Library #
+###########
+
+include_dirs = include_directories('include')
+c_headers = files('include/suil/suil.h')
+
+sources = files(
+ 'src/host.c',
+ 'src/instance.c',
+)
+
+# Set appropriate arguments for building against the library type
+extra_c_args = []
+subdir('meson/library')
+if get_option('default_library') == 'static'
+ extra_c_args = ['-DSUIL_STATIC']
+endif
+
+# Build shared and/or static library
+libsuil = library(
+ meson.project_name() + library_suffix,
+ sources,
+ c_args: c_suppressions + extra_c_args + ['-DSUIL_INTERNAL'],
+ dependencies: [dl_dep, lv2_dep],
+ gnu_symbol_visibility: 'hidden',
+ include_directories: include_dirs,
+ install: true,
+ version: meson.project_version(),
+)
+
+# Declare dependency for internal meson dependants
+suil_dep = declare_dependency(
+ compile_args: extra_c_args,
+ dependencies: [dl_dep],
+ include_directories: include_dirs,
+ link_with: libsuil,
+)
+
+# Generage pkg-config file for external dependants
+pkg.generate(
+ libsuil,
+ description: 'Library for loading and wrapping LV2 plugin UIs',
+ extra_cflags: extra_c_args,
+ filebase: versioned_name,
+ name: 'Suil',
+ subdirs: [versioned_name],
+ version: meson.project_version(),
+)
+
+# Install header to a versioned include directory
+install_headers(c_headers, subdir: versioned_name / 'suil')
+
+#####################
+# Host Init Modules #
+#####################
+
+if x11_dep.found()
+ shared_module(
+ 'suil_x11',
+ files('src/x11.c'),
+ c_args: c_suppressions,
+ dependencies: [lv2_dep, x11_dep],
+ gnu_symbol_visibility: 'hidden',
+ include_directories: include_dirs,
+ install: true,
+ install_dir: suil_module_dir,
+ )
+endif
+
+###################
+# Wrapper Modules #
+###################
+
+gtk_args = []
+if cc.get_id() == 'clang'
+ gtk_args += [
+ '-Wno-reserved-identifier',
+ ]
+endif
+
+gtk_c_args = cc.get_supported_arguments(gtk_args)
+gtk_cpp_args = cpp.get_supported_arguments(gtk_args)
+
+if gtk2_dep.found() and qt5_dep.found()
+ shared_module(
+ 'suil_gtk2_in_qt5',
+ files('src/gtk2_in_qt5.cpp'),
+ cpp_args: cpp_suppressions + gtk_cpp_args,
+ dependencies: [gtk2_dep, lv2_dep, qt5_dep],
+ gnu_symbol_visibility: 'hidden',
+ include_directories: include_dirs,
+ install: true,
+ install_dir: suil_module_dir,
+ )
+
+ shared_module(
+ 'suil_qt5_in_gtk2',
+ files('src/qt5_in_gtk.cpp'),
+ cpp_args: cpp_suppressions + gtk_cpp_args,
+ dependencies: [gtk2_dep, lv2_dep, qt5_dep],
+ gnu_symbol_visibility: 'hidden',
+ include_directories: include_dirs,
+ install: true,
+ install_dir: suil_module_dir,
+ )
+endif
+
+if gtk2_dep.found() and gtk2_x11_dep.found() and x11_dep.found()
+ shared_module(
+ 'suil_x11_in_gtk2',
+ files('src/x11_in_gtk2.c'),
+ c_args: c_suppressions + gtk_c_args,
+ dependencies: [gtk2_dep, gtk2_x11_dep, lv2_dep, x11_dep],
+ gnu_symbol_visibility: 'hidden',
+ include_directories: include_dirs,
+ install: true,
+ install_dir: suil_module_dir,
+ )
+endif
+
+if gtk3_dep.found() and gtk3_x11_dep.found() and x11_dep.found()
+ shared_module(
+ 'suil_x11_in_gtk3',
+ files('src/x11_in_gtk3.c'),
+ c_args: c_suppressions + gtk_c_args,
+ dependencies: [gtk3_dep, gtk3_x11_dep, lv2_dep, x11_dep],
+ gnu_symbol_visibility: 'hidden',
+ include_directories: include_dirs,
+ install: true,
+ install_dir: suil_module_dir,
+ )
+endif
+
+if gtk3_dep.found() and qt5_dep.found()
+ shared_module(
+ 'suil_qt5_in_gtk3',
+ files('src/qt5_in_gtk.cpp'),
+ cpp_args: cpp_suppressions + gtk_cpp_args,
+ dependencies: [gtk3_dep, lv2_dep, qt5_dep],
+ gnu_symbol_visibility: 'hidden',
+ include_directories: include_dirs,
+ install: true,
+ install_dir: suil_module_dir,
+ )
+endif
+
+if gtk2_dep.found() and gtk2_quartz_dep.found()
+ shared_module(
+ 'suil_cocoa_in_gtk2',
+ files('src/cocoa_in_gtk2.mm'),
+ dependencies: [gtk2_dep, lv2_dep, qt5_dep],
+ gnu_symbol_visibility: 'hidden',
+ include_directories: include_dirs,
+ install: true,
+ install_dir: suil_module_dir,
+ objcpp_args: objcpp_suppressions + gtk_cpp_args,
+ )
+endif
+
+if gtk2_dep.found() and host_machine.system() == 'windows'
+ shared_module(
+ 'suil_win_in_gtk2',
+ files('src/win_in_gtk2.cpp'),
+ cpp_args: cpp_suppressions + gtk_cpp_args,
+ dependencies: [gtk2_dep, lv2_dep],
+ gnu_symbol_visibility: 'hidden',
+ include_directories: include_dirs,
+ install: true,
+ install_dir: suil_module_dir,
+ )
+endif
+
+if qt5_dep.found() and qt5_x11_dep.found()
+ shared_module(
+ 'suil_x11_in_qt5',
+ files('src/x11_in_qt5.cpp'),
+ cpp_args: cpp_suppressions,
+ dependencies: [lv2_dep, qt5_dep, qt5_x11_dep],
+ gnu_symbol_visibility: 'hidden',
+ include_directories: include_dirs,
+ install: true,
+ install_dir: suil_module_dir,
+ )
+endif
+
+if host_machine.system() == 'darwin'
+ if qt5_dep.found() and not get_option('cocoa').disabled()
+ cocoa_suppressions = [
+ '-Wno-deprecated-declarations',
+ ]
+
+ shared_module(
+ 'suil_cocoa_in_qt5',
+ files('src/cocoa_in_qt5.mm'),
+ dependencies: [lv2_dep, qt5_dep],
+ gnu_symbol_visibility: 'hidden',
+ include_directories: include_dirs,
+ install: true,
+ install_dir: suil_module_dir,
+ objcpp_args: cocoa_suppressions + objcpp_suppressions,
+ )
+ endif
+endif
+
+#################
+# Documentation #
+#################
+
+if not get_option('docs').disabled()
+ subdir('doc')
+endif
+
+if not meson.is_subproject()
+ summary('Install prefix', get_option('prefix'))
+ summary('Headers', get_option('prefix') / get_option('includedir'))
+ summary('Libraries', get_option('prefix') / get_option('libdir'))
+endif
diff --git a/meson/library/meson.build b/meson/library/meson.build
new file mode 100644
index 0000000..fffc831
--- /dev/null
+++ b/meson/library/meson.build
@@ -0,0 +1,31 @@
+# Copyright 2020-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: CC0-1.0 OR ISC
+
+# General definitions for building libraries.
+#
+# These are essentially workarounds for Meson/Windows/MSVC. Unfortunately,
+# Meson's default_library option doesn't support shared and static builds very
+# well. In particular, it's often necessary to define different symbols for
+# static and shared builds of libraries so that symbols can be exported. To
+# work around this, default_library=both isn't supported on Windows. On other
+# platforms with GCC-like compilers, we can support both because symbols can
+# safely be exported in the same way (giving them default visibility) in both
+# static and shared builds.
+
+default_library = get_option('default_library')
+host_system = host_machine.system()
+
+# Abort on Windows with default_library=both
+if host_system == 'windows' and default_library == 'both'
+ error('default_library=both is not supported on Windows')
+endif
+
+# Set library_suffix to the suffix for libraries
+if host_system == 'windows' and default_library == 'shared'
+ # Meson appends a version to the name only for DLLs, which leads to
+ # inconsistent library names, like `mylib-1-1`. So, provide no suffix to
+ # ultimately get the same name as on other platforms, like `mylib-1`.
+ library_suffix = ''
+else
+ library_suffix = '-@0@'.format(meson.project_version().split('.')[0])
+endif
diff --git a/meson/suppressions/meson.build b/meson/suppressions/meson.build
new file mode 100644
index 0000000..e830501
--- /dev/null
+++ b/meson/suppressions/meson.build
@@ -0,0 +1,106 @@
+# Copyright 2020-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: CC0-1.0 OR ISC
+
+# Project-specific warning suppressions.
+#
+# This should be used in conjunction with the generic "warnings" sibling that
+# enables all reasonable warnings for the compiler. It lives here just to keep
+# the top-level meson.build more readable.
+
+#####
+# C #
+#####
+
+if is_variable('cc')
+ c_suppressions = []
+
+ if get_option('strict')
+ if cc.get_id() == 'clang'
+ c_suppressions += [
+ '-Wno-atomic-implicit-seq-cst',
+ '-Wno-cast-qual',
+ '-Wno-declaration-after-statement',
+ '-Wno-disabled-macro-expansion',
+ '-Wno-padded',
+ '-Wno-reserved-id-macro',
+ '-Wno-variadic-macros',
+ ]
+
+ elif cc.get_id() == 'gcc'
+ c_suppressions += [
+ '-Wno-padded',
+ '-Wno-suggest-attribute=const',
+ '-Wno-suggest-attribute=pure',
+ ]
+
+ elif cc.get_id() == 'msvc'
+ c_suppressions += [
+ '/wd4191', # unsafe function conversion
+ '/wd4514', # unreferenced inline function has been removed
+ '/wd4710', # function not inlined
+ '/wd4820', # padding added after construct
+ '/wd4996', # function or variable may be unsafe
+ '/wd5045', # will insert Spectre mitigation for memory load
+ ]
+ endif
+
+ endif
+
+ c_suppressions = cc.get_supported_arguments(c_suppressions)
+endif
+
+#######
+# C++ #
+#######
+
+if is_variable('cpp')
+ cpp_suppressions = []
+
+ if get_option('strict')
+ if cpp.get_id() == 'clang'
+ cpp_suppressions += [
+ '-Wno-atomic-implicit-seq-cst',
+ '-Wno-cast-qual',
+ '-Wno-disabled-macro-expansion',
+ '-Wno-old-style-cast',
+ '-Wno-padded',
+ '-Wno-reserved-id-macro',
+ '-Wno-variadic-macros',
+ '-Wno-zero-as-null-pointer-constant',
+ ]
+
+ elif cpp.get_id() == 'gcc'
+ cpp_suppressions += [
+ '-Wno-arith-conversion',
+ '-Wno-cast-qual',
+ '-Wno-padded',
+ '-Wno-suggest-attribute=const',
+ '-Wno-suggest-attribute=pure',
+ '-Wno-useless-cast',
+ '-Wno-volatile',
+ ]
+ endif
+ endif
+
+ cpp_suppressions = cpp.get_supported_arguments(cpp_suppressions)
+endif
+
+#################
+# Objective C++ #
+#################
+
+if is_variable('objcpp')
+ objcpp_suppressions = []
+
+ if objcpp.get_id() == 'clang'
+ c_suppressions += [
+ '-Wno-deprecated-declarations',
+ ]
+ elif objcpp.get_id() == 'gcc'
+ objcpp_suppressions = gcc_common_warnings + [
+ '-Wno-direct-ivar-access',
+ ]
+ endif
+
+ objcpp_suppressions = objcpp.get_supported_arguments(objcpp_suppressions)
+endif
diff --git a/meson/warnings/meson.build b/meson/warnings/meson.build
new file mode 100644
index 0000000..2fbceda
--- /dev/null
+++ b/meson/warnings/meson.build
@@ -0,0 +1,245 @@
+# Copyright 2020-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: CC0-1.0 OR ISC
+
+# General code to enable approximately all warnings in GCC 12, clang, and MSVC.
+#
+# This is trivial for clang and MSVC, but GCC doesn't have an "everything"
+# option, so we need to enable everything we want explicitly. Wall is assumed,
+# but Wextra is not, for stability.
+#
+# These are collected from common.opt and c.opt in the GCC source, and manually
+# curated with the help of the GCC documentation. Warnings that are
+# application-specific, historical, or about compatibility between specific
+# language revisions are omitted. The intent here is to have roughly the same
+# meaning as clang's Weverything: extremely strict, but general. Specifically
+# omitted are:
+#
+# General:
+#
+# Wabi=
+# Waggregate-return
+# Walloc-size-larger-than=BYTES
+# Walloca-larger-than=BYTES
+# Wframe-larger-than=BYTES
+# Wlarger-than=BYTES
+# Wstack-usage=BYTES
+# Wsystem-headers
+# Wtraditional
+# Wtraditional-conversion
+# Wtrampolines
+# Wvla-larger-than=BYTES
+#
+# Build specific:
+#
+# Wpoison-system-directories
+#
+# C Specific:
+#
+# Wc11-c2x-compat
+# Wc90-c99-compat
+# Wc99-c11-compat
+# Wdeclaration-after-statement
+# Wtraditional
+# Wtraditional-conversion
+#
+# C++ Specific:
+#
+# Wc++0x-compat
+# Wc++1z-compat
+# Wc++2a-compat
+# Wctad-maybe-unsupported
+# Wnamespaces
+# Wtemplates
+
+gcc_common_warnings = [
+ '-Walloc-zero',
+ '-Walloca',
+ '-Wanalyzer-too-complex',
+ '-Warith-conversion',
+ '-Warray-bounds=2',
+ '-Wattribute-alias=2',
+ '-Wbidi-chars=ucn',
+ '-Wcast-align=strict',
+ '-Wcast-function-type',
+ '-Wcast-qual',
+ '-Wclobbered',
+ '-Wconversion',
+ '-Wdate-time',
+ '-Wdisabled-optimization',
+ '-Wdouble-promotion',
+ '-Wduplicated-branches',
+ '-Wduplicated-cond',
+ '-Wempty-body',
+ '-Wendif-labels',
+ '-Wfloat-equal',
+ '-Wformat-overflow=2',
+ '-Wformat-signedness',
+ '-Wformat-truncation=2',
+ '-Wformat=2',
+ '-Wignored-qualifiers',
+ '-Wimplicit-fallthrough=3',
+ '-Winit-self',
+ '-Winline',
+ '-Winvalid-pch',
+ '-Wlogical-op',
+ '-Wmissing-declarations',
+ '-Wmissing-field-initializers',
+ '-Wmissing-include-dirs',
+ '-Wmultichar',
+ '-Wnormalized=nfc',
+ '-Wnull-dereference',
+ '-Wopenacc-parallelism',
+ '-Woverlength-strings',
+ '-Wpacked',
+ '-Wpacked-bitfield-compat',
+ '-Wpadded',
+ '-Wpointer-arith',
+ '-Wredundant-decls',
+ '-Wshadow',
+ '-Wshift-negative-value',
+ '-Wshift-overflow=2',
+ '-Wstack-protector',
+ '-Wstrict-aliasing=3',
+ '-Wstrict-overflow=5',
+ '-Wstring-compare',
+ '-Wstringop-overflow=3',
+ '-Wsuggest-attribute=cold',
+ '-Wsuggest-attribute=const',
+ '-Wsuggest-attribute=format',
+ '-Wsuggest-attribute=malloc',
+ '-Wsuggest-attribute=noreturn',
+ '-Wsuggest-attribute=pure',
+ '-Wswitch-default',
+ '-Wswitch-enum',
+ '-Wtrampolines',
+ '-Wtrivial-auto-var-init',
+ '-Wtype-limits',
+ '-Wundef',
+ '-Wuninitialized',
+ '-Wunsafe-loop-optimizations',
+ '-Wunused',
+ '-Wunused-const-variable=2',
+ '-Wunused-macros',
+ '-Wvector-operation-performance',
+ '-Wvla',
+ '-Wwrite-strings',
+]
+
+#####
+# C #
+#####
+
+if is_variable('cc')
+ all_c_warnings = []
+
+ if cc.get_id() == 'clang'
+ all_c_warnings += ['-Weverything']
+
+ elif cc.get_id() == 'gcc'
+ all_c_warnings += gcc_common_warnings + [
+ '-Wabsolute-value',
+ '-Wbad-function-cast',
+ '-Wc++-compat',
+ '-Wenum-conversion',
+ '-Wjump-misses-init',
+ '-Wmissing-parameter-type',
+ '-Wmissing-prototypes',
+ '-Wnested-externs',
+ '-Wold-style-declaration',
+ '-Wold-style-definition',
+ '-Woverride-init',
+ '-Wsign-compare',
+ '-Wstrict-prototypes',
+ '-Wunsuffixed-float-constants',
+ ]
+
+ elif cc.get_id() == 'msvc'
+ all_c_warnings += ['/Wall']
+ endif
+
+ all_c_warnings = cc.get_supported_arguments(all_c_warnings)
+ add_global_arguments(all_c_warnings, language: ['c'])
+endif
+
+#######
+# C++ #
+#######
+
+if is_variable('cpp')
+ all_cpp_warnings = []
+
+ if cpp.get_id() == 'clang'
+ all_cpp_warnings += [
+ '-Weverything',
+ '-Wno-c++98-compat',
+ '-Wno-c++98-compat-pedantic'
+ ]
+
+ elif cpp.get_id() == 'gcc'
+ all_cpp_warnings += gcc_common_warnings + [
+ '-Wabi-tag',
+ '-Waligned-new=all',
+ '-Wcatch-value=3',
+ '-Wcomma-subscript',
+ '-Wconditionally-supported',
+ '-Wctor-dtor-privacy',
+ '-Wdelete-non-virtual-dtor',
+ '-Wdeprecated',
+ '-Wdeprecated-copy',
+ '-Wdeprecated-copy-dtor',
+ '-Wdeprecated-enum-enum-conversion',
+ '-Wdeprecated-enum-float-conversion',
+ '-Weffc++',
+ '-Wexpansion-to-defined',
+ '-Wextra-semi',
+ '-Wimport',
+ '-Winvalid-imported-macros',
+ '-Wmismatched-tags',
+ '-Wmultiple-inheritance',
+ '-Wnoexcept',
+ '-Wnoexcept-type',
+ '-Wnon-virtual-dtor',
+ '-Wold-style-cast',
+ '-Woverloaded-virtual',
+ '-Wplacement-new=2',
+ '-Wredundant-move',
+ '-Wredundant-tags',
+ '-Wregister',
+ '-Wsign-compare',
+ '-Wsign-promo',
+ '-Wsized-deallocation',
+ '-Wstrict-null-sentinel',
+ '-Wsuggest-final-methods',
+ '-Wsuggest-final-types',
+ '-Wsuggest-override',
+ '-Wuseless-cast',
+ '-Wvirtual-inheritance',
+ '-Wvolatile',
+ '-Wzero-as-null-pointer-constant',
+ ]
+
+ elif cpp.get_id() == 'msvc'
+ all_cpp_warnings += ['/Wall']
+ endif
+
+ all_cpp_warnings = cpp.get_supported_arguments(all_cpp_warnings)
+ add_global_arguments(all_cpp_warnings, language: ['cpp'])
+endif
+
+#################
+# Objective C++ #
+#################
+
+if is_variable('objcpp')
+ all_objcpp_warnings = []
+
+ if objcpp.get_id() == 'clang'
+ all_objcpp_warnings += ['-Weverything']
+
+ elif objpp.get_id() == 'gcc'
+ all_objcpp_warnings = gcc_common_warnings
+ endif
+
+ all_objcpp_warnings = objcpp.get_supported_arguments(all_objcpp_warnings)
+ add_global_arguments(all_objcpp_warnings, language: ['objcpp'])
+endif
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..e46d37c
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,23 @@
+option('cocoa', type: 'feature', value: 'auto', yield: true,
+ description : 'Build Cocoa wrappers')
+
+option('docs', type: 'feature', value: 'auto', yield: true,
+ description: 'Build documentation')
+
+option('gtk2', type: 'feature', value: 'auto', yield: true,
+ description : 'Build Gtk2 wrappers')
+
+option('gtk3', type: 'feature', value: 'auto', yield: true,
+ description : 'Build Gtk3 wrappers')
+
+option('qt5', type: 'feature', value: 'auto', yield: true,
+ description : 'Build Qt5 wrappers')
+
+option('strict', type: 'boolean', value: false, yield: true,
+ description: 'Enable ultra-strict warnings')
+
+option('title', type: 'string', value: 'Suil',
+ description: 'Project title')
+
+option('x11', type: 'feature', value: 'auto', yield: true,
+ description : 'Build X11 wrappers')
diff --git a/suil.pc.in b/suil.pc.in
deleted file mode 100644
index 66810a6..0000000
--- a/suil.pc.in
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix=@PREFIX@
-exec_prefix=@EXEC_PREFIX@
-libdir=@LIBDIR@
-includedir=@INCLUDEDIR@
-
-Name: Suil
-Version: @SUIL_VERSION@
-Description: LV2 plugin UI hosting library
-Requires: @SUIL_PKG_DEPS@
-Libs: -L${libdir} -l@LIB_SUIL@
-Cflags: -I${includedir}/suil-@SUIL_MAJOR_VERSION@
diff --git a/waf b/waf
deleted file mode 100755
index 887215c..0000000
--- a/waf
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/env python
-
-# Minimal waf script for projects that include waflib directly
-
-import sys
-import inspect
-import os
-
-try:
- from waflib import Context, Scripting
-except Exception as e:
- sys.stderr.write('error: Failed to import waf (%s)\n' % e)
- if os.path.exists('.git'):
- sys.stderr.write("Are submodules up to date? "
- "Try 'git submodule update --init --recursive'\n")
-
- sys.exit(1)
-
-
-def main():
- script_path = os.path.abspath(inspect.getfile(inspect.getmodule(main)))
- project_path = os.path.dirname(script_path)
- Scripting.waf_entry_point(os.getcwd(), Context.WAFVERSION, project_path)
-
-
-if __name__ == '__main__':
- main()
diff --git a/waflib b/waflib
deleted file mode 160000
-Subproject aeef9f5fdf416d9b68c61c75de7dae409f1ac6a
diff --git a/wscript b/wscript
deleted file mode 100644
index 86cc10e..0000000
--- a/wscript
+++ /dev/null
@@ -1,473 +0,0 @@
-#!/usr/bin/env python
-
-from waflib import Build, Logs, Options, TaskGen
-from waflib.extras import autowaf
-
-# Semver package/library version
-SUIL_VERSION = '0.10.13'
-SUIL_MAJOR_VERSION = SUIL_VERSION[0:SUIL_VERSION.find('.')]
-
-# Mandatory waf variables
-APPNAME = 'suil' # Package name for waf dist
-VERSION = SUIL_VERSION # Package version for waf dist
-top = '.' # Source directory
-out = 'build' # Build directory
-
-# Release variables
-uri = 'http://drobilla.net/sw/suil'
-dist_pattern = 'http://download.drobilla.net/suil-%d.%d.%d.tar.bz2'
-post_tags = ['Hacking', 'LAD', 'LV2', 'Suil']
-
-
-def options(ctx):
- ctx.load('compiler_c')
- ctx.load('compiler_cxx')
- opt = ctx.configuration_options()
-
- opt.add_option('--gtk2-lib-name', type='string', dest='gtk2_lib_name',
- default="libgtk-x11-2.0.so.0",
- help="Gtk2 library name [Default: libgtk-x11-2.0.so.0]")
- opt.add_option('--gtk3-lib-name', type='string', dest='gtk3_lib_name',
- default="libgtk-x11-3.0.so.0",
- help="Gtk3 library name [Default: libgtk-x11-3.0.so.0]")
-
- ctx.add_flags(
- opt,
- {'static': 'build static library',
- 'no-shared': 'do not build shared library',
- 'no-cocoa': 'do not build support for Cocoa/Quartz',
- 'no-gtk': 'do not build support for Gtk',
- 'no-qt': 'do not build support for Qt (any version)',
- 'no-qt5': 'do not build support for Qt5',
- 'no-x11': 'do not build support for X11'})
-
-
-def configure(conf):
- conf.load('compiler_c', cache=True)
- conf.load('compiler_cxx', cache=True)
- conf.load('autowaf', cache=True)
- autowaf.set_c_lang(conf, 'c99')
- autowaf.set_cxx_lang(conf, 'c++11')
-
- conf.env.BUILD_SHARED = not conf.options.no_shared
- conf.env.BUILD_STATIC = conf.options.static
-
- if not conf.env.BUILD_SHARED and not conf.env.BUILD_STATIC:
- conf.fatal('Neither a shared nor a static build requested')
-
- if conf.env.DOCS:
- conf.load('sphinx')
-
- if Options.options.strict:
- # Check for programs used by lint target
- conf.find_program("flake8", var="FLAKE8", mandatory=False)
- conf.find_program("clang-tidy", var="CLANG_TIDY", mandatory=False)
- conf.find_program("iwyu_tool", var="IWYU_TOOL", mandatory=False)
-
- if Options.options.ultra_strict:
- autowaf.add_compiler_flags(conf.env, '*', {
- 'gcc': [
- '-Wno-padded',
- '-Wno-suggest-attribute=const',
- '-Wno-suggest-attribute=pure',
- ],
- 'clang': [
- '-Wno-cast-qual',
- '-Wno-declaration-after-statement',
- '-Wno-deprecated-declarations', # Mac
- '-Wno-disabled-macro-expansion',
- '-Wno-padded',
- '-Wno-reserved-id-macro', # Mac
- '-Wno-switch-enum', # Mac
- ]
- })
-
- autowaf.add_compiler_flags(conf.env, 'c', {
- 'msvc': [
- '/wd4514', # unreferenced inline function has been removed
- '/wd4820', # padding added after construct
- '/wd4191', # unsafe function conversion
- '/wd5045', # will insert Spectre mitigation for memory load
- ],
- })
-
- conf.env.NODELETE_FLAGS = []
- if (not conf.env.MSVC_COMPILER and
- conf.check(linkflags = ['-Wl,-z,nodelete'],
- msg = 'Checking for link flags -Wl,-z,-nodelete',
- mandatory = False)):
- conf.env.NODELETE_FLAGS = ['-Wl,-z,nodelete']
-
- conf.check_pkg('lv2 >= 1.16.0', uselib_store='LV2')
-
- if not conf.options.no_x11:
- conf.check_pkg('x11', uselib_store='X11', system=True, mandatory=False)
-
- def enable_module(var_name):
- conf.env[var_name] = 1
-
- if not conf.options.no_gtk:
- conf.check_pkg('gtk+-2.0 >= 2.18.0',
- uselib_store='GTK2',
- system=True,
- mandatory=False)
- if not conf.env.HAVE_GTK2:
- conf.check_pkg('gtk+-2.0',
- uselib_store='GTK2',
- system=True,
- mandatory=False)
- if conf.env.HAVE_GTK2:
- conf.define('SUIL_OLD_GTK', 1)
-
- if not conf.options.no_x11:
- conf.check_pkg('gtk+-x11-2.0',
- uselib_store='GTK2_X11',
- system=True,
- mandatory=False)
-
- if not conf.options.no_cocoa:
- conf.check_pkg('gtk+-quartz-2.0',
- uselib_store='GTK2_QUARTZ',
- system=True,
- mandatory=False)
-
- conf.check_pkg('gtk+-3.0 >= 3.14.0',
- uselib_store='GTK3',
- system=True,
- mandatory=False)
-
- if not conf.options.no_x11:
- conf.check_pkg('gtk+-x11-3.0 >= 3.14.0',
- uselib_store='GTK3_X11',
- system=True,
- mandatory=False)
-
- if not conf.options.no_qt:
- if not conf.options.no_qt5:
- conf.check_pkg('Qt5Widgets >= 5.1.0',
- uselib_store='QT5',
- system=True,
- mandatory=False)
-
- if not conf.options.no_x11:
- conf.check_pkg('Qt5X11Extras >= 5.1.0',
- uselib_store='QT5_X11',
- system=True,
- mandatory=False)
-
- if conf.env.DEST_OS == 'darwin' and not conf.options.no_cocoa:
- if conf.check_cxx(header_name='QMacCocoaViewContainer',
- uselib='QT5',
- system=True,
- mandatory=False):
- enable_module('SUIL_WITH_COCOA_IN_QT5')
-
- conf.check_cc(define_name = 'HAVE_LIBDL',
- lib = 'dl',
- mandatory = False)
-
- conf.define('SUIL_MODULE_DIR',
- conf.env.LIBDIR + '/suil-' + SUIL_MAJOR_VERSION)
-
- conf.define('SUIL_GTK2_LIB_NAME', conf.options.gtk2_lib_name)
- conf.define('SUIL_GTK3_LIB_NAME', conf.options.gtk3_lib_name)
-
- if conf.env.HAVE_GTK2 and conf.env.HAVE_QT5:
- enable_module('SUIL_WITH_GTK2_IN_QT5')
- enable_module('SUIL_WITH_QT5_IN_GTK2')
-
- if conf.env.HAVE_GTK2 and conf.env.HAVE_GTK2_X11:
- enable_module('SUIL_WITH_X11_IN_GTK2')
-
- if conf.env.HAVE_GTK3 and conf.env.HAVE_GTK3_X11:
- enable_module('SUIL_WITH_X11_IN_GTK3')
-
- if conf.env.HAVE_GTK3 and conf.env.HAVE_GTK3_X11 and conf.env.HAVE_QT5:
- enable_module('SUIL_WITH_QT5_IN_GTK3')
-
- if conf.env.HAVE_GTK2 and conf.env.HAVE_GTK2_QUARTZ:
- enable_module('SUIL_WITH_COCOA_IN_GTK2')
-
- if conf.env.HAVE_GTK2 and conf.env.DEST_OS == 'win32':
- enable_module('SUIL_WITH_WIN_IN_GTK2')
-
- if conf.env.HAVE_QT5 and conf.env.HAVE_QT5_X11:
- enable_module('SUIL_WITH_X11_IN_QT5')
-
- if conf.env.HAVE_X11:
- enable_module('SUIL_WITH_X11')
-
- conf.run_env.append_unique('SUIL_MODULE_DIR', [conf.build_path()])
-
- # Set up environment for building/using as a subproject
- autowaf.set_lib_env(conf, 'suil', SUIL_VERSION,
- include_path=str(conf.path.find_node('include')))
-
- conf.define('SUIL_NO_DEFAULT_CONFIG', 1)
-
- autowaf.display_summary(
- conf,
- {'Static library': bool(conf.env.BUILD_STATIC),
- 'Shared library': bool(conf.env.BUILD_SHARED)})
-
- if conf.env.HAVE_GTK2:
- autowaf.display_msg(conf, "Gtk2 Library Name",
- conf.get_define('SUIL_GTK2_LIB_NAME'))
- if conf.env.HAVE_GTK3:
- autowaf.display_msg(conf, "Gtk3 Library Name",
- conf.get_define('SUIL_GTK3_LIB_NAME'))
-
- # Print summary message for every potentially supported wrapper
- wrappers = [('cocoa', 'gtk2'),
- ('gtk2', 'qt5'),
- ('qt5', 'gtk2'),
- ('win', 'gtk2'),
- ('x11', 'gtk2'),
- ('x11', 'gtk3'),
- ('qt5', 'gtk3'),
- ('x11', 'qt5'),
- ('cocoa', 'qt5')]
- for w in wrappers:
- var = 'SUIL_WITH_%s_IN_%s' % (w[0].upper(), w[1].upper())
- autowaf.display_msg(conf, 'Support for %s in %s' % (w[0], w[1]),
- bool(conf.env[var]))
-
-
-def build(bld):
- # C Headers
- includedir = '${INCLUDEDIR}/suil-%s/suil' % SUIL_MAJOR_VERSION
- bld.install_files(includedir, bld.path.ant_glob('include/suil/*.h'))
- TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
-
- # Pkgconfig file
- autowaf.build_pc(bld, 'SUIL', SUIL_VERSION, SUIL_MAJOR_VERSION, [],
- {'SUIL_MAJOR_VERSION': SUIL_MAJOR_VERSION,
- 'SUIL_PKG_DEPS': 'lv2'})
-
- cflags = []
- lib = []
- modlib = []
- if bld.env.DEST_OS == 'win32':
- modlib += ['user32']
- else:
- cflags += ['-fvisibility=hidden']
- if bld.is_defined('HAVE_LIBDL'):
- lib += ['dl']
- modlib += ['dl']
-
- module_dir = '${LIBDIR}/suil-' + SUIL_MAJOR_VERSION
-
- # Shared Library
- if bld.env.BUILD_SHARED:
- bld(features = 'c cshlib',
- export_includes = ['include'],
- source = 'src/host.c src/instance.c',
- target = 'suil-%s' % SUIL_MAJOR_VERSION,
- includes = ['.', 'include'],
- defines = ['SUIL_INTERNAL'],
- name = 'libsuil',
- vnum = SUIL_VERSION,
- install_path = '${LIBDIR}',
- cflags = cflags,
- lib = lib,
- uselib = 'LV2')
-
- # Static library
- if bld.env.BUILD_STATIC:
- bld(features = 'c cstlib',
- export_includes = ['include'],
- source = 'src/host.c src/instance.c',
- target = 'suil-%s' % SUIL_MAJOR_VERSION,
- includes = ['.', 'include'],
- defines = ['SUIL_STATIC', 'SUIL_INTERNAL'],
- name = 'libsuil_static',
- vnum = SUIL_VERSION,
- install_path = '${LIBDIR}',
- cflags = cflags,
- lib = lib,
- uselib = 'LV2')
-
- if bld.env.SUIL_WITH_GTK2_IN_QT5:
- bld(features = 'cxx cxxshlib',
- source = 'src/gtk2_in_qt5.cpp',
- target = 'suil_gtk2_in_qt5',
- includes = ['.', 'include'],
- defines = ['SUIL_INTERNAL'],
- install_path = module_dir,
- cxxflags = cflags,
- lib = modlib,
- uselib = 'GTK2 QT5 LV2')
-
- if bld.env.SUIL_WITH_QT5_IN_GTK2:
- bld(features = 'cxx cxxshlib',
- source = 'src/qt5_in_gtk.cpp',
- target = 'suil_qt5_in_gtk2',
- includes = ['.', 'include'],
- defines = ['SUIL_INTERNAL'],
- install_path = module_dir,
- cxxflags = cflags,
- lib = modlib,
- uselib = 'GTK2 QT5 LV2',
- linkflags = bld.env.NODELETE_FLAGS)
-
- if bld.env.SUIL_WITH_X11_IN_GTK2:
- bld(features = 'c cshlib',
- source = 'src/x11_in_gtk2.c',
- target = 'suil_x11_in_gtk2',
- includes = ['.', 'include'],
- defines = ['SUIL_INTERNAL'],
- install_path = module_dir,
- cflags = cflags,
- lib = modlib + ['X11'],
- uselib = 'GTK2 GTK2_X11 LV2',
- linkflags = bld.env.NODELETE_FLAGS)
-
- if bld.env.SUIL_WITH_X11_IN_GTK3:
- bld(features = 'c cshlib',
- source = 'src/x11_in_gtk3.c',
- target = 'suil_x11_in_gtk3',
- includes = ['.', 'include'],
- defines = ['SUIL_INTERNAL'],
- install_path = module_dir,
- cflags = cflags,
- lib = modlib + ['X11'],
- uselib = 'GTK3 GTK3_X11 LV2',
- linkflags = bld.env.NODELETE_FLAGS)
-
- if bld.env.SUIL_WITH_QT5_IN_GTK3:
- bld(features = 'cxx cxxshlib',
- source = 'src/qt5_in_gtk.cpp',
- target = 'suil_qt5_in_gtk3',
- includes = ['.', 'include'],
- defines = ['SUIL_INTERNAL'],
- install_path = module_dir,
- cflags = cflags,
- lib = modlib,
- uselib = 'GTK3 QT5 LV2',
- linkflags = bld.env.NODELETE_FLAGS)
-
- if bld.env.SUIL_WITH_COCOA_IN_GTK2:
- bld(features = 'cxx cshlib',
- source = 'src/cocoa_in_gtk2.mm',
- target = 'suil_cocoa_in_gtk2',
- includes = ['.', 'include'],
- defines = ['SUIL_INTERNAL'],
- install_path = module_dir,
- cflags = cflags,
- lib = modlib,
- uselib = 'GTK2 LV2',
- linkflags = ['-framework', 'Cocoa'])
-
- if bld.env.SUIL_WITH_WIN_IN_GTK2:
- bld(features = 'cxx cxxshlib',
- source = 'src/win_in_gtk2.cpp',
- target = 'suil_win_in_gtk2',
- includes = ['.', 'include'],
- defines = ['SUIL_INTERNAL'],
- install_path = module_dir,
- cflags = cflags,
- lib = modlib,
- uselib = 'GTK2 LV2',
- linkflags = bld.env.NODELETE_FLAGS)
-
- if bld.env.SUIL_WITH_X11_IN_QT5:
- bld(features = 'cxx cxxshlib',
- source = 'src/x11_in_qt5.cpp',
- target = 'suil_x11_in_qt5',
- includes = ['.', 'include'],
- defines = ['SUIL_INTERNAL'],
- install_path = module_dir,
- cflags = cflags,
- lib = modlib,
- uselib = 'QT5 QT5_X11 LV2 X11')
-
- if bld.env.SUIL_WITH_COCOA_IN_QT5:
- bld(features = 'cxx cxxshlib',
- source = 'src/cocoa_in_qt5.mm',
- target = 'suil_cocoa_in_qt5',
- includes = ['.', 'include'],
- defines = ['SUIL_INTERNAL'],
- install_path = module_dir,
- cflags = cflags,
- lib = modlib,
- uselib = 'QT5 LV2',
- linkflags = ['-framework', 'Cocoa'])
-
- if bld.env.SUIL_WITH_X11:
- bld(features = 'c cshlib',
- source = 'src/x11.c',
- target = 'suil_x11',
- includes = ['.', 'include'],
- defines = ['SUIL_INTERNAL'],
- install_path = module_dir,
- cflags = cflags,
- lib = modlib,
- uselib = 'X11 LV2')
-
- # Documentation
- if bld.env.DOCS:
- bld.recurse('doc/c')
-
- bld.add_post_fun(autowaf.run_ldconfig)
-
-
-class LintContext(Build.BuildContext):
- fun = cmd = 'lint'
-
-
-def lint(ctx):
- "checks code for style issues"
- import glob
- import os
- import subprocess
- import sys
-
- st = 0
-
- if "FLAKE8" in ctx.env:
- Logs.info("Running flake8")
- st = subprocess.call([ctx.env.FLAKE8[0],
- "wscript",
- "--ignore",
- "E101,E129,W191,E221,W504,E251,E241,E741"])
- else:
- Logs.warn("Not running flake8")
-
- if "IWYU_TOOL" in ctx.env:
- Logs.info("Running include-what-you-use")
-
- qt_mapping_file = "/usr/share/include-what-you-use/qt5_11.imp"
- extra_args = []
- if os.path.exists(qt_mapping_file):
- extra_args += ["--", "-Xiwyu", "--mapping_file=" + qt_mapping_file]
-
- cmd = [ctx.env.IWYU_TOOL[0], "-o", "clang", "-p", "build"] + extra_args
- output = subprocess.check_output(cmd).decode('utf-8')
- if 'error: ' in output:
- sys.stdout.write(output)
- st += 1
- else:
- Logs.warn("Not running include-what-you-use")
-
- if "CLANG_TIDY" in ctx.env and "clang" in ctx.env.CC[0]:
- Logs.info("Running clang-tidy")
- sources = glob.glob('src/*.c') + glob.glob('tests/*.c')
- sources = list(map(os.path.abspath, sources))
- procs = []
- for source in sources:
- cmd = [ctx.env.CLANG_TIDY[0], "--quiet", "-p=.", source]
- procs += [subprocess.Popen(cmd, cwd="build")]
-
- for proc in procs:
- stdout, stderr = proc.communicate()
- st += proc.returncode
- else:
- Logs.warn("Not running clang-tidy")
-
- if st != 0:
- sys.exit(st)
-
-
-def dist(ctx):
- ctx.base_path = ctx.path
- ctx.excl = ctx.get_excl() + ' .gitmodules'