summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-07-14 15:38:57 -0400
committerDavid Robillard <d@drobilla.net>2022-08-13 18:17:34 -0400
commit03b1626676f596d78df9de718e3e079e8269f5cc (patch)
tree5a99193e9ba6f0b67620462c632fbd30b88b46ec
parent3ca0a8cf142d59bd0c76d141fa394ffacc6f9c12 (diff)
downloadganv-03b1626676f596d78df9de718e3e079e8269f5cc.tar.gz
ganv-03b1626676f596d78df9de718e3e079e8269f5cc.tar.bz2
ganv-03b1626676f596d78df9de718e3e079e8269f5cc.zip
Switch to meson build system
-rw-r--r--.gitignore8
-rw-r--r--.gitmodules3
-rw-r--r--NEWS6
-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.cpp1
-rwxr-xr-xwaf27
m---------waflib0
-rw-r--r--wscript309
12 files changed, 668 insertions, 344 deletions
diff --git a/.gitignore b/.gitignore
index 204c242..5d794a3 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: CC0-1.0 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/NEWS b/NEWS
index 7e1f1be..c64019a 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,9 @@
+ganv (1.8.1) unstable;
+
+ * Switch to meson build system
+
+ -- David Robillard <d@drobilla.net> Wed, 20 Jul 2022 20:39:48 +0000
+
ganv (1.8.0) stable;
* Expand canvas automatically to fit nodes
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..c5dc4a6
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,227 @@
+# Copyright 2021-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: CC0-1.0 OR GPL-3.0-or-later
+
+project('ganv', ['c', 'cpp'],
+ version: '1.8.1',
+ 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('.')
+
+c_headers = files(
+ 'ganv/box.h',
+ 'ganv/canvas.h',
+ 'ganv/circle.h',
+ 'ganv/edge.h',
+ 'ganv/ganv.h',
+ 'ganv/group.h',
+ 'ganv/item.h',
+ 'ganv/module.h',
+ 'ganv/node.h',
+ 'ganv/port.h',
+ 'ganv/text.h',
+ 'ganv/types.h',
+ 'ganv/widget.h',
+)
+
+cpp_headers = files(
+ 'ganv/Box.hpp',
+ 'ganv/Canvas.hpp',
+ 'ganv/Circle.hpp',
+ 'ganv/Edge.hpp',
+ 'ganv/Item.hpp',
+ 'ganv/Module.hpp',
+ 'ganv/Node.hpp',
+ 'ganv/Port.hpp',
+ 'ganv/ganv.hpp',
+ 'ganv/types.hpp',
+ '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..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..b6f449e
--- /dev/null
+++ b/meson/suppressions/meson.build
@@ -0,0 +1,137 @@
+# 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.
+
+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..85e6003
--- /dev/null
+++ b/meson/warnings/meson.build
@@ -0,0 +1,240 @@
+# 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 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 5c4b0f1..20d26fc 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>
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 e60ac0c..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.8.0'
-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')