Skip to content

Commit

Permalink
Merge pull request #341 from zhujun98/gui
Browse files Browse the repository at this point in the history
Display version
  • Loading branch information
zhujun98 authored Aug 29, 2024
2 parents d7495cb + 055d430 commit b79cc75
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
.idea
.vscode

version.hpp

imgui.ini

*__pycache__*
*.so
*.egg-info
Expand Down
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# -----------------------------------------------------------------------------
cmake_minimum_required(VERSION 3.25)

project(recastx LANGUAGES C CXX)
project(recastx LANGUAGES C CXX VERSION 0.0.0)

include(CheckLanguage)
check_language(CUDA)
Expand All @@ -23,6 +23,8 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

configure_file(version.in ${PROJECT_SOURCE_DIR}/common/include/common/version.hpp @ONLY)

option(BUILD_GUI "Build OpenGL GUI only" OFF)
option(BUILD_TEST "Build unit test" OFF)
option(VERBOSITY "Build with verbose performance monitoring and debug messages" 1)
Expand Down
3 changes: 2 additions & 1 deletion gui/src/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* The full license is in the file LICENSE, distributed with this software.
*/
#include "application.hpp"
#include "common/version.hpp"
#include "graphics/camera.hpp"
#include "graphics/light.hpp"
#include "graphics/voxel_object.hpp"
Expand Down Expand Up @@ -47,7 +48,7 @@ Application::Application() : width_(1440), height_(1080) {
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
#endif

glfw_window_ = glfwCreateWindow(width_, height_, title_.c_str(), NULL, NULL);
glfw_window_ = glfwCreateWindow(width_, height_, (title_ + " v" + getRecastxVersion()).c_str(), NULL, NULL);
if (glfw_window_ == NULL) {
glfwTerminate();
throw std::runtime_error("Failed to create GLFW window");
Expand Down
2 changes: 1 addition & 1 deletion gui/src/graphics/log_component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void LogComponent::draw(rpc::ServerState_State) {
// ImGui::PushItemWidth(100);
// ImGui::Combo("Log levels##LOG_COMP", &current_level_, log_levels_.data(), log_levels_.size());
// ImGui::PopItemWidth();
ImGui::SameLine();
// ImGui::SameLine();
filter_.Draw("Filter", -200.f);
ImGui::SameLine();
bool clear_text = ImGui::Button("Clear##LOG_COMP");
Expand Down
5 changes: 5 additions & 0 deletions recon/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <spdlog/spdlog.h>
#include <boost/program_options.hpp>

#include "common/version.hpp"
#include "recon/application.hpp"
#include "recon/ramp_filter.hpp"
#include "recon/reconstructor.hpp"
Expand All @@ -38,6 +39,10 @@ recastx::AngleRange parseAngleRange(const po::variable_value& value) {

int main(int argc, char** argv) {

spdlog::info(std::string(80, '='));
spdlog::info(std::string(30, ' ') + "RECASTX v{}", getRecastxVersion());
spdlog::info(std::string(80, '='));

spdlog::set_pattern("[%Y-%m-%d %T.%e] [%^%l%$] %v");
#ifndef NDEBUG
spdlog::set_level(spdlog::level::debug);
Expand Down
17 changes: 17 additions & 0 deletions version.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <string>


inline std::string getRecastxVersion()
{
return "@recastx_VERSION@";
}

inline unsigned getRecastxVersionMajor()
{
return @recastx_VERSION_MAJOR@;
}

inline unsigned getRecastxVersionMinor()
{
return @recastx_VERSION_MINOR@ +0;
}

0 comments on commit b79cc75

Please sign in to comment.