Skip to content

Commit

Permalink
refactor: fixed the debug flag
Browse files Browse the repository at this point in the history
  • Loading branch information
GhostVaibhav committed Jun 8, 2024
1 parent 7351865 commit 7294e26
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ else()
set(CMAKE_BUILD_TYPE "Debug")
endif()

if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
set(CMAKE_DEBUG_BUILD 1)
else()
set(CMAKE_DEBUG_BUILD 0)
endif()

project ("MarkIt")

configure_file(
Expand Down
6 changes: 5 additions & 1 deletion include/toggles.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,16 @@
#define TOGGLES_H

#define MARKIT_GUI 1
#define MARKIT_BUILD_TYPE Debug
#define MARKIT_BUILD_TYPE 0
#define MARKIT_MINOR_VERSION 1
#define MARKIT_MAJOR_VERSION 0

#if MARKIT_GUI == 1
#define GUI
#endif

#if MARKIT_BUILD_TYPE == 1
#define DEBUG
#endif

#endif
6 changes: 5 additions & 1 deletion include/toggles.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,16 @@
#define TOGGLES_H

#define MARKIT_GUI @CMAKE_BUILD_GUI@
#define MARKIT_BUILD_TYPE @CMAKE_BUILD_TYPE@
#define MARKIT_BUILD_TYPE @CMAKE_DEBUG_BUILD@
#define MARKIT_MINOR_VERSION @CMAKE_MINOR_VERSION@
#define MARKIT_MAJOR_VERSION @CMAKE_MAJOR_VERSION@

#if MARKIT_GUI == 1
#define GUI
#endif

#if MARKIT_BUILD_TYPE == 1
#define DEBUG
#endif

#endif
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ int main(int argc, char *argv[])
std::vector<std::string> args(0);
for (int i = 1; i < argc; i++)
args.push_back(argv[i]);
#if std::strcmp(MARKIT_BUILD_TYPE, "Debug")
#ifdef DEBUG
if (args[0] == "--test" || args[0] == "-t" || args[0] == "test")
{
cli::test(args);
Expand Down

0 comments on commit 7294e26

Please sign in to comment.