summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/libcamera/camera_manager.h3
-rwxr-xr-xinclude/libcamera/gen-header.sh6
-rw-r--r--include/libcamera/meson.build18
-rw-r--r--include/libcamera/version.h.in12
4 files changed, 22 insertions, 17 deletions
diff --git a/include/libcamera/camera_manager.h b/include/libcamera/camera_manager.h
index cf3a85ae..633d27d1 100644
--- a/include/libcamera/camera_manager.h
+++ b/include/libcamera/camera_manager.h
@@ -31,6 +31,7 @@ public:
void removeCamera(Camera *camera);
static CameraManager *instance();
+ static const std::string &version() { return version_; }
void setEventDispatcher(std::unique_ptr<EventDispatcher> dispatcher);
EventDispatcher *eventDispatcher();
@@ -46,6 +47,8 @@ private:
std::vector<std::shared_ptr<Camera>> cameras_;
std::unique_ptr<EventDispatcher> dispatcher_;
+
+ static const std::string version_;
};
} /* namespace libcamera */
diff --git a/include/libcamera/gen-header.sh b/include/libcamera/gen-header.sh
index e171c08c..a69fe8e9 100755
--- a/include/libcamera/gen-header.sh
+++ b/include/libcamera/gen-header.sh
@@ -16,8 +16,12 @@ cat <<EOF > "$dst_file"
EOF
-for header in "$src_dir"/*.h ; do
+headers=$(for header in "$src_dir"/*.h ; do
header=$(basename "$header")
+ echo "$header"
+done ; echo "version.h" | sort)
+
+for header in $headers ; do
echo "#include <libcamera/$header>" >> "$dst_file"
done
diff --git a/include/libcamera/meson.build b/include/libcamera/meson.build
index 6f81f111..972513fc 100644
--- a/include/libcamera/meson.build
+++ b/include/libcamera/meson.build
@@ -16,13 +16,6 @@ libcamera_api = files([
'timer.h',
])
-gen_version = join_paths(meson.source_root(), 'utils', 'gen-version.sh')
-
-version_h = vcs_tag(command : [gen_version, meson.current_source_dir()],
- input : 'version.h.in',
- output : 'version.h',
- fallback : 'v0.0')
-
gen_header = files('gen-header.sh')
libcamera_h = custom_target('gen-header',
@@ -32,5 +25,16 @@ libcamera_h = custom_target('gen-header',
install : true,
install_dir : 'include/libcamera')
+version = libcamera_version.split('.')
+libcamera_version_config = configuration_data()
+libcamera_version_config.set('LIBCAMERA_VERSION_MAJOR', version[0])
+libcamera_version_config.set('LIBCAMERA_VERSION_MINOR', version[1])
+libcamera_version_config.set('LIBCAMERA_VERSION_PATCH', version[2])
+
+configure_file(input : 'version.h.in',
+ output : 'version.h',
+ configuration : libcamera_version_config,
+ install_dir : 'include/libcamera')
+
install_headers(libcamera_api,
subdir : 'libcamera')
diff --git a/include/libcamera/version.h.in b/include/libcamera/version.h.in
index e49b3696..5e9a3091 100644
--- a/include/libcamera/version.h.in
+++ b/include/libcamera/version.h.in
@@ -9,14 +9,8 @@
#ifndef __LIBCAMERA_VERSION_H__
#define __LIBCAMERA_VERSION_H__
-#include <string>
-
-#define LIBCAMERA_VERSION "@VCS_TAG@"
-
-namespace libcamera {
-
-extern const std::string version;
-
-} /* namespace libcamera */
+#define LIBCAMERA_VERSION_MAJOR @LIBCAMERA_VERSION_MAJOR@
+#define LIBCAMERA_VERSION_MINOR @LIBCAMERA_VERSION_MINOR@
+#define LIBCAMERA_VERSION_PATCH @LIBCAMERA_VERSION_PATCH@
#endif /* __LIBCAMERA_VERSION_H__ */