Bake version info into library
parent
53db2b8c1b
commit
addcc50483
|
@ -50,6 +50,8 @@ typedef bool (*nvnc_auth_fn)(const char* username, const char* password,
|
|||
void* userdata);
|
||||
typedef void (*nvnc_render_fn)(struct nvnc_display*, struct nvnc_fb*);
|
||||
|
||||
extern const char nvnc_version[];
|
||||
|
||||
struct nvnc* nvnc_open(const char* addr, uint16_t port);
|
||||
void nvnc_close(struct nvnc* self);
|
||||
|
||||
|
|
15
meson.build
15
meson.build
|
@ -1,7 +1,7 @@
|
|||
project(
|
||||
'neatvnc',
|
||||
'c',
|
||||
version: '0.1.0',
|
||||
version: '0.2.0',
|
||||
license: 'ISC',
|
||||
default_options: [
|
||||
'c_std=gnu11',
|
||||
|
@ -12,6 +12,7 @@ buildtype = get_option('buildtype')
|
|||
host_system = host_machine.system()
|
||||
|
||||
c_args = [
|
||||
'-DPROJECT_VERSION="@0@"'.format(meson.project_version()),
|
||||
'-D_GNU_SOURCE',
|
||||
'-fvisibility=hidden',
|
||||
'-Wmissing-prototypes',
|
||||
|
@ -21,6 +22,18 @@ if buildtype != 'debug' and buildtype != 'debugoptimized'
|
|||
c_args += '-DNDEBUG'
|
||||
endif
|
||||
|
||||
git = find_program('git', native: true, required: false)
|
||||
if git.found()
|
||||
git_describe = run_command([git, 'describe', '--tags', '--long'])
|
||||
git_branch = run_command([git, 'rev-parse', '--abbrev-ref', 'HEAD'])
|
||||
if git_describe.returncode() == 0 and git_branch.returncode() == 0
|
||||
c_args += '-DGIT_VERSION="@0@ (@1@)"'.format(
|
||||
git_describe.stdout().strip(),
|
||||
git_branch.stdout().strip(),
|
||||
)
|
||||
endif
|
||||
endif
|
||||
|
||||
add_project_arguments(c_args, language: 'c')
|
||||
|
||||
cc = meson.get_compiler('c')
|
||||
|
|
|
@ -71,6 +71,14 @@ struct fb_update_work {
|
|||
|
||||
int schedule_client_update_fb(struct nvnc_client* client);
|
||||
|
||||
#if defined(GIT_VERSION)
|
||||
EXPORT const char nvnc_version[] = GIT_VERSION;
|
||||
#elif defined(PROJECT_VERSION)
|
||||
EXPORT const char nvnc_version[] = PROJECT_VERSION;
|
||||
#else
|
||||
EXPORT const char nvnc_version[] = "UNKNOWN";
|
||||
#endif
|
||||
|
||||
static void client_close(struct nvnc_client* client)
|
||||
{
|
||||
log_debug("client_close(%p): ref %d\n", client, client->ref);
|
||||
|
|
Loading…
Reference in New Issue