summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorKieran Bingham <kieran.bingham@ideasonboard.com>2022-11-01 21:19:20 +0000
committerKieran Bingham <kieran.bingham@ideasonboard.com>2022-11-22 12:31:14 +0000
commit2619164b6998b2143e776a1c2f10140af9fe878b (patch)
tree4c9b370776e198d2288462c58713531a84750f09 /meson.build
parent0e9c6b1e32f5ef38286ff2e0774ba69caf2eee7b (diff)
meson: Convert CMake to Meson build infrastructure
Provide infrastructure to be able to build the uvc-gadget library as a shared object and an executable which links against this as a dependency to implment the reference 'uvc-gadget' application. All existing cmake infrastructure is removed. This removes custom glob support that was previously used by an early development for Android, which is expected to be re-added later when required. Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build58
1 files changed, 58 insertions, 0 deletions
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..5a9d3fb
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,58 @@
+# SPDX-License-Identifier: CC0-1.0
+
+project('uvc-gadget', 'c',
+ meson_version : '>= 0.56',
+ version : '0.0.0',
+ default_options : [
+ 'werror=true',
+ 'warning_level=2',
+ ],
+ license : 'LGPL 2.1+')
+
+# Generate version information. The uvc_gadget_git_version variable contains the
+# full version with git patch count and SHA1 (e.g. 1.2.3+211-c94a24f4), while
+# the uvc_gadget_version variable contains the major.minor.patch (e.g. 1.2.3)
+# only. If the source tree isn't under git control, or if it matches the last
+# git version tag, the build metadata (e.g. +211-c94a24f4) is omitted from
+# uvc_gadget_git_version.
+uvc_gadget_git_version = run_command('scripts/gen-version.sh',
+ meson.project_build_root(),
+ meson.project_source_root(),
+ check: false).stdout().strip()
+if uvc_gadget_git_version == ''
+ uvc_gadget_git_version = meson.project_version()
+endif
+
+uvc_gadget_version = uvc_gadget_git_version.split('+')[0]
+
+# A shallow clone, or a clone without a reachable tag equivalent to the
+# meson.project_version() could leave the project in a mis-described state.
+# Produce a warning in this event, and fix to a best effort.
+if uvc_gadget_version != meson.project_version()
+ warning('The sources disagree about the version: '
+ + uvc_gadget_version + ' != ' + meson.project_version())
+
+ summary({'uvc-gadget git version' : uvc_gadget_git_version,
+ 'Source version match' : false,
+ },
+ bool_yn : true, section : 'Versions')
+
+ # Replace the version components reported by git with the release version,
+ # but keep all trailing information supplied by git.
+ uvc_gadget_git_version = (meson.project_version() +
+ uvc_gadget_git_version.strip(uvc_gadget_version))
+ uvc_gadget_version = meson.project_version()
+
+ # Append a marker to show we have modified this version string
+ uvc_gadget_git_version += '-nvm'
+endif
+
+summary({ 'Sources': uvc_gadget_git_version, }, section : 'Versions')
+
+# Configure the build environment.
+cc = meson.get_compiler('c')
+
+subdir('include')
+
+subdir('lib')
+subdir('src')