Convert C++ version string to be define instead of include
This allows Qmake to use the version number as well as not requiring all other uses of the version string to strip double quotes from it. This also reduces the fragility of the version string as it was required to be a valid C++ char*, even in contexts where that wouldn't matter.
This commit is contained in:
@@ -3,6 +3,9 @@ CONFIG += c++1z
|
||||
|
||||
DEFINES += ELPP_THREAD_SAFE ELPP_QT_LOGGING ELPP_NO_DEFAULT_LOG_FILE
|
||||
|
||||
VERSION = "$$cat($$PWD/build_scripts/compile_version_string.txt)"
|
||||
DEFINES += APPLICATION_VERSION=\\\"$$VERSION\\\"
|
||||
|
||||
lessThan(QT_MAJOR_VERSION, 5): error("requires Qt 5.12 or higher")
|
||||
lessThan(QT_MINOR_VERSION, 12): error("requires Qt 5.12 or higher")
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ def get_version_string():
|
||||
def set_version_string(new_version_string):
|
||||
remove(version_file_path)
|
||||
with open(version_file_path, "w") as file:
|
||||
file.write("\"" + new_version_string + "\"")
|
||||
file.write(new_version_string)
|
||||
|
||||
def main():
|
||||
current_version = get_version_string()
|
||||
|
||||
@@ -1 +1 @@
|
||||
"3.1.0-dev-new"
|
||||
3.1.0-dev-new
|
||||
@@ -12,7 +12,7 @@ def get_version_string():
|
||||
dir_path = os.path.dirname(os.path.realpath(__file__))
|
||||
with open(dir_path + "/../compile_version_string.txt", "r") as file:
|
||||
contents = file.readline()
|
||||
return contents.strip('"')
|
||||
return contents
|
||||
|
||||
|
||||
#Const globals
|
||||
|
||||
@@ -11,8 +11,7 @@
|
||||
!define THIRDDIR "..\third-party"
|
||||
!define PACKAGEDIR "..\src\package_files"
|
||||
!define PROJECTDIR "..\"
|
||||
!define /file VERSION_STRING_QUOTES "..\build_scripts\compile_version_string.txt"
|
||||
!searchreplace VERSION_STRING ${VERSION_STRING_QUOTES} "$\"" ""
|
||||
!define /file VERSION_STRING "..\build_scripts\compile_version_string.txt"
|
||||
|
||||
|
||||
;Installer icon
|
||||
|
||||
@@ -48,9 +48,8 @@ constexpr auto applicationOrganizationName = "AdvancedSettings-Team";
|
||||
constexpr auto applicationName = "OpenVRAdvancedSettings";
|
||||
constexpr const char* applicationKey = "OVRAS-Team.AdvancedSettings";
|
||||
constexpr const char* applicationDisplayName = "Advanced Settings";
|
||||
constexpr const char* applicationVersionString = {
|
||||
#include "../build_scripts/compile_version_string.txt"
|
||||
};
|
||||
|
||||
constexpr const char* applicationVersionString = APPLICATION_VERSION;
|
||||
|
||||
} // namespace application_strings
|
||||
|
||||
|
||||
Reference in New Issue
Block a user