diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libcamera/camera_manager.cpp | 14 | ||||
-rw-r--r-- | src/libcamera/meson.build | 10 | ||||
-rw-r--r-- | src/libcamera/version.cpp.in | 16 | ||||
-rw-r--r-- | src/qcam/main_window.cpp | 2 |
4 files changed, 33 insertions, 9 deletions
diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp index c5da46b4..337496c2 100644 --- a/src/libcamera/camera_manager.cpp +++ b/src/libcamera/camera_manager.cpp @@ -9,7 +9,6 @@ #include <libcamera/camera.h> #include <libcamera/event_dispatcher.h> -#include <libcamera/version.h> #include "device_enumerator.h" #include "event_dispatcher_poll.h" @@ -27,11 +26,6 @@ namespace libcamera { LOG_DEFINE_CATEGORY(Camera) /** - * \brief The library global version string - */ -const std::string version(LIBCAMERA_VERSION); - -/** * \class CameraManager * \brief Provide access and manage all cameras in the system * @@ -85,7 +79,7 @@ int CameraManager::start() if (enumerator_) return -EBUSY; - LOG(Camera, Info) << "libcamera " << version; + LOG(Camera, Info) << "libcamera " << version_; enumerator_ = DeviceEnumerator::create(); if (!enumerator_ || enumerator_->enumerate()) @@ -233,6 +227,12 @@ CameraManager *CameraManager::instance() } /** + * \fn const std::string &CameraManager::version() + * \brief Retrieve the libcamera version string + * \return The libcamera version string + */ + +/** * \brief Set the event dispatcher * \param[in] dispatcher Pointer to the event dispatcher * diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build index 336f4f06..97ff86e2 100644 --- a/src/libcamera/meson.build +++ b/src/libcamera/meson.build @@ -79,8 +79,16 @@ control_types_cpp = custom_target('control_types_cpp', libcamera_sources += control_types_cpp +gen_version = join_paths(meson.source_root(), 'utils', 'gen-version.sh') + +version_cpp = vcs_tag(command : [gen_version, meson.source_root()], + input : 'version.cpp.in', + output : 'version.cpp', + fallback : meson.project_version()) + +libcamera_sources += version_cpp + libcamera_deps = [ - declare_dependency(sources : version_h), cc.find_library('dl'), libudev, ] diff --git a/src/libcamera/version.cpp.in b/src/libcamera/version.cpp.in new file mode 100644 index 00000000..5aec08a1 --- /dev/null +++ b/src/libcamera/version.cpp.in @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2019, Google Inc. + * + * version.cpp - libcamera version + * + * This file is auto-generated. Do not edit. + */ + +#include <libcamera/camera_manager.h> + +namespace libcamera { + +const std::string CameraManager::version_("v@VCS_TAG@"); + +} /* namespace libcamera */ diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index b2f3a1f3..907d2423 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -26,7 +26,7 @@ MainWindow::MainWindow(const OptionsParser::Options &options) { int ret; - title_ = "QCam " + QString::fromStdString(libcamera::version); + title_ = "QCam " + QString::fromStdString(CameraManager::version()); setWindowTitle(title_); connect(&titleTimer_, SIGNAL(timeout()), this, SLOT(updateTitle())); |