Skip to content

Commit

Permalink
Print errors on release builds
Browse files Browse the repository at this point in the history
  • Loading branch information
shg8 committed Feb 16, 2024
1 parent 72da990 commit 637aa2f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ file(GLOB_RECURSE GLSL_SOURCE_FILES
"shaders/*.comp"
)

if (CMAKE_BUILD_TYPE MATCHES Debug)
add_compile_definitions(DEBUG)
else ()
add_compile_definitions(NDEBUG)
endif ()

if (CMAKE_BUILD_TYPE MATCHES Debug AND NOT APPLE)
set(GLSLC_DEFINE "-DDEBUG")
else ()
Expand Down
9 changes: 9 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,17 @@ int main(int argc, char** argv) {
config.immediateSwapchain = args::get(immediateSwapchainFlag);
}

#ifndef DEBUG
try {
#endif
auto renderer = Renderer(config);
renderer.initialize();
renderer.run();
#ifndef DEBUG
} catch (const std::exception& e) {
std::cerr << e.what() << std::endl;
return 1;
}
#endif
return 0;
}

0 comments on commit 637aa2f

Please sign in to comment.