diff options
author | Chris Robinson <[email protected]> | 2016-12-21 01:08:33 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2016-12-21 01:12:47 -0800 |
commit | bcb6dfee71ef0ce4a0b9e7ceccb943f7f28704c4 (patch) | |
tree | e06b805f989c34613ab1980aa0d2a9dc976b215d | |
parent | 8f581c0e66e52a6f24e85763b39ed3be29a3e792 (diff) |
Trace the commit ID and branch the library was built from
-rw-r--r-- | Alc/ALc.c | 4 | ||||
-rw-r--r-- | CMakeLists.txt | 22 | ||||
-rw-r--r-- | OpenAL32/alState.c | 2 | ||||
-rw-r--r-- | config.h.in | 3 | ||||
-rw-r--r-- | utils/alsoft-config/mainwindow.cpp | 5 | ||||
-rw-r--r-- | version.h.in | 8 |
6 files changed, 40 insertions, 4 deletions
@@ -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); diff --git a/CMakeLists.txt b/CMakeLists.txt index 34e55377..e1e9a851 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}") @@ -1184,6 +1203,9 @@ 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") CONFIGURE_FILE( diff --git a/OpenAL32/alState.c b/OpenAL32/alState.c index 3d8e6c40..e633a86b 100644 --- a/OpenAL32/alState.c +++ b/OpenAL32/alState.c @@ -20,6 +20,8 @@ #include "config.h" +#include "version.h" + #include <stdlib.h> #include "alMain.h" #include "AL/alc.h" diff --git a/config.h.in b/config.h.in index a06c2039..4f22e5c8 100644 --- a/config.h.in +++ b/config.h.in @@ -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} diff --git a/utils/alsoft-config/mainwindow.cpp b/utils/alsoft-config/mainwindow.cpp index 309c4d7b..8d5dfe02 100644 --- a/utils/alsoft-config/mainwindow.cpp +++ b/utils/alsoft-config/mainwindow.cpp @@ -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).") ); } diff --git a/version.h.in b/version.h.in new file mode 100644 index 00000000..56f738a3 --- /dev/null +++ b/version.h.in @@ -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}" |