Skip to content

Commit

Permalink
feature: added production/debug #ifs
Browse files Browse the repository at this point in the history
  • Loading branch information
klonyyy committed Feb 12, 2025
1 parent c0499b0 commit 5c492a9
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ if(PRODUCTION)
set(CMAKE_BUILD_TYPE Release)
message("Building for production!")
else()
set(PRODUCTION 0)
set(CMAKE_BUILD_TYPE Debug)
message("Building for debug!")
endif()
Expand Down Expand Up @@ -186,6 +187,7 @@ target_compile_definitions(${EXECUTABLE}
PRIVATE MCUVIEWER_VERSION_MAJOR=${CMAKE_MATCH_1}
PRIVATE MCUVIEWER_VERSION_MINOR=${CMAKE_MATCH_2}
PRIVATE MCUVIEWER_VERSION_REVISION=${CMAKE_MATCH_3}
PRIVATE PRODUCTION=${PRODUCTION}
)

target_include_directories(${EXECUTABLE} PRIVATE
Expand Down
5 changes: 3 additions & 2 deletions src/Gui/Gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,9 @@ void Gui::guiStep()
}
glfwSetWindowShouldClose(window, done);

if (showDemoWindow)
ImPlot::ShowDemoWindow();
#if PRODUCTION == 0
ImPlot::ShowDemoWindow();
#endif

checkShortcuts();

Expand Down
2 changes: 0 additions & 2 deletions src/Gui/Gui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ class Gui
ImGuiWindowClass window_class;

private:
static constexpr bool showDemoWindow = false;

const std::map<DataHandlerBase::State, std::string> viewerStateMap{{DataHandlerBase::State::RUN, "RUNNING"}, {DataHandlerBase::State::STOP, "STOPPED"}};

Renderer renderer;
Expand Down
6 changes: 6 additions & 0 deletions src/Gui/GuiAbout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ void Gui::drawAboutWindow()
ImGui::LogFinish();
}

#if PRODUCTION == 1
GuiHelper::drawCenteredText("--- production build ---");
#else
GuiHelper::drawCenteredText("--- development build ---");
#endif

ImGui::Dummy(ImVec2(-1, 20 * GuiHelper::contentScale));
GuiHelper::drawCenteredText("by Piotr Wasilewski (klonyyy)");
ImGui::Dummy(ImVec2(-1, 20 * GuiHelper::contentScale));
Expand Down
6 changes: 6 additions & 0 deletions src/Gui/GuiVarTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ class VariableTableWindow
for (std::shared_ptr<Variable> var : *variableHandler)
{
std::string name = var->getName();

#if PRODUCTION == 1
if (name.starts_with("____recorder."))
continue;
#endif

if (toLower(name).find(toLower(search)) == std::string::npos)
continue;

Expand Down

0 comments on commit 5c492a9

Please sign in to comment.