Skip to content

Commit

Permalink
Add meson build support
Browse files Browse the repository at this point in the history
Mostly copied from

geany/geany-plugins#1345
  • Loading branch information
techee committed Aug 5, 2024
1 parent d7fe8c6 commit f1c9f8d
Show file tree
Hide file tree
Showing 3 changed files with 146 additions and 0 deletions.
90 changes: 90 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
project(
'geany-lsp',
'c',
license : 'GPL-2.0',
version : '2.1'
)

plugin_name = 'lsp'

i18n = import('i18n')
# define GETTEXT_PACKAGE
add_project_arguments('-DGETTEXT_PACKAGE="intltest"', language:'c')
i18n.gettext(meson.project_name())

subdir('meson_config')


geany_dep = dependency('geany')

plugin_suffix = []
if (host_machine.system() == 'darwin')
plugin_suffix = 'so' # use "so" instead of "dylib" so Geany finds plugins correctly
endif

plugin_inc = [include_directories('lsp/deps/json-glib', 'lsp/deps/jsonrpc-glib', 'lsp/deps', 'lsp/src')]

shared_module('lsp',
'lsp/deps/json-glib/json-array.c',
'lsp/deps/json-glib/json-builder.c',
'lsp/deps/json-glib/json-debug.c',
'lsp/deps/json-glib/json-gboxed.c',
'lsp/deps/json-glib/json-generator.c',
'lsp/deps/json-glib/json-gobject.c',
'lsp/deps/json-glib/json-gvariant.c',
'lsp/deps/json-glib/json-node.c',
'lsp/deps/json-glib/json-object.c',
'lsp/deps/json-glib/json-parser.c',
'lsp/deps/json-glib/json-path.c',
'lsp/deps/json-glib/json-reader.c',
'lsp/deps/json-glib/json-scanner.c',
'lsp/deps/json-glib/json-serializable.c',
'lsp/deps/json-glib/json-utils.c',
'lsp/deps/json-glib/json-value.c',

'lsp/deps/jsonrpc-glib/jsonrpc-client.c',
'lsp/deps/jsonrpc-glib/jsonrpc-input-stream.c',
'lsp/deps/jsonrpc-glib/jsonrpc-message.c',
'lsp/deps/jsonrpc-glib/jsonrpc-output-stream.c',
'lsp/deps/jsonrpc-glib/jsonrpc-server.c',
'lsp/deps/jsonrpc-glib/jsonrpc-marshalers.c',

'lsp/src/lsp-autocomplete.c',
'lsp/src/lsp-main.c',
'lsp/src/lsp-server.c',
'lsp/src/lsp-sync.c',
'lsp/src/lsp-rpc.c',
'lsp/src/lsp-diagnostics.c',
'lsp/src/lsp-hover.c',
'lsp/src/lsp-signature.c',
'lsp/src/lsp-log.c',
'lsp/src/lsp-goto.c',
'lsp/src/lsp-progress.c',
'lsp/src/lsp-symbols.c',
'lsp/src/lsp-symbol-kinds.c',
'lsp/src/lsp-semtokens.c',
'lsp/src/lsp-goto-panel.c',
'lsp/src/lsp-goto-anywhere.c',
'lsp/src/lsp-format.c',
'lsp/src/lsp-highlight.c',
'lsp/src/lsp-rename.c',
'lsp/src/lsp-command.c',
'lsp/src/lsp-code-lens.c',
'lsp/src/lsp-symbol.c',
'lsp/src/lsp-extension.c',
'lsp/src/lsp-utils.c',
'lsp/src/lsp-workspace-folders.c',
name_prefix: '', # "lib" seems to be the default prefix
name_suffix: plugin_suffix,
include_directories: plugin_inc,
c_args: ['-DJSON_COMPILATION', '-DJSONRPC_GLIB_COMPILATION'],
dependencies: [config_dep, geany_dep],
install_dir: plugin_path,
install: true
)


lsp_conf = [
'lsp/data/lsp.conf',
]
install_data(sources: lsp_conf, install_dir: plugin_datadir)
18 changes: 18 additions & 0 deletions meson_config/config.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#pragma once

#define VERSION "@version@"

#define GEANY_VERSION "@geany_version@"

#define PLUGIN "@plugin_name@"

#define DOCDIR "@prefix@/@docdir@"
#define LIBDIR "@prefix@/@libdir@"
#define LOCALEDIR "@prefix@/@localedir@"

#define GEANYPLUGINS_DATADIR "@prefix@/@plugin_datadir@"
#define DBGPLUG_DATA_DIR "@prefix@/@plugin_datadir@"
#define PLUGINDATADIR "@prefix@/@plugin_datadir@"

#define PLUGINDOCDIR "@prefix@/@plugin_docdir@"
#define PLUGINHTMLDOCDIR "@prefix@/@plugin_docdir@/html"
38 changes: 38 additions & 0 deletions meson_config/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
docdir = get_option('datadir') / 'doc'
project_datadir = get_option('datadir') / 'geany-plugins'
project_libdir = get_option('libdir') / 'geany-plugins'
project_docdir = docdir / 'geany-plugins'

plugin_datadir = project_datadir / plugin_name
plugin_libdir = project_libdir / plugin_name
plugin_docdir = project_docdir / plugin_name

plugin_path = get_option('libdir') / 'geany'

conf_data = configuration_data()

conf_data.set('plugin_name', plugin_name)
conf_data.set('plugin_path', plugin_path)

conf_data.set('version', meson.project_version())
conf_data.set('geany_version', '2.0.0')

conf_data.set('prefix', get_option('prefix'))
conf_data.set('libdir', get_option('libdir'))
conf_data.set('docdir', docdir)
conf_data.set('localedir', get_option('localedir'))

conf_data.set('plugin_datadir', plugin_datadir)
conf_data.set('plugin_libdir', plugin_libdir)
conf_data.set('plugin_docdir', plugin_docdir)

configure_file(
input: 'config.h.in',
output: 'config.h',
configuration: conf_data,
)

config_dep = declare_dependency(
include_directories: include_directories('.'),
compile_args: ['-DHAVE_CONFIG_H'],
)

0 comments on commit f1c9f8d

Please sign in to comment.