aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-07-13 17:55:16 -0400
committerDavid Robillard <d@drobilla.net>2023-12-02 18:49:08 -0500
commit91c0c68e153118f4d64c137d78882ee95830c307 (patch)
tree1325868b64aab19ff57a08d528ac1a25b8e82d7a
parent90fe1b64c2203f9e82646cb41c8a85f0a31125bb (diff)
downloadserd-91c0c68e153118f4d64c137d78882ee95830c307.tar.gz
serd-91c0c68e153118f4d64c137d78882ee95830c307.tar.bz2
serd-91c0c68e153118f4d64c137d78882ee95830c307.zip
Move serdi to tools subdirectory
This separates the command-line tool code from the library implementation.
-rw-r--r--meson.build19
-rw-r--r--src/.clang-tidy2
-rwxr-xr-xtest/run_suite.py2
-rw-r--r--test/serd_test_util/__init__.py2
-rw-r--r--tools/.clang-tidy12
-rw-r--r--tools/console.c (renamed from src/console.c)0
-rw-r--r--tools/console.h (renamed from src/console.h)5
-rw-r--r--tools/meson.build23
-rw-r--r--tools/serdi.c (renamed from src/serdi.c)0
9 files changed, 43 insertions, 22 deletions
diff --git a/meson.build b/meson.build
index 66ef536f..2c440224 100644
--- a/meson.build
+++ b/meson.build
@@ -234,24 +234,7 @@ install_headers(c_headers, subdir: versioned_name / 'serd')
# Build serdi command line utility
if not get_option('tools').disabled()
- tool_link_args = []
- if get_option('static')
- tool_link_args += ['-static']
- endif
-
- serdi = executable(
- 'serdi',
- files(
- 'src/console.c',
- 'src/serdi.c',
- ),
- c_args: c_suppressions + platform_c_args,
- dependencies: [serd_dep, zix_dep],
- install: true,
- link_args: tool_link_args,
- )
-
- meson.override_find_program('serdi', serdi)
+ subdir('tools')
endif
# Display top-level summary (before subdirectories to appear first)
diff --git a/src/.clang-tidy b/src/.clang-tidy
index d02d9891..77b43fc1 100644
--- a/src/.clang-tidy
+++ b/src/.clang-tidy
@@ -5,10 +5,8 @@ Checks: >
-*-magic-numbers,
-bugprone-easily-swappable-parameters,
-cert-err33-c,
- -clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
-clang-analyzer-valist.Uninitialized,
-clang-diagnostic-unused-function,
- -concurrency-mt-unsafe,
-hicpp-multiway-paths-covered,
-hicpp-signed-bitwise,
-llvm-header-guard,
diff --git a/test/run_suite.py b/test/run_suite.py
index 2e93502f..b44808b7 100755
--- a/test/run_suite.py
+++ b/test/run_suite.py
@@ -154,7 +154,7 @@ def main():
parser.add_argument("--lax", action="store_true", help="tolerate errors")
parser.add_argument("--report", help="path to write result report to")
parser.add_argument("--reverse", action="store_true", help="reverse test")
- parser.add_argument("--serdi", default="serdi", help="path to serdi")
+ parser.add_argument("--serdi", default="tools/serdi", help="path to serdi")
parser.add_argument("--wrapper", default="", help="executable wrapper")
parser.add_argument("manifest", help="test suite manifest.ttl file")
parser.add_argument("base_uri", help="base URI for tests")
diff --git a/test/serd_test_util/__init__.py b/test/serd_test_util/__init__.py
index 260dcd9d..4f426009 100644
--- a/test/serd_test_util/__init__.py
+++ b/test/serd_test_util/__init__.py
@@ -57,7 +57,7 @@ def wrapper_args(description, with_input=False):
"""Return the command line arguments for a wrapped test."""
parser = argparse.ArgumentParser(description)
- parser.add_argument("--serdi", default="./serdi", help="serdi executable")
+ parser.add_argument("--serdi", default="tools/serdi", help="executable")
parser.add_argument("--wrapper", default="", help="executable wrapper")
if with_input:
parser.add_argument("input", help="input file")
diff --git a/tools/.clang-tidy b/tools/.clang-tidy
new file mode 100644
index 00000000..f7c82d78
--- /dev/null
+++ b/tools/.clang-tidy
@@ -0,0 +1,12 @@
+# Copyright 2020-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD OR ISC
+
+Checks: >
+ -*-magic-numbers,
+ -bugprone-easily-swappable-parameters,
+ -cert-err33-c,
+ -concurrency-mt-unsafe,
+ -hicpp-signed-bitwise,
+ -llvm-header-guard,
+ -readability-function-cognitive-complexity,
+InheritParentConfig: true
diff --git a/src/console.c b/tools/console.c
index 4a127c3e..4a127c3e 100644
--- a/src/console.c
+++ b/tools/console.c
diff --git a/src/console.h b/tools/console.h
index 65b041ba..41ab328d 100644
--- a/src/console.h
+++ b/tools/console.h
@@ -1,6 +1,9 @@
// Copyright 2021 David Robillard <d@drobilla.net>
// SPDX-License-Identifier: ISC
+#ifndef SERD_TOOLS_CONSOLE_H
+#define SERD_TOOLS_CONSOLE_H
+
#include <stdio.h>
void
@@ -8,3 +11,5 @@ serd_set_stream_utf8_mode(FILE* stream);
int
serd_print_version(const char* program);
+
+#endif // SERD_TOOLS_CONSOLE_H
diff --git a/tools/meson.build b/tools/meson.build
new file mode 100644
index 00000000..49fa32c7
--- /dev/null
+++ b/tools/meson.build
@@ -0,0 +1,23 @@
+# Copyright 2021-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD OR ISC
+
+tool_c_args = c_suppressions + platform_c_args
+tool_link_args = []
+
+if get_option('static') and cc.get_id() != 'msvc'
+ tool_link_args += ['-static']
+endif
+
+serdi = executable(
+ 'serdi',
+ files(
+ 'console.c',
+ 'serdi.c',
+ ),
+ c_args: tool_c_args,
+ dependencies: [serd_dep, zix_dep],
+ install: true,
+ link_args: tool_link_args,
+)
+
+meson.override_find_program('serdi', serdi)
diff --git a/src/serdi.c b/tools/serdi.c
index fd7fdb15..fd7fdb15 100644
--- a/src/serdi.c
+++ b/tools/serdi.c