fix(version): Follow APP_VERSION in POLYBAR_NS

This commit is contained in:
László Várady 2017-01-28 20:26:27 +01:00 committed by Michael Carlberg
parent 7e7dc68e5a
commit 8a98fb78b6
5 changed files with 15 additions and 2 deletions

View File

@ -13,8 +13,11 @@ main() {
set -- "$(git describe --tags --dirty=-dev)"
fi
GIT_TAG_NAMESPACE=$(echo "v$1" | sed "s/[^a-zA-Z0-9_]/_/g")
msg "Current version: $1"
sed -r "/#define GIT_TAG/s/GIT_TAG .*/GIT_TAG \"$1\"/" -i include/version.hpp
sed -r "/#define GIT_TAG_NAMESPACE/s/GIT_TAG_NAMESPACE .*/GIT_TAG_NAMESPACE $GIT_TAG_NAMESPACE/" -i include/version.hpp
if git diff include/version.hpp 2>/dev/null | grep -q .; then
msg "Updated include/version.hpp"

View File

@ -29,6 +29,10 @@ execute_process(COMMAND git describe --tags --dirty=-git
OUTPUT_VARIABLE APP_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
if(APP_VERSION)
STRING(REGEX REPLACE "[^a-zA-Z0-9_]" "_" APP_VERSION_NAMESPACE "v${APP_VERSION}")
endif()
configure_file(
${CMAKE_CURRENT_LIST_DIR}/settings.hpp.cmake
${CMAKE_CURRENT_LIST_DIR}/settings.hpp

View File

@ -5,13 +5,14 @@
#include <vector>
#include <functional>
#include "settings.hpp"
#define POLYBAR_NS \
namespace polybar { \
inline namespace v2_0_0 {
inline namespace APP_VERSION_NAMESPACE {
#define POLYBAR_NS_END \
} \
}
#define POLYBAR_NS_PATH "polybar::v2_0_0"
#ifndef PIPE_READ
#define PIPE_READ 0

View File

@ -11,6 +11,10 @@
#ifndef APP_VERSION
#define APP_VERSION GIT_TAG
#endif
#cmakedefine APP_VERSION_NAMESPACE @APP_VERSION_NAMESPACE@
#ifndef APP_VERSION_NAMESPACE
#define APP_VERSION_NAMESPACE GIT_TAG_NAMESPACE
#endif
#define BASE_PATH "@PROJECT_SOURCE_DIR@"
#cmakedefine01 ENABLE_ALSA

View File

@ -1,3 +1,4 @@
#pragma once
#define GIT_TAG "3.0.3"
#define GIT_TAG_NAMESPACE v3_0_3