meson: Add alternative build system
Change-Id: I773281f0df820f4de25a6536fb3858d88b9150fa
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/example/meson.build b/example/meson.build
new file mode 100644
index 0000000..815a78f
--- /dev/null
+++ b/example/meson.build
@@ -0,0 +1,9 @@
+examples = [
+]
+
+foreach example : examples
+ executable(example, example + '.cpp',
+ include_directories: includes,
+ implicit_include_directories: false,
+ link_with: stdplus)
+endforeach
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..064ebf6
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,21 @@
+project('stdplus', 'cpp',
+ version: '0.1', meson_version: '>=0.49.0',
+ default_options: [
+ 'warning_level=3',
+ 'werror=true',
+ 'cpp_std=c++17'
+ ])
+
+includes = include_directories('src')
+
+subdir('src')
+
+build_tests = get_option('tests')
+build_examples = get_option('examples')
+
+if build_examples
+ subdir('example')
+endif
+if not build_tests.disabled()
+ subdir('test')
+endif
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..86bc7fc
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,2 @@
+option('tests', type: 'feature', description: 'Build tests')
+option('examples', type: 'boolean', value: true, description: 'Build examples')
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..1cf2631
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,19 @@
+stdplus = library(
+ 'stdplus',
+ [
+ 'stdplus/signal.cpp',
+ ],
+ include_directories: includes,
+ implicit_include_directories: false,
+ install: true)
+
+import('pkgconfig').generate(
+ name: 'stdplus',
+ description: 'C++ helper utilities',
+ version: meson.project_version(),
+ libraries: [stdplus],
+)
+
+install_headers(
+ 'stdplus/signal.hpp',
+ subdir: 'stdplus')
diff --git a/test/meson.build b/test/meson.build
new file mode 100644
index 0000000..b918d5d
--- /dev/null
+++ b/test/meson.build
@@ -0,0 +1,14 @@
+gtest = dependency('gtest', main: true, disabler: true, required: build_tests)
+gmock = dependency('gmock', disabler: true, required: build_tests)
+
+tests = [
+ 'signal',
+]
+
+foreach t : tests
+ test(t, executable(t.underscorify(), t + '.cpp',
+ include_directories: includes,
+ implicit_include_directories: false,
+ link_with: stdplus,
+ dependencies: [gtest, gmock]))
+endforeach