Trace the commit ID and branch the library was built from

This commit is contained in:
Chris Robinson
2016-12-21 01:08:33 -08:00
parent 8f581c0e66
commit bcb6dfee71
6 changed files with 40 additions and 4 deletions
+4
View File
@@ -20,6 +20,8 @@
#include "config.h"
#include "version.h"
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
@@ -900,6 +902,8 @@ static void alc_initconfig(void)
else ERR("Failed to open log file '%s'\n", str);
}
TRACE("Initializing library v%s-%s %s\n", ALSOFT_VERSION,
ALSOFT_GIT_COMMIT_HASH, ALSOFT_GIT_BRANCH);
{
char buf[1024] = "";
int len = snprintf(buf, sizeof(buf), "%s", BackendList[0].name);
+22
View File
@@ -1174,6 +1174,25 @@ IF(LIBTYPE STREQUAL "STATIC")
SET(PKG_CONFIG_CFLAGS -DAL_LIBTYPE_STATIC ${PKG_CONFIG_CFLAGS})
ENDIF()
IF(EXISTS "${OpenAL_SOURCE_DIR}/.git")
# Get the current working branch and its latest abbreviated commit hash
EXECUTE_PROCESS(
COMMAND git rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY "${OpenAL_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
EXECUTE_PROCESS(
COMMAND git log -1 --format=%h
WORKING_DIRECTORY "${OpenAL_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
ELSE()
SET(GIT_BRANCH "UNKNOWN")
SET(GIT_COMMIT_HASH "unknown")
ENDIF()
# Needed for openal.pc.in
SET(prefix ${CMAKE_INSTALL_PREFIX})
SET(exec_prefix "\${prefix}")
@@ -1183,6 +1202,9 @@ SET(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
SET(PACKAGE_VERSION "${LIB_VERSION}")
# End configuration
CONFIGURE_FILE(
"${OpenAL_SOURCE_DIR}/version.h.in"
"${OpenAL_BINARY_DIR}/version.h")
CONFIGURE_FILE(
"${OpenAL_SOURCE_DIR}/config.h.in"
"${OpenAL_BINARY_DIR}/config.h")
+2
View File
@@ -20,6 +20,8 @@
#include "config.h"
#include "version.h"
#include <stdlib.h>
#include "alMain.h"
#include "AL/alc.h"
-3
View File
@@ -2,9 +2,6 @@
#define AL_API ${EXPORT_DECL}
#define ALC_API ${EXPORT_DECL}
/* Define to the library version */
#define ALSOFT_VERSION "${LIB_VERSION}"
/* Define any available alignment declaration */
#define ALIGN(x) ${ALIGN_DECL}
+4 -1
View File
@@ -1,6 +1,8 @@
#include "config.h"
#include "version.h"
#include <iostream>
#include <cmath>
@@ -461,7 +463,8 @@ void MainWindow::cancelCloseAction()
void MainWindow::showAboutPage()
{
QMessageBox::information(this, tr("About"),
tr("OpenAL Soft Configuration Utility.\nBuilt for OpenAL Soft library version ")+(ALSOFT_VERSION ".")
tr("OpenAL Soft Configuration Utility.\nBuilt for OpenAL Soft library version ")+
(ALSOFT_VERSION "-" ALSOFT_GIT_COMMIT_HASH " (" ALSOFT_GIT_BRANCH " branch).")
);
}
+8
View File
@@ -0,0 +1,8 @@
/* Define to the library version */
#define ALSOFT_VERSION "${LIB_VERSION}"
/* Define the branch being built */
#define ALSOFT_GIT_BRANCH "${GIT_BRANCH}"
/* Define the hash of the head commit */
#define ALSOFT_GIT_COMMIT_HASH "${GIT_COMMIT_HASH}"