diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ac09c4647..65ac51bcc3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,10 +27,11 @@ cmake_policy(VERSION 3.25) project(OpenSpace) -set(OPENSPACE_VERSION_MAJOR 0) -set(OPENSPACE_VERSION_MINOR 20) -set(OPENSPACE_VERSION_PATCH 0) -set(OPENSPACE_VERSION_STRING "Beta-13") +set(OPENSPACE_RELEASE_BUILD OFF) +set(OPENSPACE_VERSION_MAJOR) +set(OPENSPACE_VERSION_MINOR) +set(OPENSPACE_VERSION_PATCH) +set(OPENSPACE_VERSION_STRING) include(${PROJECT_SOURCE_DIR}/support/cmake/module_common.cmake) include(${PROJECT_SOURCE_DIR}/ext/ghoul/support/cmake/message_macros.cmake) diff --git a/include/openspace/rendering/renderengine.h b/include/openspace/rendering/renderengine.h index 6047fbc961..d64c689fd1 100644 --- a/include/openspace/rendering/renderengine.h +++ b/include/openspace/rendering/renderengine.h @@ -226,8 +226,6 @@ private: glm::ivec4 roll = glm::ivec4(0); } _cameraButtonLocations; - std::string _versionString; - properties::Vec4Property _enabledFontColor; properties::Vec4Property _disabledFontColor; }; diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b80cad0304..5ea8e03999 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -488,13 +488,13 @@ add_dependencies(openspace-core run_codegen) configure_file( ${PROJECT_SOURCE_DIR}/support/cmake/openspace_header.template ${CMAKE_BINARY_DIR}/_generated/include/openspace/openspace.h - @ONLY IMMEDIATE + @ONLY ) configure_file( ${PROJECT_SOURCE_DIR}/support/cmake/commit.template ${PROJECT_SOURCE_DIR}/COMMIT.md - @ONLY IMMEDIATE + @ONLY ) if (APPLE) diff --git a/src/engine/openspaceengine_lua.inl b/src/engine/openspaceengine_lua.inl index 43cf0c4550..f4d5efd5f8 100644 --- a/src/engine/openspaceengine_lua.inl +++ b/src/engine/openspaceengine_lua.inl @@ -222,9 +222,9 @@ namespace { ghoul::Dictionary res; ghoul::Dictionary version; - version.setValue("Major", openspace::OPENSPACE_VERSION_MAJOR); - version.setValue("Minor", openspace::OPENSPACE_VERSION_MINOR); - version.setValue("Patch", openspace::OPENSPACE_VERSION_PATCH); + version.setValue("Major", static_cast(openspace::OPENSPACE_VERSION_MAJOR)); + version.setValue("Minor", static_cast(openspace::OPENSPACE_VERSION_MINOR)); + version.setValue("Patch", static_cast(openspace::OPENSPACE_VERSION_PATCH)); res.setValue("Version", std::move(version)); res.setValue("Commit", std::string(openspace::OPENSPACE_GIT_COMMIT)); diff --git a/src/rendering/renderengine.cpp b/src/rendering/renderengine.cpp index 970ba6acc6..960b893f8f 100644 --- a/src/rendering/renderengine.cpp +++ b/src/rendering/renderengine.cpp @@ -465,22 +465,6 @@ void RenderEngine::initialize() { ghoul::io::ModelReader::ref().addReader( std::make_unique() ); - - _versionString = OPENSPACE_VERSION_STRING_FULL; - if (global::versionChecker->hasLatestVersionInfo()) { - VersionChecker::SemanticVersion latest = global::versionChecker->latestVersion(); - - const VersionChecker::SemanticVersion current { - OPENSPACE_VERSION_MAJOR, - OPENSPACE_VERSION_MINOR, - OPENSPACE_VERSION_PATCH - }; - if (current < latest) { - _versionString += std::format( - " [Available: {}.{}.{}]", latest.major, latest.minor, latest.patch - ); - } - } } void RenderEngine::initializeGL() { @@ -1203,15 +1187,43 @@ void RenderEngine::renderVersionInformation() { } using FR = ghoul::fontrendering::FontRenderer; - const glm::vec2 versionBox = _fontVersionInfo->boundingBox(_versionString); - const glm::vec2 commitBox = _fontVersionInfo->boundingBox(OPENSPACE_GIT_FULL); + glm::vec2 versionBox = glm::vec2(0.f, 0.f); + if (OPENSPACE_IS_RELEASE_BUILD) { + if (global::versionChecker->hasLatestVersionInfo()) { + VersionChecker::SemanticVersion ver = global::versionChecker->latestVersion(); - FR::defaultRenderer().render( - *_fontVersionInfo, - glm::vec2(fontResolution().x - versionBox.x - 10.f, 5.f), - _versionString, - glm::vec4(0.5f, 0.5f, 0.5f, 1.f) - ); + std::string versionString = std::string(OPENSPACE_VERSION_STRING_FULL); + const VersionChecker::SemanticVersion current { + OPENSPACE_VERSION_MAJOR, + OPENSPACE_VERSION_MINOR, + OPENSPACE_VERSION_PATCH + }; + if (current < ver) { + versionString += std::format( + " [Available: {}.{}.{}]", ver.major, ver.minor, ver.patch + ); + } + + versionBox = _fontVersionInfo->boundingBox(versionString); + FR::defaultRenderer().render( + *_fontVersionInfo, + glm::vec2(fontResolution().x - versionBox.x - 10.f, 5.f), + versionString, + glm::vec4(0.5f, 0.5f, 0.5f, 1.f) + ); + } + else { + versionBox = _fontVersionInfo->boundingBox(OPENSPACE_VERSION_STRING_FULL); + FR::defaultRenderer().render( + *_fontVersionInfo, + glm::vec2(fontResolution().x - versionBox.x - 10.f, 5.f), + OPENSPACE_VERSION_STRING_FULL, + glm::vec4(0.5f, 0.5f, 0.5f, 1.f) + ); + } + } + + const glm::vec2 commitBox = _fontVersionInfo->boundingBox(OPENSPACE_GIT_FULL); // If a developer hasn't placed the Git command in the path, this variable will be // empty diff --git a/support/cmake/openspace_header.template b/support/cmake/openspace_header.template index c8369ab938..7e1814a580 100644 --- a/support/cmake/openspace_header.template +++ b/support/cmake/openspace_header.template @@ -27,20 +27,38 @@ #include +#cmakedefine OPENSPACE_RELEASE_BUILD + namespace openspace { std::string licenseText(); -constexpr int OPENSPACE_VERSION_MAJOR = @OPENSPACE_VERSION_MAJOR@; -constexpr int OPENSPACE_VERSION_MINOR = @OPENSPACE_VERSION_MINOR@; -constexpr int OPENSPACE_VERSION_PATCH = @OPENSPACE_VERSION_PATCH@; +#ifdef OPENSPACE_RELEASE_BUILD + +constexpr bool OPENSPACE_IS_RELEASE_BUILD = true; + +constexpr uint8_t OPENSPACE_VERSION_MAJOR = @OPENSPACE_VERSION_MAJOR@; +constexpr uint8_t OPENSPACE_VERSION_MINOR = @OPENSPACE_VERSION_MINOR@; +constexpr uint8_t OPENSPACE_VERSION_PATCH = @OPENSPACE_VERSION_PATCH@; constexpr std::string_view OPENSPACE_VERSION_NUMBER = "@OPENSPACE_VERSION_MAJOR@.@OPENSPACE_VERSION_MINOR@.@OPENSPACE_VERSION_PATCH@"; - constexpr std::string_view OPENSPACE_VERSION_STRING = "@OPENSPACE_VERSION_STRING@"; - constexpr std::string_view OPENSPACE_VERSION_STRING_FULL = "@OPENSPACE_VERSION_MAJOR@.@OPENSPACE_VERSION_MINOR@.@OPENSPACE_VERSION_PATCH@ (@OPENSPACE_VERSION_STRING@)"; +#else // ^^^^ OPENSPACE_RELEASE_BUILD || !OPENSPACE_RELEASE_BUILD vvvv + +constexpr bool OPENSPACE_IS_RELEASE_BUILD = false; + +constexpr uint8_t OPENSPACE_VERSION_MAJOR = std::numeric_limits::max(); +constexpr uint8_t OPENSPACE_VERSION_MINOR = std::numeric_limits::max(); +constexpr uint8_t OPENSPACE_VERSION_PATCH = std::numeric_limits::max(); + +constexpr std::string_view OPENSPACE_VERSION_NUMBER = ""; +constexpr std::string_view OPENSPACE_VERSION_STRING = ""; +constexpr std::string_view OPENSPACE_VERSION_STRING_FULL = ""; + +#endif // OPENSPACE_RELEASE_BUILD + constexpr std::string_view OPENSPACE_GIT_BRANCH = "@OPENSPACE_GIT_BRANCH@"; constexpr std::string_view OPENSPACE_GIT_COMMIT = "@OPENSPACE_GIT_COMMIT@"; constexpr std::string_view OPENSPACE_GIT_FULL = "@OPENSPACE_GIT_BRANCH@@@OPENSPACE_GIT_COMMIT@";