Remove console on windows version of all GUI CamiTK application (camitk-imp, camitk-actionstatemachine, camitk-wizard)
As a | camitk-imp user and CamiTK developer |
I would like to | optimize the application performance and not have a visible (1990's) dark console when I launch imp |
So that | I am not disturbed by another window on the screen, and therefore I focus on the task I need to do in the main window of camitk-imp |
Epic/Topics | ] |
Description / Overview
By default, MSVC compile camitk-imp and all other GUI-based CamiTK programs as a console program.
As stated here, this mode results in Windows allocating and showing a console for you when starting the program up (e.g. CamiTK-imp). This console will require a redraw on every std::cerr or std::cout print, resulting in massive performance issues.
The best would be have a specific option in the camitk_application
macro to declare the application as a console application (by default, and considering the CAMI domain, I suppose it is better to say that an application has a GUI by default, only specific CamiTK application are console only).
E.g.:
camitk_application(...
NO_GUI
...
)
Hints
As stated here:
If you program shows a graphical window, then you should change it to a Windows program. There are three methods to do this. The first option is to set the executable type to WIN32 in CMake:
if(WIN32)
add_executable(${EXECUTABLE_NAME} WIN32 ${SRC})
else()
add_executable(${EXECUTABLE_NAME} ${SRC})
endif()
This is confirmed to work in this answer on stackoverflow.
The second proposed option seems a bit to windowesque and rely on the MSVC compiler. The third proposed option should not be considered here as it won't be a nice way considering the CamiTK objectives (it make use of a #pragma
)
See also the CMake documentation for add_executable and WIN32_EXECUTABLE property/flag
Acceptance tests
-
When run camitk-imp, camitk-actionstatemachine, and camitk-wizard do not show any console -
All other CamiTK CE application seem to work as before (e.g. the config and cepgenerator test pass) -
The camitk_application
macro has a new option for console application -
The camitk_application
macro documents this new option (so that generated doxygen talks about it)