summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.clang-tidy9
-rw-r--r--.gitignore8
-rw-r--r--.gitmodules3
-rw-r--r--INSTALL59
-rw-r--r--INSTALL.md76
-rw-r--r--NEWS22
-rw-r--r--include/ganv/Box.hpp (renamed from ganv/Box.hpp)0
-rw-r--r--include/ganv/Canvas.hpp (renamed from ganv/Canvas.hpp)0
-rw-r--r--include/ganv/Circle.hpp (renamed from ganv/Circle.hpp)0
-rw-r--r--include/ganv/Edge.hpp (renamed from ganv/Edge.hpp)0
-rw-r--r--include/ganv/Item.hpp (renamed from ganv/Item.hpp)0
-rw-r--r--include/ganv/Module.hpp (renamed from ganv/Module.hpp)0
-rw-r--r--include/ganv/Node.hpp (renamed from ganv/Node.hpp)0
-rw-r--r--include/ganv/Port.hpp (renamed from ganv/Port.hpp)0
-rw-r--r--include/ganv/box.h (renamed from ganv/box.h)0
-rw-r--r--include/ganv/canvas.h (renamed from ganv/canvas.h)16
-rw-r--r--include/ganv/circle.h (renamed from ganv/circle.h)0
-rw-r--r--include/ganv/edge.h (renamed from ganv/edge.h)0
-rw-r--r--include/ganv/ganv.h (renamed from ganv/ganv.h)0
-rw-r--r--include/ganv/ganv.hpp (renamed from ganv/ganv.hpp)0
-rw-r--r--include/ganv/group.h (renamed from ganv/group.h)0
-rw-r--r--include/ganv/item.h (renamed from ganv/item.h)0
-rw-r--r--include/ganv/module.h (renamed from ganv/module.h)0
-rw-r--r--include/ganv/node.h (renamed from ganv/node.h)0
-rw-r--r--include/ganv/port.h (renamed from ganv/port.h)0
-rw-r--r--include/ganv/text.h (renamed from ganv/text.h)0
-rw-r--r--include/ganv/types.h (renamed from ganv/types.h)0
-rw-r--r--include/ganv/types.hpp (renamed from ganv/types.hpp)0
-rw-r--r--include/ganv/widget.h (renamed from ganv/widget.h)0
-rw-r--r--include/ganv/wrap.hpp (renamed from ganv/wrap.hpp)0
-rw-r--r--meson.build227
-rw-r--r--meson/library/meson.build31
-rw-r--r--meson/suppressions/meson.build137
-rw-r--r--meson/warnings/meson.build240
-rw-r--r--meson_options.txt23
-rw-r--r--src/Canvas.cpp8
-rw-r--r--src/text.c1
-rwxr-xr-xwaf27
m---------waflib0
-rw-r--r--wscript309
40 files changed, 781 insertions, 415 deletions
diff --git a/.clang-tidy b/.clang-tidy
index 0ee948a..a226ceb 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -13,16 +13,18 @@ Checks: >
-*-use-auto,
-*-use-nullptr,
-*-vararg,
+ -altera-*,
-android-cloexec-fopen,
-bugprone-branch-clone,
+ -bugprone-easily-swappable-parameters,
-bugprone-incorrect-roundings,
-bugprone-integer-division,
-bugprone-macro-parentheses,
- -bugprone-macro-parentheses,
-bugprone-reserved-identifier,
-cert-dcl21-cpp,
-cert-dcl37-c,
-cert-dcl51-cpp,
+ -cert-err33-c,
-cert-err34-c,
-cert-msc30-c,
-cert-msc32-c,
@@ -31,10 +33,12 @@ Checks: >
-clang-analyzer-cplusplus.NewDeleteLeaks,
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
-clang-analyzer-unix.Malloc,
+ -concurrency-mt-unsafe,
-cppcoreguidelines-avoid-non-const-global-variables,
-cppcoreguidelines-macro-usage,
-cppcoreguidelines-non-private-member-variables-in-classes,
-cppcoreguidelines-owning-memory,
+ -cppcoreguidelines-prefer-member-initializer,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
-cppcoreguidelines-pro-type-const-cast,
@@ -59,9 +63,12 @@ Checks: >
-modernize-loop-convert,
-modernize-raw-string-literal,
-modernize-use-trailing-return-type,
+ -modernize-use-using,
-performance-faster-string-find,
-readability-const-return-type,
-readability-container-size-empty,
+ -readability-function-cognitive-complexity,
+ -readability-identifier-length,
-readability-implicit-bool-conversion,
-readability-inconsistent-declaration-parameter-name,
-readability-make-member-function-const,
diff --git a/.gitignore b/.gitignore
index 204c242..ca1b769 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,4 @@
-build/**
-.waf-*
-.lock-waf*
-__pycache__
+# Copyright 2020-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD OR ISC
+
+build/
diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644
index b2babe7..0000000
--- a/.gitmodules
+++ /dev/null
@@ -1,3 +0,0 @@
-[submodule "waflib"]
- path = waflib
- url = ../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..15c39f4
--- /dev/null
+++ b/INSTALL.md
@@ -0,0 +1,76 @@
+Installation Instructions
+=========================
+
+Prerequisites
+-------------
+
+To build from source, you will need:
+
+ * A relatively modern C and 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/"
+
+Note that some options, such as `strict` and `werror` are for
+developer/maintainer use only. Please don't file issues about anything that
+happens when they are enabled.
+
+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 908793a..a780163 100644
--- a/NEWS
+++ b/NEWS
@@ -1,11 +1,23 @@
-ganv (1.7.0) unstable;
+ganv (1.8.3) unstable; urgency=medium
+
+ * Update installation instructions
+
+ -- David Robillard <d@drobilla.net> Mon, 22 Aug 2022 14:59:07 +0000
+
+ganv (1.8.2) stable; urgency=medium
+
+ * Switch to meson build system
+
+ -- David Robillard <d@drobilla.net> Sat, 13 Aug 2022 22:12:49 +0000
+
+ganv (1.8.0) stable; urgency=medium
* Expand canvas automatically to fit nodes
* Fix various compiler warnings
- -- David Robillard <d@drobilla.net> Sun, 29 Nov 2020 10:51:22 +0000
+ -- David Robillard <d@drobilla.net> Thu, 07 Jan 2021 22:38:31 +0000
-ganv (1.6.0) stable;
+ganv (1.6.0) stable; urgency=medium
* Add API to specify module port order.
* Add support for PDF and PS export.
@@ -29,7 +41,7 @@ ganv (1.6.0) stable;
-- David Robillard <d@drobilla.net> Thu, 09 Apr 2020 11:45:01 +0000
-ganv (1.4.2) stable;
+ganv (1.4.2) stable; urgency=medium
* Fix bug where edges would not update when nodes are moved after the canvas
is cleared (fix stuck connections in Patchage after refresh).
@@ -37,7 +49,7 @@ ganv (1.4.2) stable;
-- David Robillard <d@drobilla.net> Fri, 08 Aug 2014 22:24:33 +0000
-ganv (1.4.0) stable;
+ganv (1.4.0) stable; urgency=medium
* Add Connection::set_curved()
* Add ability to select connections by their handles, either individually or
diff --git a/ganv/Box.hpp b/include/ganv/Box.hpp
index fe24622..fe24622 100644
--- a/ganv/Box.hpp
+++ b/include/ganv/Box.hpp
diff --git a/ganv/Canvas.hpp b/include/ganv/Canvas.hpp
index 350a6e7..350a6e7 100644
--- a/ganv/Canvas.hpp
+++ b/include/ganv/Canvas.hpp
diff --git a/ganv/Circle.hpp b/include/ganv/Circle.hpp
index b60b89d..b60b89d 100644
--- a/ganv/Circle.hpp
+++ b/include/ganv/Circle.hpp
diff --git a/ganv/Edge.hpp b/include/ganv/Edge.hpp
index a0d9a7c..a0d9a7c 100644
--- a/ganv/Edge.hpp
+++ b/include/ganv/Edge.hpp
diff --git a/ganv/Item.hpp b/include/ganv/Item.hpp
index e6b690c..e6b690c 100644
--- a/ganv/Item.hpp
+++ b/include/ganv/Item.hpp
diff --git a/ganv/Module.hpp b/include/ganv/Module.hpp
index 8beea60..8beea60 100644
--- a/ganv/Module.hpp
+++ b/include/ganv/Module.hpp
diff --git a/ganv/Node.hpp b/include/ganv/Node.hpp
index 7980566..7980566 100644
--- a/ganv/Node.hpp
+++ b/include/ganv/Node.hpp
diff --git a/ganv/Port.hpp b/include/ganv/Port.hpp
index c665b08..c665b08 100644
--- a/ganv/Port.hpp
+++ b/include/ganv/Port.hpp
diff --git a/ganv/box.h b/include/ganv/box.h
index 11e0662..11e0662 100644
--- a/ganv/box.h
+++ b/include/ganv/box.h
diff --git a/ganv/canvas.h b/include/ganv/canvas.h
index 089bb1d..ca50b21 100644
--- a/ganv/canvas.h
+++ b/include/ganv/canvas.h
@@ -92,7 +92,15 @@ typedef void (*GanvEdgeFunc)(GanvEdge* edge, void* data);
*/
typedef void (*GanvNodeFunc)(GanvNode* node, void* data);
-typedef int (*GanvPortOrderFunc)(const GanvPort*, const GanvPort*, void* data);
+/**
+ * GanvPortOrderFunc:
+ * @lhs: Left-hand port to compare.
+ * @rhs: Right-hand port to compare.
+ * @data: User callback data.
+ *
+ * A function to compare two ports.
+ */
+typedef int (*GanvPortOrderFunc)(const GanvPort* lhs, const GanvPort* rhs, void* data);
/**
* ganv_canvas_new:
@@ -621,9 +629,9 @@ ganv_canvas_move_contents_to(GanvCanvas* canvas, double x, double y);
/**
* ganv_canvas_set_port_order:
- * @canvas The canvas to set the default port order on.
- * @port_cmp Port comparison function.
- * @data Data to be passed to order.
+ * @canvas: The canvas to set the default port order on.
+ * @port_cmp: (scope call): Port comparison function.
+ * @data: Data to be passed to order.
*
* Set a comparator function to use as the default order for ports on modules.
* If left unset, ports are shown in the order they are added.
diff --git a/ganv/circle.h b/include/ganv/circle.h
index 23bfa2d..23bfa2d 100644
--- a/ganv/circle.h
+++ b/include/ganv/circle.h
diff --git a/ganv/edge.h b/include/ganv/edge.h
index 8bf8ad0..8bf8ad0 100644
--- a/ganv/edge.h
+++ b/include/ganv/edge.h
diff --git a/ganv/ganv.h b/include/ganv/ganv.h
index f86165f..f86165f 100644
--- a/ganv/ganv.h
+++ b/include/ganv/ganv.h
diff --git a/ganv/ganv.hpp b/include/ganv/ganv.hpp
index 3e3f259..3e3f259 100644
--- a/ganv/ganv.hpp
+++ b/include/ganv/ganv.hpp
diff --git a/ganv/group.h b/include/ganv/group.h
index 72efa3c..72efa3c 100644
--- a/ganv/group.h
+++ b/include/ganv/group.h
diff --git a/ganv/item.h b/include/ganv/item.h
index 2433574..2433574 100644
--- a/ganv/item.h
+++ b/include/ganv/item.h
diff --git a/ganv/module.h b/include/ganv/module.h
index 969965b..969965b 100644
--- a/ganv/module.h
+++ b/include/ganv/module.h
diff --git a/ganv/node.h b/include/ganv/node.h
index 03c5982..03c5982 100644
--- a/ganv/node.h
+++ b/include/ganv/node.h
diff --git a/ganv/port.h b/include/ganv/port.h
index 8bf4a80..8bf4a80 100644
--- a/ganv/port.h
+++ b/include/ganv/port.h
diff --git a/ganv/text.h b/include/ganv/text.h
index 2aee253..2aee253 100644
--- a/ganv/text.h
+++ b/include/ganv/text.h
diff --git a/ganv/types.h b/include/ganv/types.h
index 70c21ec..70c21ec 100644
--- a/ganv/types.h
+++ b/include/ganv/types.h
diff --git a/ganv/types.hpp b/include/ganv/types.hpp
index ba797ba..ba797ba 100644
--- a/ganv/types.hpp
+++ b/include/ganv/types.hpp
diff --git a/ganv/widget.h b/include/ganv/widget.h
index af31576..af31576 100644
--- a/ganv/widget.h
+++ b/include/ganv/widget.h
diff --git a/ganv/wrap.hpp b/include/ganv/wrap.hpp
index 8e0a421..8e0a421 100644
--- a/ganv/wrap.hpp
+++ b/include/ganv/wrap.hpp
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..2a88fed
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,227 @@
+# Copyright 2021-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD OR GPL-3.0-or-later
+
+project('ganv', ['c', 'cpp'],
+ version: '1.8.3',
+ license: 'GPLv3+',
+ meson_version: '>= 0.56.0',
+ default_options: [
+ 'b_ndebug=if-release',
+ 'buildtype=release',
+ 'c_std=c99',
+ 'cpp_std=c++11',
+ ])
+
+ganv_src_root = meson.current_source_dir()
+major_version = meson.project_version().split('.')[0]
+version_suffix = '-@0@'.format(major_version)
+versioned_name = 'ganv' + version_suffix
+
+#######################
+# Compilers and Flags #
+#######################
+
+# Required tools
+pkg = import('pkgconfig')
+gnome = import('gnome')
+cc = meson.get_compiler('c')
+cpp = meson.get_compiler('cpp')
+
+# Set global warning flags
+if get_option('strict') and not meson.is_subproject()
+ subdir('meson/warnings')
+endif
+
+# Set global warning suppressions
+subdir('meson/suppressions')
+add_project_arguments(c_suppressions, language: ['c'])
+if is_variable('cpp')
+ add_project_arguments(cpp_suppressions, language: ['cpp'])
+endif
+
+################
+# Dependencies #
+################
+
+m_dep = cc.find_library('m', required: false)
+
+intl_dep = cc.find_library('intl', required: get_option('nls'))
+
+gtk2_dep = dependency('gtk+-2.0',
+ version: '>= 2.10.0',
+ include_type: 'system')
+
+gtkmm2_dep = dependency('gtkmm-2.4',
+ version: '>= 2.10.0',
+ include_type: 'system')
+
+gvc_dep = dependency('libgvc',
+ include_type: 'system',
+ required: get_option('graphviz'))
+
+#################
+# Configuration #
+#################
+
+config_defines = []
+
+# Graphviz layout
+if gvc_dep.found()
+ config_defines += ['-DHAVE_AGRAPH']
+endif
+
+# Force-directed graph layout
+if not get_option('fdgl').disabled()
+ config_defines += ['-DGANV_FDGL']
+endif
+
+# Light theme
+if get_option('light')
+ config_defines += ['-DGANV_USE_LIGHT_THEME']
+endif
+
+# Native language support
+if not get_option('nls').disabled()
+ dgettext_code = '''#include <libintl.h>
+int main(void) { !!dgettext("ganv", "string"); }'''
+
+ config_defines += ['-DHAVE_DGETTEXT=@0@'.format(
+ cc.compiles(dgettext_code, name: 'dgettext').to_int())]
+endif
+
+add_project_arguments(config_defines, language: ['c', 'cpp'])
+
+###########
+# Library #
+###########
+
+include_dirs = include_directories('include')
+
+c_headers = files(
+ 'include/ganv/box.h',
+ 'include/ganv/canvas.h',
+ 'include/ganv/circle.h',
+ 'include/ganv/edge.h',
+ 'include/ganv/ganv.h',
+ 'include/ganv/group.h',
+ 'include/ganv/item.h',
+ 'include/ganv/module.h',
+ 'include/ganv/node.h',
+ 'include/ganv/port.h',
+ 'include/ganv/text.h',
+ 'include/ganv/types.h',
+ 'include/ganv/widget.h',
+)
+
+cpp_headers = files(
+ 'include/ganv/Box.hpp',
+ 'include/ganv/Canvas.hpp',
+ 'include/ganv/Circle.hpp',
+ 'include/ganv/Edge.hpp',
+ 'include/ganv/Item.hpp',
+ 'include/ganv/Module.hpp',
+ 'include/ganv/Node.hpp',
+ 'include/ganv/Port.hpp',
+ 'include/ganv/ganv.hpp',
+ 'include/ganv/types.hpp',
+ 'include/ganv/wrap.hpp',
+)
+
+sources = files(
+ 'src/Canvas.cpp',
+ 'src/Port.cpp',
+ 'src/box.c',
+ 'src/circle.c',
+ 'src/edge.c',
+ 'src/group.c',
+ 'src/item.c',
+ 'src/module.c',
+ 'src/node.c',
+ 'src/port.c',
+ 'src/text.c',
+ 'src/widget.c',
+)
+
+# Set appropriate arguments for building against the library type
+subdir('meson/library')
+extra_args = []
+if get_option('default_library') == 'static'
+ extra_args = ['-DGANV_STATIC']
+endif
+
+# Generate marshal files with glib-genmarshal
+ganv_marshal_sources = gnome.genmarshal(
+ 'ganv-marshal',
+ extra_args: ['--quiet'],
+ prefix: 'ganv_marshal',
+ sources: files('src/ganv-marshal.list'),
+)
+
+# Build shared and/or static library
+libganv = library(
+ meson.project_name() + library_suffix,
+ sources + ganv_marshal_sources,
+ c_args: c_suppressions + extra_args + ['-DGANV_INTERNAL'],
+ cpp_args: cpp_suppressions + extra_args + ['-DGANV_INTERNAL'],
+ dependencies: [gtk2_dep, gtkmm2_dep, gvc_dep, intl_dep, m_dep],
+ include_directories: include_dirs,
+ install: true,
+ version: meson.project_version(),
+)
+
+# Declare dependency for internal meson dependants
+ganv_dep = declare_dependency(
+ compile_args: extra_args,
+ include_directories: include_dirs,
+ link_with: libganv,
+)
+
+# Generage pkg-config file for external dependants
+ganv_pc = pkg.generate(
+ libganv,
+ description: 'Interactive Gtk canvas widget for graph-based interfaces',
+ extra_cflags: extra_args,
+ filebase: versioned_name,
+ name: 'Ganv',
+ subdirs: [versioned_name],
+ version: meson.project_version(),
+)
+
+# Install headers to a versioned include directory
+install_headers(c_headers + cpp_headers, subdir: versioned_name / 'ganv')
+
+# Generate GObject introspection data
+if not get_option('gir').disabled()
+ # TODO: With newer g-ir-scanner we could simply do
+ # ['--compiler=' + cpp.cmd_array()[0]]
+ g_ir_scanner_args = ['--quiet']
+ if target_machine.system() == 'darwin'
+ g_ir_scanner_args += ['-lc++']
+ elif target_machine.system() in ['gnu', 'linux']
+ g_ir_scanner_args += ['-lstdc++']
+ endif
+
+ gnome.generate_gir(
+ libganv,
+ dependencies: [ganv_dep],
+ extra_args: g_ir_scanner_args,
+ fatal_warnings: true,
+ header: 'ganv.h',
+ includes: ['GObject-2.0', 'Gdk-2.0', 'Gtk-2.0'],
+ install: true,
+ namespace: 'Ganv',
+ nsversion: '1.0',
+ sources: sources + c_headers + ganv_marshal_sources,
+ )
+endif
+
+if not meson.is_subproject()
+ summary('Tools', get_option('tools'), bool_yn: true)
+ summary('Install prefix', get_option('prefix'))
+ summary('Headers', get_option('prefix') / get_option('includedir'))
+ summary('Libraries', get_option('prefix') / get_option('libdir'))
+
+ if get_option('tools')
+ summary('Executables', get_option('prefix') / get_option('bindir'))
+ endif
+endif
diff --git a/meson/library/meson.build b/meson/library/meson.build
new file mode 100644
index 0000000..756a222
--- /dev/null
+++ b/meson/library/meson.build
@@ -0,0 +1,31 @@
+# Copyright 2020-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD 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..914eab9
--- /dev/null
+++ b/meson/suppressions/meson.build
@@ -0,0 +1,137 @@
+# Copyright 2020-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD 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.
+
+clang_common_suppressions = [
+ '-Wno-cast-function-type',
+ '-Wno-cast-qual',
+ '-Wno-covered-switch-default',
+ '-Wno-disabled-macro-expansion',
+ '-Wno-documentation-unknown-command',
+ '-Wno-double-promotion',
+ '-Wno-float-conversion',
+ '-Wno-float-equal',
+ '-Wno-implicit-fallthrough',
+ '-Wno-implicit-float-conversion',
+ '-Wno-padded',
+ '-Wno-reserved-id-macro',
+ '-Wno-reserved-identifier',
+ '-Wno-shadow',
+ '-Wno-shorten-64-to-32',
+ '-Wno-sign-conversion',
+ '-Wno-switch-enum',
+ '-Wno-unused-macros',
+ '-Wno-used-but-marked-unused',
+]
+
+gcc_common_suppressions = [
+ '-Wno-cast-function-type',
+ '-Wno-cast-qual',
+ '-Wno-conversion',
+ '-Wno-deprecated-declarations',
+ '-Wno-double-promotion',
+ '-Wno-float-conversion',
+ '-Wno-float-equal',
+ '-Wno-format',
+ '-Wno-implicit-fallthrough',
+ '-Wno-padded',
+ '-Wno-pedantic',
+ '-Wno-shadow',
+ '-Wno-sign-conversion',
+ '-Wno-suggest-attribute=const',
+ '-Wno-suggest-attribute=pure',
+ '-Wno-switch-default',
+ '-Wno-switch-enum',
+ '-Wno-unsuffixed-float-constants',
+ '-Wno-unused-macros',
+]
+
+#####
+# C #
+#####
+
+if is_variable('cc')
+ c_suppressions = []
+
+ if get_option('strict')
+ if cc.get_id() == 'clang'
+ c_suppressions += clang_common_suppressions + [
+ '-Wno-bad-function-cast',
+ '-Wno-declaration-after-statement',
+ '-Wno-documentation',
+ ]
+
+ if host_machine.system() == 'freebsd'
+ c_suppressions += [
+ '-Wno-c11-extensions',
+ ]
+ endif
+
+ elif cc.get_id() == 'gcc'
+ c_suppressions += gcc_common_suppressions + [
+ '-Wno-bad-function-cast',
+ '-Wno-c++-compat',
+ ]
+
+ elif cc.get_id() == 'msvc'
+ c_suppressions += [
+ '/wd4061', # enumerator in switch is not explicitly handled
+ '/wd4100', # unreferenced formal parameter
+ '/wd4191', # unsafe function conversion
+ '/wd4200', # zero-sized array in struct/union
+ '/wd4244', # possible loss of data from integer conversion
+ '/wd4267', # possible loss of data from size conversion
+ '/wd4365', # signed/unsigned mismatch
+ '/wd4514', # unreferenced inline function has been removed
+ '/wd4706', # assignment within conditional expression
+ '/wd4710', # function not inlined
+ '/wd4711', # function selected for automatic inline expansion
+ '/wd4800', # implicit conversion from int to bool
+ '/wd4820', # padding added after construct
+ '/wd4996', # POSIX name for this item is deprecated
+ '/wd5045', # compiler will insert Spectre mitigation
+ ]
+ 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 += clang_common_suppressions + [
+ '-Wno-exit-time-destructors',
+ '-Wno-global-constructors',
+ '-Wno-missing-noreturn',
+ '-Wno-old-style-cast',
+ '-Wno-weak-vtables',
+ '-Wno-zero-as-null-pointer-constant',
+ ]
+
+ elif cpp.get_id() == 'gcc'
+ cpp_suppressions += gcc_common_suppressions + [
+ '-Wno-effc++',
+ '-Wno-missing-noreturn',
+ '-Wno-null-dereference',
+ '-Wno-old-style-cast',
+ '-Wno-redundant-tags',
+ '-Wno-useless-cast',
+ '-Wno-zero-as-null-pointer-constant',
+ ]
+ endif
+ endif
+
+ cpp_suppressions = cpp.get_supported_arguments(cpp_suppressions)
+endif
diff --git a/meson/warnings/meson.build b/meson/warnings/meson.build
new file mode 100644
index 0000000..a6975df
--- /dev/null
+++ b/meson/warnings/meson.build
@@ -0,0 +1,240 @@
+# Copyright 2020-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD 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 warnings that apply to all C-family languages
+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') and not is_variable('all_c_warnings')
+ all_c_warnings = []
+
+ if cc.get_id() == 'clang'
+ all_c_warnings += ['-Weverything']
+
+ if not meson.is_cross_build()
+ all_c_warnings += [
+ '-Wno-poison-system-directories',
+ ]
+ endif
+
+ 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'
+ ]
+
+ if not meson.is_cross_build()
+ all_cpp_warnings += [
+ '-Wno-poison-system-directories',
+ ]
+ endif
+
+ 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
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..79c1de1
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,23 @@
+option('fdgl', type: 'feature', value: 'auto', yield: true,
+ description: 'Build with force-directed graph layout support')
+
+option('gir', type: 'feature', value: 'auto', yield: true,
+ description: 'Build GObject introspection data')
+
+option('graphviz', type: 'feature', value: 'auto', yield: true,
+ description: 'Build with graphviz-based layout support')
+
+option('light', type: 'boolean', value: 'false', yield: true,
+ description: 'Use light-coloured theme')
+
+option('nls', type: 'feature', value: 'auto', yield: true,
+ description: 'Build with native language support')
+
+option('strict', type: 'boolean', value: false, yield: true,
+ description: 'Enable ultra-strict warnings')
+
+option('title', type: 'string', value: 'Ganv',
+ description: 'Project title')
+
+option('tools', type: 'boolean', value: true, yield: true,
+ description: 'Build command line utilities')
diff --git a/src/Canvas.cpp b/src/Canvas.cpp
index 1219950..bc6ed00 100644
--- a/src/Canvas.cpp
+++ b/src/Canvas.cpp
@@ -40,7 +40,6 @@
#include "ganv/node.h"
#include "ganv/port.h"
#include "ganv/types.h"
-#include "ganv_config.h"
#include <cairo-pdf.h>
#include <cairo-ps.h>
@@ -89,9 +88,9 @@
# define _BLD_cdt 0
# define _PACKAGE_ast 0
# include <arith.h>
+# include <cgraph.h>
# include <gvc.h>
# include <gvcext.h>
-# include <types.h>
#endif
#ifdef GANV_FDGL
# include "./fdgl.hpp"
@@ -2662,6 +2661,8 @@ ganv_canvas_arrange(GanvCanvas* canvas)
const double y = GANV_ITEM(*i)->impl->y;
g_signal_emit(*i, signal_moved, 0, x, y, NULL);
}
+#else
+ (void)canvas;
#endif
}
@@ -2739,6 +2740,9 @@ ganv_canvas_export_dot(GanvCanvas* canvas, const char* filename)
#ifdef HAVE_AGRAPH
GVNodes nodes = canvas->impl->layout_dot(filename);
nodes.cleanup();
+#else
+ (void)canvas;
+ (void)filename;
#endif
}
diff --git a/src/text.c b/src/text.c
index 7e5a565..d429967 100644
--- a/src/text.c
+++ b/src/text.c
@@ -29,7 +29,6 @@
#include <glib.h>
#include <gtk/gtk.h>
#include <pango/pango-font.h>
-#include <pango/pango-fontmap.h>
#include <pango/pango-layout.h>
#include <pango/pango-types.h>
#include <pango/pangocairo.h>
diff --git a/waf b/waf
deleted file mode 100755
index 58d14c3..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(os.path.realpath(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 b600c928b221a001faeab7bd92786d0b25714bc
diff --git a/wscript b/wscript
deleted file mode 100644
index 139d439..0000000
--- a/wscript
+++ /dev/null
@@ -1,309 +0,0 @@
-#!/usr/bin/env python
-
-import os
-
-from waflib import Options, Utils
-from waflib.extras import autowaf
-
-# Library and package version (UNIX style major, minor, micro)
-# major increment <=> incompatible changes
-# minor increment <=> compatible changes (additions)
-# micro increment <=> no interface changes
-GANV_VERSION = '1.7.1'
-GANV_MAJOR_VERSION = '1'
-
-# Mandatory waf variables
-APPNAME = 'ganv' # Package name for waf dist
-VERSION = GANV_VERSION # Package version for waf dist
-top = '.' # Source directory
-out = 'build' # Build directory
-
-# Release variables
-uri = 'http://drobilla.net/sw/ganv'
-dist_pattern = 'http://download.drobilla.net/ganv-%d.%d.%d.tar.bz2'
-post_tags = ['Hacking', 'LAD', 'Ganv']
-
-
-def options(ctx):
- ctx.load('compiler_c')
- ctx.load('compiler_cxx')
- ctx.add_flags(
- ctx.configuration_options(),
- {'no-graphviz': 'do not compile with graphviz support',
- 'light-theme': 'use light coloured theme',
- 'no-fdgl': 'use experimental force-directed graph layout',
- 'no-nls': 'disable i18n (native language support)',
- 'gir': 'build GObject introspection data'})
-
-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')
-
- if Options.options.ultra_strict:
- autowaf.add_compiler_flags(conf.env, 'c', {
- 'clang': [
- '-Wno-bad-function-cast',
- '-Wno-documentation',
- ],
- 'gcc': [
- '-Wno-bad-function-cast',
- ]
- })
-
- autowaf.add_compiler_flags(conf.env, 'cxx', {
- 'clang': [
- '-Wno-exit-time-destructors',
- '-Wno-global-constructors',
- '-Wno-missing-noreturn',
- '-Wno-old-style-cast',
- '-Wno-weak-vtables',
- '-Wno-zero-as-null-pointer-constant',
- ],
- 'gcc': [
- '-Wno-effc++',
- '-Wno-missing-noreturn',
- '-Wno-old-style-cast',
- '-Wno-useless-cast',
- '-Wno-zero-as-null-pointer-constant',
- ]
- })
-
- autowaf.add_compiler_flags(conf.env, '*', {
- 'clang': [
- '-Wno-cast-qual',
- '-Wno-covered-switch-default',
- '-Wno-disabled-macro-expansion',
- '-Wno-documentation-unknown-command',
- '-Wno-double-promotion',
- '-Wno-float-conversion',
- '-Wno-float-equal',
- '-Wno-implicit-fallthrough',
- '-Wno-implicit-float-conversion',
- '-Wno-padded',
- '-Wno-reserved-id-macro',
- '-Wno-shadow',
- '-Wno-shorten-64-to-32',
- '-Wno-sign-conversion',
- '-Wno-switch-enum',
- '-Wno-unused-macros',
- '-Wno-used-but-marked-unused',
- ],
- 'gcc': [
- '-Wno-cast-function-type',
- '-Wno-cast-qual',
- '-Wno-conversion',
- '-Wno-deprecated-declarations',
- '-Wno-double-promotion',
- '-Wno-float-conversion',
- '-Wno-float-equal',
- '-Wno-format',
- '-Wno-implicit-fallthrough',
- '-Wno-padded',
- '-Wno-pedantic',
- '-Wno-shadow',
- '-Wno-sign-conversion',
- '-Wno-switch-enum',
- '-Wno-unused-macros',
- ],
- })
-
- conf.check_pkg('gtk+-2.0', uselib_store='GTK', system=True)
- conf.check_pkg('gtkmm-2.4 >= 2.10.0', uselib_store='GTKMM', system=True)
-
- if Options.options.gir:
- conf.check_pkg('gobject-introspection-1.0',
- uselib_store='GIR',
- system=True,
- mandatory=False)
- conf.find_program('g-ir-doc-tool', var='G_IR_DOC_TOOL', mandatory=False)
- conf.find_program('yelp-build', var='YELP_BUILD', mandatory=False)
-
- if not Options.options.no_graphviz:
- conf.check_pkg('libgvc',
- uselib_store='AGRAPH',
- system=True,
- mandatory=False)
- if conf.env.HAVE_AGRAPH:
- conf.define('HAVE_AGRAPH', 1)
-
- if not Options.options.no_fdgl:
- conf.define('GANV_FDGL', 1)
-
- if Options.options.light_theme:
- conf.define('GANV_USE_LIGHT_THEME', 1)
-
- if not Options.options.no_nls:
- conf.check_function('cxx', 'dgettext',
- header_name = 'libintl.h',
- lib = 'intl',
- define_name = 'ENABLE_NLS',
- return_type = 'char*',
- arg_types = 'const char*,const char*',
- mandatory = False)
-
- autowaf.set_lib_env(conf, 'ganv', GANV_VERSION)
- conf.write_config_header('ganv_config.h', remove=False)
-
- autowaf.display_summary(
- conf,
- {'Static (Graphviz) arrange': bool(conf.env.HAVE_AGRAPH),
- 'Interactive force-directed arrange': conf.is_defined('GANV_FDGL'),
- 'Native language support': bool(conf.env.ENABLE_NLS),
- 'GObject introspection': bool(conf.env.HAVE_GIR),
- 'Unit tests': bool(conf.env.BUILD_TESTS)})
-
-ganv_source = [
- 'src/Canvas.cpp',
- 'src/Port.cpp',
- 'src/box.c',
- 'src/circle.c',
- 'src/edge.c',
- 'src/ganv-marshal.c',
- 'src/group.c',
- 'src/item.c',
- 'src/module.c',
- 'src/node.c',
- 'src/port.c',
- 'src/text.c',
- 'src/widget.c'
-]
-
-def declare_doc_files(task):
- bld = task.generator.bld
- path = bld.path.get_bld().find_or_declare('doc-html')
- for i in path.ant_glob('*', remove=False):
- i.sig = Utils.h_file(i.abspath())
-
-def build(bld):
- # Headers
- includedir = '${INCLUDEDIR}/ganv-%s/ganv' % GANV_MAJOR_VERSION
- bld.install_files(includedir, bld.path.ant_glob('ganv/*.h*'))
-
- # Pkgconfig file
- autowaf.build_pc(bld, 'GANV', GANV_VERSION, GANV_MAJOR_VERSION,
- 'GTK GTKMM AGRAPH',
- {'GANV_MAJOR_VERSION' : GANV_MAJOR_VERSION})
-
- bld(rule = 'glib-genmarshal --prefix=ganv_marshal --header ${SRC} > ${TGT}',
- source = 'src/ganv-marshal.list',
- target = 'src/ganv-marshal.h')
-
- bld(rule = 'glib-genmarshal --prefix=ganv_marshal --body ${SRC} > ${TGT}',
- source = 'src/ganv-marshal.list',
- target = 'src/ganv-marshal.c.in')
-
- bld(rule = 'cat ${SRC} > ${TGT}',
- source = ['src/ganv-marshal.h', 'src/ganv-marshal.c.in'],
- target = 'src/ganv-marshal.c')
-
- # Library
- lib = bld(features = 'c cshlib cxx cxxshlib',
- export_includes = ['.'],
- source = ganv_source,
- includes = ['.', './src'],
- name = 'libganv',
- target = 'ganv-%s' % GANV_MAJOR_VERSION,
- uselib = 'GTK GTKMM AGRAPH',
- vnum = GANV_VERSION,
- install_path = '${LIBDIR}')
- if bld.is_defined('ENABLE_NLS'):
- lib.lib = ['intl']
-
- # Benchmark program (C++)
- bld(features = 'cxx cxxprogram',
- source = 'src/ganv_bench.cpp',
- includes = ['.', './src'],
- use = 'libganv',
- uselib = 'GTK GTKMM AGRAPH',
- target = 'src/ganv_bench')
-
- if bld.env.BUILD_TESTS:
- test_libs = []
- test_cflags = ['']
- test_linkflags = ['']
- if not bld.env.NO_COVERAGE:
- test_cflags += ['--coverage']
- test_linkflags += ['--coverage']
-
- # Static library for test program
- bld(features = 'c cstlib cxx cxxshlib',
- source = ganv_source,
- includes = ['.', './src'],
- name = 'libganv_profiled',
- target = 'ganv_profiled',
- uselib = 'GTK GTKMM AGRAPH',
- install_path = '',
- cflags = test_cflags,
- linkflags = test_linkflags)
-
- # Test program (C)
- bld(features = 'cxx cxxprogram',
- source = 'src/ganv_test.c',
- includes = ['.', './src'],
- use = 'libganv_profiled',
- lib = test_libs,
- uselib = 'GTK GTKMM AGRAPH',
- target = 'src/ganv_test',
- cflags = test_cflags,
- linkflags = test_linkflags)
-
- # Documentation
- #autowaf.build_dox(bld, 'GANV', GANV_VERSION, top, out)
-
- if bld.env.HAVE_GIR:
- bld.add_group()
-
- bld_dir = os.path.join(out, APPNAME)
- if not (len(bld.stack_path) > 1): # not top-level
- bld_dir = out
-
- pc_path = os.path.abspath(os.path.join(bld_dir, 'ganv-1.pc'))
-
- bld(name = 'ganv-gir',
- source = ganv_source + bld.path.ant_glob('ganv/*.h'),
- target = 'Ganv-1.0.gir',
- install_path = '${LIBDIR}/girepository-1.0',
- rule = 'g-ir-scanner --warn-all -n Ganv --nsversion=1.0'
- ' --no-libtool ' +
- ('--pkg=%s' % pc_path) +
- (' -I%s' % bld.path.bldpath()) +
- ''.join([' -I' + path for path in bld.env.INCLUDES_GTK]) +
- (' -L%s' % bld_dir) +
- ' --library=ganv-1'
- ' --include=GObject-2.0 --include=Gdk-2.0 --include Gtk-2.0'
- ' -o ${TGT} ${SRC}')
-
- bld(name = 'ganv-typelib',
- after = 'ganv-gir',
- source = 'Ganv-1.0.gir',
- target = 'Ganv-1.0.typelib',
- install_path = '${LIBDIR}/girepository-1.0',
- rule = 'g-ir-compiler ${SRC} -o ${TGT}')
-
- if bld.env.DOCS and bld.env['G_IR_DOC_TOOL'] and bld.env['YELP_BUILD']:
- # The source and target files used here aren't exclusive,
- # but are declared so waf can track dependencies
- bld(rule = '${G_IR_DOC_TOOL} --language C -o doc-xml ${SRC}',
- source = 'Ganv-1.0.gir',
- target = 'doc-xml/index.page')
- bld(name = 'yelp-build',
- rule = '${YELP_BUILD} html -o doc-html doc-xml',
- source = 'doc-xml/index.page',
- target = 'doc-html/index.html')
- bld(name = 'find-docs',
- always = True,
- rule = declare_doc_files,
- after = 'yelp-build')
-
- bld.install_files(
- os.path.join('${DOCDIR}', 'ganv-0', 'html'),
- bld.path.get_bld().ant_glob('doc-html/*'))
-
- bld.add_post_fun(autowaf.run_ldconfig)
-
-def i18n(bld):
- autowaf.build_i18n(bld, '..', 'ganv', APPNAME, ganv_source,
- 'David Robillard')