diff options
author | David Robillard <d@drobilla.net> | 2022-08-18 00:04:37 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-08-18 01:04:36 -0400 |
commit | 6bce9e50915d730caa3bd2b60c513fe9915e4b83 (patch) | |
tree | 84ae681b9747ea809ea686dcd0a3ad889beb0d2f /src | |
parent | 5bec7b8de6378bc6cdac5521493a437725048330 (diff) | |
download | ingen-6bce9e50915d730caa3bd2b60c513fe9915e4b83.tar.gz ingen-6bce9e50915d730caa3bd2b60c513fe9915e4b83.tar.bz2 ingen-6bce9e50915d730caa3bd2b60c513fe9915e4b83.zip |
Switch to meson build system
Diffstat (limited to 'src')
-rw-r--r-- | src/ColorContext.cpp | 2 | ||||
-rw-r--r-- | src/FilePath.cpp | 10 | ||||
-rw-r--r-- | src/client/meson.build | 50 | ||||
-rw-r--r-- | src/client/wscript | 24 | ||||
-rw-r--r-- | src/gui/GraphBox.cpp | 7 | ||||
-rw-r--r-- | src/gui/MessagesWindow.cpp | 3 | ||||
-rw-r--r-- | src/gui/NodeModule.cpp | 3 | ||||
-rw-r--r-- | src/gui/Port.cpp | 3 | ||||
-rw-r--r-- | src/gui/WindowFactory.cpp | 4 | ||||
-rw-r--r-- | src/gui/ingen_gui.ui.in (renamed from src/gui/ingen_gui.ui) | 0 | ||||
-rw-r--r-- | src/gui/meson.build | 163 | ||||
-rw-r--r-- | src/gui/wscript | 127 | ||||
-rw-r--r-- | src/include/ingen_config.h | 216 | ||||
-rw-r--r-- | src/ingen/ingen.cpp | 4 | ||||
-rw-r--r-- | src/meson.build | 65 | ||||
-rw-r--r-- | src/runtime_paths.cpp | 6 | ||||
-rw-r--r-- | src/server/Buffer.cpp | 3 | ||||
-rw-r--r-- | src/server/Engine.cpp | 4 | ||||
-rw-r--r-- | src/server/JackDriver.cpp | 8 | ||||
-rw-r--r-- | src/server/meson.build | 135 | ||||
-rw-r--r-- | src/server/wscript | 106 | ||||
-rw-r--r-- | src/wscript | 47 |
22 files changed, 661 insertions, 329 deletions
diff --git a/src/ColorContext.cpp b/src/ColorContext.cpp index ac797518..827395f2 100644 --- a/src/ColorContext.cpp +++ b/src/ColorContext.cpp @@ -17,7 +17,7 @@ #include "ingen/ColorContext.hpp" #include "ingen_config.h" -#ifdef HAVE_ISATTY +#if USE_ISATTY # include <unistd.h> #else inline int isatty(int fd) { return 0; } diff --git a/src/FilePath.cpp b/src/FilePath.cpp index d16c133c..f8da196e 100644 --- a/src/FilePath.cpp +++ b/src/FilePath.cpp @@ -26,7 +26,7 @@ template <typename Char> static bool is_sep(const Char chr) { -#ifdef USE_WINDOWS_FILE_PATHS +#if USE_WINDOWS_FILE_PATHS return chr == L'/' || chr == preferred_separator; #else return chr == '/'; @@ -98,7 +98,7 @@ FilePath::operator+=(boost::basic_string_view<value_type> sv) FilePath FilePath::root_name() { -#ifdef USE_WINDOWS_FILE_PATHS +#if USE_WINDOWS_FILE_PATHS if (_str.length() >= 2 && _str[0] >= 'A' && _str[0] <= 'Z' && _str[1] == ':') { return FilePath(_str.substr(0, 2)); @@ -111,7 +111,7 @@ FilePath::root_name() FilePath FilePath::root_directory() const { -#ifdef USE_WINDOWS_FILE_PATHS +#if USE_WINDOWS_FILE_PATHS const auto name = root_name().string(); return name.empty() ? Path() : Path(name + preferred_separator); #endif @@ -122,7 +122,7 @@ FilePath::root_directory() const FilePath FilePath::root_path() const { -#ifdef USE_WINDOWS_FILE_PATHS +#if USE_WINDOWS_FILE_PATHS const auto name = root_name(); return name.empty() ? FilePath() : name / root_directory(); #endif @@ -180,7 +180,7 @@ FilePath::extension() const bool FilePath::is_absolute() const { -#ifdef USE_WINDOWS_FILE_PATHS +#if USE_WINDOWS_FILE_PATHS return !root_name().empty(); #else return !root_directory().empty(); diff --git a/src/client/meson.build b/src/client/meson.build new file mode 100644 index 00000000..b77211d2 --- /dev/null +++ b/src/client/meson.build @@ -0,0 +1,50 @@ +# Copyright 2022 David Robillard <d@drobilla.net> +# SPDX-License-Identifier: CC0-1.0 OR GPL-3.0-or-later + +################ +# Dependencies # +################ + +sigcpp_dep = dependency('sigc++-2.0', include_type: 'system') + +########## +# Module # +########## + +client_sources = files( + 'BlockModel.cpp', + 'ClientStore.cpp', + 'GraphModel.cpp', + 'ObjectModel.cpp', + 'PluginModel.cpp', + 'PluginUI.cpp', + 'PortModel.cpp', + 'ingen_client.cpp', +) + +client_dependencies = [ + boost_dep, + ingen_dep, + lilv_dep, + lv2_dep, + raul_dep, + sigcpp_dep, + suil_dep, +] + +libingen_client = shared_library( + 'ingen_client', + client_sources, + cpp_args: cpp_suppressions + platform_defines + ['-DINGEN_CLIENT_INTERNAL'], + dependencies: client_dependencies, + gnu_symbol_visibility: 'hidden', + implicit_include_directories: false, + include_directories: ingen_include_dirs, + install: true, + install_dir: ingen_module_dir, +) + +ingen_client_dep = declare_dependency( + dependencies: client_dependencies, + link_with: libingen_client, +) diff --git a/src/client/wscript b/src/client/wscript deleted file mode 100644 index d63fb56c..00000000 --- a/src/client/wscript +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env python - - -def build(bld): - obj = bld(features = 'cxx cxxshlib', - cflags = ['-fvisibility=hidden'], - includes = ['../../', '../../include'], - export_includes = ['../../include'], - name = 'libingen_client', - target = 'ingen_client', - install_path = '${LIBDIR}', - use = 'libingen', - uselib = 'GLIBMM LV2 LILV SUIL RAUL SERD SORD SIGCPP') - - obj.source = ''' - BlockModel.cpp - ClientStore.cpp - GraphModel.cpp - ObjectModel.cpp - PluginModel.cpp - PluginUI.cpp - PortModel.cpp - ingen_client.cpp - ''' diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp index f994d47c..ee3013b1 100644 --- a/src/gui/GraphBox.cpp +++ b/src/gui/GraphBox.cpp @@ -27,6 +27,7 @@ #include "ThreadedLoader.hpp" #include "WidgetFactory.hpp" #include "WindowFactory.hpp" +#include "ingen_config.h" #include "ganv/canvas.h" #include "ingen/Atom.hpp" @@ -87,8 +88,8 @@ #include <sigc++/functors/mem_fun.h> #include <sigc++/signal.h> -#ifdef HAVE_WEBKIT -#include <webkit/webkit.h> +#if USE_WEBKIT +# include <webkit/webkit.h> #endif #include <cassert> @@ -449,7 +450,7 @@ GraphBox::set_documentation(const std::string& doc, bool html) _doc_scrolledwindow->hide(); return; } -#ifdef HAVE_WEBKIT +#if USE_WEBKIT WebKitWebView* view = WEBKIT_WEB_VIEW(webkit_web_view_new()); webkit_web_view_load_html_string(view, doc.c_str(), ""); Gtk::Widget* widget = Gtk::manage(Glib::wrap(GTK_WIDGET(view))); diff --git a/src/gui/MessagesWindow.cpp b/src/gui/MessagesWindow.cpp index 2e0fdb61..9127ad61 100644 --- a/src/gui/MessagesWindow.cpp +++ b/src/gui/MessagesWindow.cpp @@ -18,6 +18,7 @@ #include "App.hpp" #include "Window.hpp" +#include "ingen_config.h" #include "ingen/URIs.hpp" #include "lv2/urid/urid.h" @@ -102,7 +103,7 @@ MessagesWindow::log(LV2_URID type, const char* fmt, va_list args) { std::lock_guard<std::mutex> lock(_mutex); -#ifdef HAVE_VASPRINTF +#if USE_VASPRINTF char* buf = nullptr; const int len = vasprintf(&buf, fmt, args); #else diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp index fe111572..1dbd1cd9 100644 --- a/src/gui/NodeModule.cpp +++ b/src/gui/NodeModule.cpp @@ -25,6 +25,7 @@ #include "SubgraphModule.hpp" #include "WidgetFactory.hpp" #include "WindowFactory.hpp" +#include "ingen_config.h" #include "ganv/Port.hpp" #include "ingen/Atom.hpp" @@ -531,7 +532,7 @@ NodeModule::on_selected(gboolean selected) if (selected && win->documentation_is_visible()) { std::string doc; bool html = false; -#ifdef HAVE_WEBKIT +#if USE_WEBKIT html = true; #endif if (block()->plugin_model()) { diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp index 65b415e3..87cb3ef1 100644 --- a/src/gui/Port.cpp +++ b/src/gui/Port.cpp @@ -24,6 +24,7 @@ #include "Style.hpp" #include "WidgetFactory.hpp" #include "WindowFactory.hpp" +#include "ingen_config.h" #include "rgba.hpp" #include "ingen/Atom.hpp" @@ -551,7 +552,7 @@ Port::on_selected(gboolean b) GraphWindow* win = _app.window_factory()->parent_graph_window(block); if (win && win->documentation_is_visible() && block->plugin_model()) { bool html = false; -#ifdef HAVE_WEBKIT +#if USE_WEBKIT html = true; #endif const std::string& doc = block->plugin_model()->port_documentation( diff --git a/src/gui/WindowFactory.cpp b/src/gui/WindowFactory.cpp index 153fb4f6..ae396b61 100644 --- a/src/gui/WindowFactory.cpp +++ b/src/gui/WindowFactory.cpp @@ -14,8 +14,11 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ +#include "WindowFactory.hpp" + #include "App.hpp" #include "GraphBox.hpp" +#include "GraphView.hpp" #include "GraphWindow.hpp" #include "LoadGraphWindow.hpp" #include "LoadPluginWindow.hpp" @@ -23,7 +26,6 @@ #include "PropertiesWindow.hpp" #include "RenameWindow.hpp" #include "WidgetFactory.hpp" -#include "WindowFactory.hpp" #include "ingen/Log.hpp" #include "ingen/client/BlockModel.hpp" diff --git a/src/gui/ingen_gui.ui b/src/gui/ingen_gui.ui.in index 9e751064..9e751064 100644 --- a/src/gui/ingen_gui.ui +++ b/src/gui/ingen_gui.ui.in diff --git a/src/gui/meson.build b/src/gui/meson.build new file mode 100644 index 00000000..64192b28 --- /dev/null +++ b/src/gui/meson.build @@ -0,0 +1,163 @@ +# Copyright 2022 David Robillard <d@drobilla.net> +# SPDX-License-Identifier: CC0-1.0 OR GPL-3.0-or-later + +################ +# Dependencies # +################ + +gui_defines = platform_defines + +glibmm_dep = dependency('glibmm-2.4', + version: '>= 2.14.0', + include_type: 'system', + required: get_option('gui')) + +gthread_dep = dependency('gthread-2.0', + version: '>= 2.14.0', + include_type: 'system', + required: get_option('gui')) + +gtkmm_dep = dependency('gtkmm-2.4', + version: '>= 2.14.0', + include_type: 'system', + required: get_option('gui')) + +ganv_dep = dependency('ganv-1', + version: '>= 1.5.2', + fallback: ['ganv', 'ganv_dep'], + required: get_option('gui')) + +webkit_dep = dependency('webkit-1.0', + version: '>= 1.4.0', + include_type: 'system', + required: false) + +build_gui = (glibmm_dep.found() and + gthread_dep.found() and + gtkmm_dep.found() and + ganv_dep.found()) + +if webkit_dep.found() + gui_defines += ['-DHAVE_WEBKIT=1'] +else + gui_defines += ['-DHAVE_WEBKIT=0'] +endif + +########## +# Module # +########## + +if build_gui + gui_sources = files( + 'App.cpp', + 'Arc.cpp', + 'BreadCrumbs.cpp', + 'ConnectWindow.cpp', + 'GraphBox.cpp', + 'GraphCanvas.cpp', + 'GraphPortModule.cpp', + 'GraphTreeWindow.cpp', + 'GraphView.cpp', + 'GraphWindow.cpp', + 'LoadGraphWindow.cpp', + 'LoadPluginWindow.cpp', + 'MessagesWindow.cpp', + 'NewSubgraphWindow.cpp', + 'NodeMenu.cpp', + 'NodeModule.cpp', + 'ObjectMenu.cpp', + 'PluginMenu.cpp', + 'Port.cpp', + 'PortMenu.cpp', + 'PropertiesWindow.cpp', + 'RDFS.cpp', + 'RenameWindow.cpp', + 'Style.cpp', + 'SubgraphModule.cpp', + 'ThreadedLoader.cpp', + 'URIEntry.cpp', + 'WidgetFactory.cpp', + 'WindowFactory.cpp', + 'ingen_gui.cpp', + ) + + gui_dependencies = [ + boost_dep, + ganv_dep, + glibmm_dep, + gthread_dep, + gtkmm_dep, + ingen_client_dep, + ingen_dep, + lilv_dep, + raul_dep, + sigcpp_dep, + suil_dep, + thread_dep, + webkit_dep, + ] + + gui_suppressions = [] + if cpp.get_id() == 'clang' + gui_suppressions += [ + '-Wno-reserved-identifier', # Ganv + ] + endif + + gui_suppressions = cpp.get_supported_arguments(gui_suppressions) + gui_suppressions += cpp_suppressions + + gui_args = gui_suppressions + gui_defines + ['-DINGEN_GUI_INTERNAL'] + + libingen_gui = shared_library( + 'ingen_gui', + gui_sources, + cpp_args: gui_args, + dependencies: gui_dependencies, + gnu_symbol_visibility: 'hidden', + implicit_include_directories: false, + include_directories: ingen_include_dirs, + install: true, + install_dir: ingen_module_dir, + ) + + ingen_gui_dep = declare_dependency( + dependencies: gui_dependencies, + link_with: libingen_gui, + ) + + ########## + # LV2 UI # + ########## + + ingen_gui_lv2 = shared_library( + 'ingen_gui_lv2', + files('ingen_gui_lv2.cpp'), + cpp_args: gui_args, + dependencies: [ingen_gui_dep], + gnu_symbol_visibility: 'hidden', + implicit_include_directories: false, + include_directories: ingen_include_dirs, + install: true, + install_dir: lv2dir / 'ingen.lv2', + ) + + ############### + # Shared Data # + ############### + + config = configuration_data() + config.set('INGEN_VERSION', meson.project_version()) + + configure_file(configuration: config, + input: files('ingen_gui.ui.in'), + output: 'ingen_gui.ui', + install: true, + install_dir: ingen_data_dir) + + configure_file(copy: true, + input: files('ingen_style.rc'), + output: '@PLAINNAME@', + install: true, + install_dir: ingen_data_dir) +endif diff --git a/src/gui/wscript b/src/gui/wscript deleted file mode 100644 index f2471933..00000000 --- a/src/gui/wscript +++ /dev/null @@ -1,127 +0,0 @@ -#!/usr/bin/env python - -import waflib.Utils as Utils -import waflib.Options as Options - - -def options(ctx): - opt = ctx.configuration_options() - opt.add_option('--light-theme', action='store_true', dest='light_theme', - help='use light coloured theme') - - -def configure(conf): - conf.check_pkg('glibmm-2.4 >= 2.14.0', - uselib_store='GLIBMM', - system=True, - mandatory=False) - conf.check_pkg('gthread-2.0 >= 2.14.0', - uselib_store='GTHREAD', - system=True, - mandatory=False) - conf.check_pkg('gtkmm-2.4 >= 2.14.0', - uselib_store='GTKMM', - system=True, - mandatory=False) - conf.check_pkg('ganv-1 >= 1.5.4', - uselib_store='GANV', - mandatory=False) - if not Options.options.no_webkit: - conf.check_pkg('webkit-1.0 >= 1.4.0', - uselib_store='WEBKIT', - system=True, - mandatory=False) - - if conf.env.HAVE_GANV and conf.env.HAVE_GTKMM: - conf.env.INGEN_BUILD_GUI = 1 - - if Options.options.light_theme: - conf.define('INGEN_USE_LIGHT_THEME', 1) - - -def build(bld): - obj = bld(features = 'cxx cxxshlib', - cflags = ['-fvisibility=hidden'], - export_includes = ['../../include'], - includes = ['../../', '../../include'], - name = 'libingen_gui', - target = 'ingen_gui', - install_path = '${LIBDIR}', - use = 'libingen libingen_client', - uselib = ''' - GANV - GLADEMM - GLIBMM - GNOMECANVAS - GTKMM - LILV - LV2 - RAUL - SIGCPP - SERD - SORD - SRATOM - SOUP - SUIL - WEBKIT - ''') - - obj.source = ''' - App.cpp - Arc.cpp - BreadCrumbs.cpp - ConnectWindow.cpp - GraphBox.cpp - GraphCanvas.cpp - GraphPortModule.cpp - GraphTreeWindow.cpp - GraphView.cpp - GraphWindow.cpp - LoadGraphWindow.cpp - LoadPluginWindow.cpp - MessagesWindow.cpp - NewSubgraphWindow.cpp - NodeMenu.cpp - NodeModule.cpp - ObjectMenu.cpp - PluginMenu.cpp - Port.cpp - PortMenu.cpp - PropertiesWindow.cpp - RDFS.cpp - RenameWindow.cpp - Style.cpp - SubgraphModule.cpp - ThreadedLoader.cpp - URIEntry.cpp - WidgetFactory.cpp - WindowFactory.cpp - ingen_gui.cpp - ''' - - # XML UI definition - bld(features = 'subst', - source = 'ingen_gui.ui', - target = '../../ingen_gui.ui', - install_path = '${DATADIR}/ingen', - chmod = Utils.O755, - INGEN_VERSION = bld.env.INGEN_VERSION) - - # Gtk style - bld(features = 'subst', - is_copy = True, - source = 'ingen_style.rc', - target = '../../ingen_style.rc', - install_path = '${DATADIR}/ingen', - chmod = Utils.O755) - - # LV2 UI - obj = bld(features = 'cxx cxxshlib', - cflags = ['-fvisibility=hidden'], - source = 'ingen_gui_lv2.cpp', - includes = ['.', '../../', '../../include'], - name = 'ingen_gui_lv2', - target = 'ingen_gui_lv2', - install_path = '${LV2DIR}/ingen.lv2/', - use = 'libingen libingen_gui', - uselib = 'LV2 SERD SORD SRATOM LILV RAUL GLIBMM GTKMM') diff --git a/src/include/ingen_config.h b/src/include/ingen_config.h new file mode 100644 index 00000000..6d5f36e0 --- /dev/null +++ b/src/include/ingen_config.h @@ -0,0 +1,216 @@ +// Copyright 2021-2022 David Robillard <d@drobilla.net> +// SPDX-License-Identifier: ISC + +/* + Configuration header that defines reasonable defaults at compile time. + + This allows compile-time configuration from the command line, while still + allowing the source to be built "as-is" without any configuration. The idea + is to support an advanced build system with configuration checks, while still + allowing the code to be simply "thrown at a compiler" with features + determined from the compiler or system headers. Everything can be + overridden, so it should never be necessary to edit this file to build + successfully. + + To ensure that all configure checks are performed, the build system can + define INGEN_NO_DEFAULT_CONFIG to disable defaults. In this case, it must + define all HAVE_FEATURE symbols below to 1 or 0 to enable or disable + features. Any missing definitions will generate a compiler warning. + + To ensure that this header is always included properly, all code that uses + configuration variables includes this header and checks their value with #if + (not #ifdef). Variables like USE_FEATURE are internal and should never be + defined on the command line. +*/ + +#ifndef INGEN_CONFIG_H +#define INGEN_CONFIG_H + +// Define version unconditionally so a warning will catch a mismatch +#define INGEN_VERSION "0.5.1" + +#if !defined(INGEN_NO_DEFAULT_CONFIG) + +// We need unistd.h to check _POSIX_VERSION +# ifndef INGEN_NO_POSIX +# ifdef __has_include +# if __has_include(<unistd.h>) +# include <unistd.h> +# endif +# elif defined(__unix__) +# include <unistd.h> +# endif +# endif + +// POSIX.1-2001: fileno() +# ifndef HAVE_FILENO +# if defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L +# define HAVE_FILENO 1 +# else +# define HAVE_FILENO 0 +# endif +# endif + +// POSIX.1-2001: isatty() +# ifndef HAVE_ISATTY +# if defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L +# define HAVE_ISATTY 1 +# else +# define HAVE_ISATTY 0 +# endif +# endif + +// POSIX.1-2001: posix_memalign() +# ifndef HAVE_POSIX_MEMALIGN +# if defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L +# define HAVE_POSIX_MEMALIGN 1 +# else +# define HAVE_POSIX_MEMALIGN 0 +# endif +# endif + +// BSD and GNU: vasprintf() +# ifndef HAVE_VASPRINTF +# if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) +# define HAVE_VASPRINTF 1 +# else +# define HAVE_VASPRINTF 0 +# endif +# endif + +// JACK +# ifndef HAVE_JACK +# ifdef __has_include +# if __has_include("jack/jack.h") +# define HAVE_JACK 1 +# else +# define HAVE_JACK 0 +# endif +# else +# define HAVE_JACK 0 +# endif +# endif + +// JACK metadata API +# ifndef HAVE_JACK_METADATA +# ifdef __has_include +# if __has_include("jack/metadata.h") +# define HAVE_JACK_METADATA 1 +# else +# define HAVE_JACK_METADATA 0 +# endif +# else +# define HAVE_JACK_METADATA 0 +# endif +# endif + +// JACK jack_port_rename() function +# ifndef HAVE_JACK_PORT_RENAME +# define HAVE_JACK_PORT_RENAME HAVE_JACK +# endif + +// BSD sockets +# ifndef HAVE_SOCKET +# ifdef __has_include +# if __has_include("sys/socket.h") +# define HAVE_SOCKET 1 +# else +# define HAVE_SOCKET 0 +# endif +# else +# define HAVE_SOCKET 0 +# endif +# endif + +// Webkit +# ifndef HAVE_WEBKIT +# ifdef __has_include +# if __has_include(<webkit/webkit.h>) +# define HAVE_WEBKIT 1 +# else +# define HAVE_WEBKIT 0 +# endif +# else +# define HAVE_WEBKIT 0 +# endif +# endif + +// Installation directories +# ifndef INGEN_DATA_DIR +# define INGEN_DATA_DIR "/usr/local/share/ingen" +# endif +# ifndef INGEN_MODULE_DIR +# define INGEN_MODULE_DIR "/usr/local/lib/ingen" +# endif +# ifndef INGEN_BUNDLE_DIR +# define INGEN_BUNDLE_DIR "/usr/local/lib/lv2/ingen.lv2" +# endif + +#endif // !defined(INGEN_NO_DEFAULT_CONFIG) + +/* + Make corresponding USE_FEATURE defines based on the HAVE_FEATURE defines from + above or the command line. The code checks for these using #if (not #ifdef), + so there will be an undefined warning if it checks for an unknown feature, + and this header is always required by any code that checks for features, even + if the build system defines them all. +*/ + +#if defined(HAVE_FILENO) +# define USE_FILENO HAVE_FILENO +#else +# define USE_FILENO 0 +#endif + +#if defined(HAVE_ISATTY) +# define USE_ISATTY HAVE_ISATTY +#else +# define USE_ISATTY 0 +#endif + +#if defined(HAVE_POSIX_MEMALIGN) +# define USE_POSIX_MEMALIGN HAVE_POSIX_MEMALIGN +#else +# define USE_POSIX_MEMALIGN 0 +#endif + +#if defined(HAVE_SOCKET) +# define USE_SOCKET HAVE_SOCKET +#else +# define USE_SOCKET 0 +#endif + +#if defined(HAVE_VASPRINTF) +# define USE_VASPRINTF HAVE_VASPRINTF +#else +# define USE_VASPRINTF 0 +#endif + +#if defined(HAVE_WEBKIT) +# define USE_WEBKIT HAVE_WEBKIT +#else +# define USE_WEBKIT 0 +#endif + +#if defined(HAVE_JACK_METADATA) +# define USE_JACK_METADATA HAVE_JACK_METADATA +#else +# define USE_JACK_METADATA 0 +#endif + +#if defined(HAVE_JACK_PORT_TYPE_GET_BUFFER_SIZE) +# define USE_JACK_PORT_TYPE_GET_BUFFER_SIZE \ + HAVE_JACK_PORT_TYPE_GET_BUFFER_SIZE +#else +# define USE_JACK_PORT_TYPE_GET_BUFFER_SIZE 0 +#endif + +#if defined(HAVE_JACK_PORT_RENAME) +# define USE_JACK_PORT_RENAME HAVE_JACK_PORT_RENAME +#else +# define USE_JACK_PORT_RENAME 0 +#endif + +#define INGEN_BUNDLED 0 + +#endif // INGEN_CONFIG_H diff --git a/src/ingen/ingen.cpp b/src/ingen/ingen.cpp index c7c3ef74..68ac2d7b 100644 --- a/src/ingen/ingen.cpp +++ b/src/ingen/ingen.cpp @@ -31,7 +31,7 @@ #include "raul/Symbol.hpp" #include "serd/serd.h" -#ifdef HAVE_SOCKET +#if USE_SOCKET #include "ingen/client/SocketClient.hpp" #endif @@ -134,7 +134,7 @@ run(int argc, char** argv) world->engine()->listen(); } -#ifdef HAVE_SOCKET +#if USE_SOCKET client::SocketClient::register_factories(*world); #endif diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 00000000..25dc2fae --- /dev/null +++ b/src/meson.build @@ -0,0 +1,65 @@ +# Copyright 2022 David Robillard <d@drobilla.net> +# SPDX-License-Identifier: CC0-1.0 OR GPL-3.0-or-later + +sources = files( + 'AtomReader.cpp', + 'AtomWriter.cpp', + 'ClashAvoider.cpp', + 'ColorContext.cpp', + 'Configuration.cpp', + 'FilePath.cpp', + 'Forge.cpp', + 'LV2Features.cpp', + 'Library.cpp', + 'Log.cpp', + 'Parser.cpp', + 'Resource.cpp', + 'Serialiser.cpp', + 'Store.cpp', + 'StreamWriter.cpp', + 'TurtleWriter.cpp', + 'URI.cpp', + 'URIMap.cpp', + 'URIs.cpp', + 'World.cpp', + 'runtime_paths.cpp' +) + +if have_socket + sources += files('SocketReader.cpp', 'SocketWriter.cpp') +endif + +ingen_deps = [ + boost_dep, + lilv_dep, + lv2_dep, + raul_dep, + serd_dep, + sord_dep, + sratom_dep, + thread_dep, +] + +ingen_include_dirs = include_directories('../include', 'include') + +libingen = shared_library( + 'ingen' + library_suffix, + sources, + cpp_args: cpp_suppressions + platform_defines, + dependencies: ingen_deps, + gnu_symbol_visibility: 'hidden', + implicit_include_directories: false, + include_directories: ingen_include_dirs, + install: true, + version: meson.project_version(), +) + +ingen_dep = declare_dependency( + dependencies: ingen_deps, + include_directories: include_directories('../include'), + link_with: libingen, +) + +subdir('server') +subdir('client') +subdir('gui') diff --git a/src/runtime_paths.cpp b/src/runtime_paths.cpp index 38eb681f..b5723e94 100644 --- a/src/runtime_paths.cpp +++ b/src/runtime_paths.cpp @@ -70,7 +70,7 @@ set_bundle_path_from_code(void (*function)()) Dl_info dli; dladdr(reinterpret_cast<void*>(function), &dli); -#ifdef BUNDLE +#if INGEN_BUNDLED char bin_loc[PATH_MAX]; realpath(dli.dli_fname, bin_loc); #else @@ -117,7 +117,7 @@ data_file_path(const std::string& name) std::vector<FilePath> ingen_module_dirs() { -#ifdef BUNDLE +#if INGEN_BUNDLED const FilePath default_dir = FilePath(bundle_path) / INGEN_MODULE_DIR; #else const FilePath default_dir = INGEN_MODULE_DIR; @@ -186,7 +186,7 @@ data_dirs() std::vector<FilePath> paths = system_data_dirs(); const FilePath user_dir = user_data_dir(); -#ifdef BUNDLE +#if INGEN_BUNDLED paths.insert(paths.begin(), bundle_path / INGEN_DATA_DIR); #endif diff --git a/src/server/Buffer.cpp b/src/server/Buffer.cpp index deb167d9..7e14c354 100644 --- a/src/server/Buffer.cpp +++ b/src/server/Buffer.cpp @@ -19,6 +19,7 @@ #include "BufferFactory.hpp" #include "Engine.hpp" #include "RunContext.hpp" +#include "ingen_config.h" #include "ingen/Atom.hpp" #include "ingen/Log.hpp" @@ -432,7 +433,7 @@ Buffer::update_value_buffer(SampleCount offset) void* Buffer::aligned_alloc(size_t size) { -#ifdef HAVE_POSIX_MEMALIGN +#if USE_POSIX_MEMALIGN void* buf = nullptr; if (!posix_memalign(static_cast<void**>(&buf), 16, size)) { memset(buf, 0, size); diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp index b48b291f..5817bf6b 100644 --- a/src/server/Engine.cpp +++ b/src/server/Engine.cpp @@ -39,7 +39,7 @@ #include "events/CreateGraph.hpp" #include "ingen_config.h" -#ifdef HAVE_SOCKET +#if USE_SOCKET #include "SocketListener.hpp" #endif @@ -187,7 +187,7 @@ Engine::~Engine() void Engine::listen() { -#ifdef HAVE_SOCKET +#if USE_SOCKET _listener = std::make_unique<SocketListener>(*this); #endif } diff --git a/src/server/JackDriver.cpp b/src/server/JackDriver.cpp index f03689cb..69b84fb3 100644 --- a/src/server/JackDriver.cpp +++ b/src/server/JackDriver.cpp @@ -44,7 +44,7 @@ #include <jack/midiport.h> #include <jack/transport.h> -#ifdef HAVE_JACK_METADATA +#if USE_JACK_METADATA #include "jackey.h" #include <jack/metadata.h> #endif @@ -271,7 +271,7 @@ JackDriver::rename_port(const raul::Path& old_path, { EnginePort* eport = get_port(old_path); if (eport) { -#ifdef HAVE_JACK_PORT_RENAME +#if USE_JACK_PORT_RENAME jack_port_rename(_client, static_cast<jack_port_t*>(eport->handle()), new_path.substr(1).c_str()); @@ -287,7 +287,7 @@ JackDriver::port_property(const raul::Path& path, const URI& uri, const Atom& value) { -#ifdef HAVE_JACK_METADATA +#if USE_JACK_METADATA EnginePort* eport = get_port(path); if (eport) { const auto* const jport = @@ -303,7 +303,7 @@ JackDriver::port_property_internal(const jack_port_t* jport, const URI& uri, const Atom& value) { -#ifdef HAVE_JACK_METADATA +#if USE_JACK_METADATA if (uri == _engine.world().uris().lv2_name) { jack_set_property(_client, jack_port_uuid(jport), JACK_METADATA_PRETTY_NAME, value.ptr<char>(), "text/plain"); diff --git a/src/server/meson.build b/src/server/meson.build new file mode 100644 index 00000000..b25bc084 --- /dev/null +++ b/src/server/meson.build @@ -0,0 +1,135 @@ +# Copyright 2022 David Robillard <d@drobilla.net> +# SPDX-License-Identifier: CC0-1.0 OR GPL-3.0-or-later + +########## +# Module # +########## + +server_sources = files( + 'ArcImpl.cpp', + 'BlockFactory.cpp', + 'BlockImpl.cpp', + 'Broadcaster.cpp', + 'Buffer.cpp', + 'BufferFactory.cpp', + 'ClientUpdate.cpp', + 'CompiledGraph.cpp', + 'ControlBindings.cpp', + 'DuplexPort.cpp', + 'Engine.cpp', + 'EventWriter.cpp', + 'GraphImpl.cpp', + 'InputPort.cpp', + 'InternalBlock.cpp', + 'InternalPlugin.cpp', + 'LV2Block.cpp', + 'LV2Plugin.cpp', + 'NodeImpl.cpp', + 'PortImpl.cpp', + 'PostProcessor.cpp', + 'PreProcessor.cpp', + 'RunContext.cpp', + 'SocketListener.cpp', + 'Task.cpp', + 'UndoStack.cpp', + 'Worker.cpp', + 'events/Connect.cpp', + 'events/Copy.cpp', + 'events/CreateBlock.cpp', + 'events/CreateGraph.cpp', + 'events/CreatePort.cpp', + 'events/Delete.cpp', + 'events/Delta.cpp', + 'events/Disconnect.cpp', + 'events/DisconnectAll.cpp', + 'events/Get.cpp', + 'events/Mark.cpp', + 'events/Move.cpp', + 'events/SetPortValue.cpp', + 'events/Undo.cpp', + 'ingen_engine.cpp', + 'internals/BlockDelay.cpp', + 'internals/Controller.cpp', + 'internals/Note.cpp', + 'internals/Time.cpp', + 'internals/Trigger.cpp', + 'mix.cpp', +) + +server_dependencies = [ + boost_dep, + ingen_dep, + lilv_dep, + raul_dep, + serd_dep, + sord_dep, + sratom_dep, + thread_dep, +] + +server_include_dirs = include_directories( + '.', + '../../include', + '../include', +) + +libingen_server = shared_library( + 'ingen_server', + server_sources, + cpp_args: cpp_suppressions + platform_defines + ['-DINGEN_SERVER_INTERNAL'], + dependencies: server_dependencies, + gnu_symbol_visibility: 'hidden', + implicit_include_directories: false, + include_directories: server_include_dirs, + install: true, + install_dir: ingen_module_dir, +) + +ingen_server_dep = declare_dependency( + dependencies: server_dependencies, + link_with: libingen_server, +) + +########### +# Drivers # +########### + +if jack_dep.found() + shared_module( + 'ingen_jack', + files('JackDriver.cpp', 'ingen_jack.cpp'), + cpp_args: cpp_suppressions + platform_defines, + dependencies: [ingen_server_dep, jack_dep], + gnu_symbol_visibility: 'hidden', + implicit_include_directories: false, + include_directories: ingen_include_dirs, + install: true, + install_dir: ingen_module_dir, + ) +endif + +if portaudio_dep.found() + shared_module( + 'ingen_portaudio', + files('PortAudioDriver.cpp', 'ingen_portaudio.cpp'), + cpp_args: cpp_suppressions + platform_defines, + dependencies: [ingen_server_dep, portaudio_dep], + gnu_symbol_visibility: 'hidden', + implicit_include_directories: false, + include_directories: ingen_include_dirs, + install: true, + install_dir: ingen_module_dir, + ) +endif + +shared_module( + 'ingen_lv2', + files('ingen_lv2.cpp'), + cpp_args: cpp_suppressions + platform_defines, + dependencies: [ingen_server_dep, lv2_dep], + gnu_symbol_visibility: 'hidden', + implicit_include_directories: false, + include_directories: ingen_include_dirs, + install: true, + install_dir: lv2dir / 'ingen.lv2', +) diff --git a/src/server/wscript b/src/server/wscript deleted file mode 100644 index 5fdf4583..00000000 --- a/src/server/wscript +++ /dev/null @@ -1,106 +0,0 @@ -#!/usr/bin/env python - - -def build(bld): - core_source = ''' - ArcImpl.cpp - BlockFactory.cpp - BlockImpl.cpp - Broadcaster.cpp - Buffer.cpp - BufferFactory.cpp - CompiledGraph.cpp - ClientUpdate.cpp - ControlBindings.cpp - DuplexPort.cpp - Engine.cpp - EventWriter.cpp - GraphImpl.cpp - InputPort.cpp - InternalBlock.cpp - InternalPlugin.cpp - LV2Block.cpp - LV2Plugin.cpp - NodeImpl.cpp - PortImpl.cpp - PostProcessor.cpp - PreProcessor.cpp - RunContext.cpp - SocketListener.cpp - Task.cpp - UndoStack.cpp - Worker.cpp - events/Connect.cpp - events/Copy.cpp - events/CreateBlock.cpp - events/CreateGraph.cpp - events/CreatePort.cpp - events/Delete.cpp - events/Delta.cpp - events/Disconnect.cpp - events/DisconnectAll.cpp - events/Get.cpp - events/Mark.cpp - events/Move.cpp - events/SetPortValue.cpp - events/Undo.cpp - ingen_engine.cpp - internals/BlockDelay.cpp - internals/Controller.cpp - internals/Note.cpp - internals/Time.cpp - internals/Trigger.cpp - mix.cpp - ''' - - core_libs = 'LV2 LILV RAUL SERD SORD SRATOM' - - bld(features = 'cxx cxxshlib', - source = core_source, - export_includes = ['../../include'], - includes = ['.', '../..', '../../include'], - name = 'libingen_server', - target = 'ingen_server', - install_path = '${LIBDIR}', - use = 'libingen libingen_socket', - uselib = core_libs, - cxxflags = bld.env.PTHREAD_CFLAGS + bld.env.INGEN_TEST_CXXFLAGS, - linkflags = bld.env.PTHREAD_LINKFLAGS + bld.env.INGEN_TEST_LINKFLAGS) - - if bld.env.HAVE_JACK: - bld(features = 'cxx cxxshlib', - source = 'JackDriver.cpp ingen_jack.cpp', - includes = ['.', '../../', '../../include'], - name = 'libingen_jack', - target = 'ingen_jack', - install_path = '${LIBDIR}', - use = 'libingen_server', - uselib = core_libs + ' JACK', - cxxflags = ['-fvisibility=hidden'] + bld.env.PTHREAD_CFLAGS, - linkflags = bld.env.PTHREAD_LINKFLAGS) - - if bld.env.HAVE_PORTAUDIO: - bld(features = 'cxx cxxshlib', - source = 'PortAudioDriver.cpp ingen_portaudio.cpp', - includes = ['.', '../../', '../../include'], - name = 'libingen_portaudio', - target = 'ingen_portaudio', - install_path = '${LIBDIR}', - use = 'libingen_server', - uselib = core_libs + ' PORTAUDIO', - cxxflags = ['-fvisibility=hidden'] + bld.env.PTHREAD_CFLAGS, - linkflags = bld.env.PTHREAD_LINKFLAGS) - - # Ingen LV2 wrapper - if bld.env.INGEN_BUILD_LV2: - bld(features = 'cxx cxxshlib', - source = ' ingen_lv2.cpp ', - cflags = ['-fvisibility=hidden'], - includes = ['../../', '../../include'], - name = 'libingen_lv2', - target = 'ingen_lv2', - install_path = '${LV2DIR}/ingen.lv2/', - use = 'libingen libingen_server', - uselib = core_libs, - cxxflags = ['-fvisibility=hidden'] + bld.env.PTHREAD_CFLAGS, - linkflags = bld.env.PTHREAD_LINKFLAGS) diff --git a/src/wscript b/src/wscript deleted file mode 100644 index a2f576da..00000000 --- a/src/wscript +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env python - - -def build(bld): - sources = [ - 'AtomReader.cpp', - 'AtomWriter.cpp', - 'ClashAvoider.cpp', - 'ColorContext.cpp', - 'Configuration.cpp', - 'FilePath.cpp', - 'Forge.cpp', - 'LV2Features.cpp', - 'Library.cpp', - 'Log.cpp', - 'Parser.cpp', - 'Resource.cpp', - 'Serialiser.cpp', - 'Store.cpp', - 'StreamWriter.cpp', - 'TurtleWriter.cpp', - 'URI.cpp', - 'URIMap.cpp', - 'URIs.cpp', - 'World.cpp', - 'runtime_paths.cpp' - ] - if bld.is_defined('HAVE_SOCKET'): - sources += ['SocketReader.cpp', 'SocketWriter.cpp'] - - lib = [] - if bld.is_defined('HAVE_LIBDL'): - lib += ['dl'] - - bld(features = 'cxx cxxshlib', - source = sources, - export_includes = ['../include'], - includes = ['.', '..', '../include'], - name = 'libingen', - target = 'ingen-%s' % bld.env.INGEN_MAJOR_VERSION, - vnum = bld.env.INGEN_VERSION, - install_path = '${LIBDIR}', - lib = lib, - uselib = 'LV2 LILV RAUL SERD SORD SRATOM', - cxxflags = (['-fvisibility=hidden'] + - bld.env.PTHREAD_CFLAGS + bld.env.INGEN_TEST_CXXFLAGS), - linkflags = bld.env.PTHREAD_LINKFLAGS + bld.env.INGEN_TEST_LINKFLAGS) |