version: add version file

This commit is contained in:
Wim Taymans 2018-07-17 10:31:17 +02:00
parent c6140bbe38
commit 31d9438b55
4 changed files with 78 additions and 2 deletions

View file

@ -61,6 +61,11 @@ pipewire_sources = [
'work-queue.c',
]
configure_file(input : 'version.h.in',
output : 'version.h',
install_dir : 'include/pipewire',
configuration : cdata)
install_headers(pipewire_headers, subdir : 'pipewire')
libpipewire_c_args = [

View file

@ -31,8 +31,9 @@
#include <spa/support/dbus.h>
#include "pipewire/pipewire.h"
#include "pipewire/private.h"
#include "pipewire.h"
#include "private.h"
#include "version.h"
#define MAX_SUPPORT 32
@ -596,3 +597,9 @@ enum pw_direction pw_direction_reverse(enum pw_direction direction)
return PW_DIRECTION_INPUT;
return direction;
}
/** Get the currently running version */
const char* pw_get_library_version(void)
{
return pw_get_headers_version();
}

View file

@ -46,6 +46,7 @@ extern "C" {
#include <pipewire/thread-loop.h>
#include <pipewire/type.h>
#include <pipewire/utils.h>
#include <pipewire/version.h>
/** \mainpage
*

63
src/pipewire/version.h.in Normal file
View file

@ -0,0 +1,63 @@
/* PipeWire
* Copyright (C) 2018 Wim Taymans <wim.taymans@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __PIPEWIRE_VERSION_H__
#define __PIPEWIRE_VERSION_H__
/* WARNING: Make sure to edit the real source file version.h.in! */
#ifdef __cplusplus
extern "C" {
#endif
/** Return the version of the header files. Keep in mind that this is
a macro and not a function, so it is impossible to get the pointer of
it. */
#define pw_get_headers_version() ("@PIPEWIRE_VERSION_MAJOR@.@PIPEWIRE_VERSION_MINOR@.@PIPEWIRE_VERSION_MICRO@")
/** Return the version of the library the current application is
* linked to. */
const char* pw_get_library_version(void);
/** The current API version. Versions prior to 0.2.0 have
* PW_API_VERSION undefined. Please note that this is only ever
* increased on incompatible API changes! */
#define PW_API_VERSION @PIPEWIRE_API_VERSION@
/** The major version of PipeWire. \since 0.2.0 */
#define PW_MAJOR @PIPEWIRE_VERSION_MAJOR@
/** The minor version of PipeWire. \since 0.2.0 */
#define PW_MINOR @PIPEWIRE_VERSION_MINOR@
/** The micro version of PipeWire. \since 0.2.0 */
#define PW_MICRO @PIPEWIRE_VERSION_MICRO@
/** Evaluates to TRUE if the PipeWire library version is equal or
* newer than the specified. \since 0.2.0 */
#define PW_CHECK_VERSION(major,minor,micro) \
((PW_MAJOR > (major)) || \
(PW_MAJOR == (major) && PW_MINOR > (minor)) || \
(PW_MAJOR == (major) && PW_MINOR == (minor) && PW_MICRO >= (micro)))
#ifdef __cplusplus
}
#endif
#endif /* __PIPEWIRE_VERION_H__ */