Commit a83bb4fc authored by Jan Möbius's avatar Jan Möbius
Browse files

Merge branch 'master' into Drop_QWT5_and_more_qt4_parts

parents a0c22465 7708cd9f
......@@ -153,13 +153,6 @@ if (NOT CATCH_SIGSEGV)
add_definitions( -DNO_CATCH_SIGSEGV )
endif()
if (WIN32)
set ( WIN_GET_DEBUG_CONSOLE False CACHE BOOL "Whether a debug console should be visible on windows" )
if (WIN_GET_DEBUG_CONSOLE)
add_definitions( -DWIN_GET_DEBUG_CONSOLE )
endif()
endif ()
......
......@@ -105,7 +105,7 @@ You can change view modes of cmake-gui via the select box on the top. </li>
</ul>
\note If you want to build OpenFlipper as release on windows, you don't have to set the CMAKE_BUILD_TYPE variable to "Release" before configuring
generating the Visual Studio solution file. Instead, choose the build type "Release" in Visual Studio and build the solution.
generating the Visual Studio solution file. Instead, choose the build type "Release" in Visual Studio and build the solution. Console outputs are only available in Visual Studio, when the "Debug" configuration is selected, or the -c option is passed as command line option.
Don't forget setting up the "OpenFlipper" target as startup project as shown in the image below to run the debugger with OpenFlipper right out of Visual Studio.
\image html windows_build_set_as_startup.png
......
......@@ -12,6 +12,8 @@
*
* Log options:\n
* --log-to-console ( -c ) : Write logger window contents to console\n
* \note On Window Systems, using the --log-to-console option causes the creation of a console if OpenFlipper was started without one.
* Otherwise the parent Console will be used for outputs.
*
* Other options:\n
* -b : Batch mode, you have to provide a script for execution and the system will start without gui\n
......
......@@ -108,14 +108,6 @@
*
* ==========================================================*/
// Includes for windows debugging console
#ifdef WIN32
#ifdef WIN_GET_DEBUG_CONSOLE
#include <fcntl.h>
#include <io.h>
#endif
#endif
#ifdef WIN32
void attachConsole()
......@@ -131,6 +123,14 @@
else
{
//create and attach a new console if needed
#ifndef NDEBUG
//always open a console in debug mode
AllocConsole();
freopen("CONIN$", "r", stdin);
freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr);
return;
#endif
if (OpenFlipper::Options::logToConsole())
{
AllocConsole();
......@@ -140,30 +140,7 @@
}
}
}
#ifdef WIN_GET_DEBUG_CONSOLE
void getConsole() {
//Create a console for this application
AllocConsole();
//Redirect unbuffered STDOUT to the console
HANDLE ConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
int SystemOutput = _open_osfhandle(intptr_t(ConsoleOutput), _O_TEXT);
FILE *COutputHandle = _fdopen(SystemOutput, "w" );
*stdout = *COutputHandle;
setvbuf(stdout, NULL, _IONBF, 0);
//Redirect unbuffered STDERR to the console
HANDLE ConsoleError = GetStdHandle(STD_ERROR_HANDLE);
int SystemError = _open_osfhandle(intptr_t(ConsoleError), _O_TEXT);
FILE *CErrorHandle = _fdopen(SystemError, "w" );
*stderr = *CErrorHandle;
setvbuf(stderr, NULL, _IONBF, 0);
//Redirect unbuffered STDIN to the console
HANDLE ConsoleInput = GetStdHandle(STD_INPUT_HANDLE);
int SystemInput = _open_osfhandle(intptr_t(ConsoleInput), _O_TEXT);
FILE *CInputHandle = _fdopen(SystemInput, "r" );
*stdin = *CInputHandle;
setvbuf(stdin, NULL, _IONBF, 0);
}
#endif
#endif
/* ==========================================================
......@@ -393,12 +370,6 @@ int main(int argc, char **argv)
OpenFlipper::Options::windowTitle(TOSTRING(PRODUCT_STRING)" v" + OpenFlipper::Options::coreVersion());
#ifdef WIN32
#ifdef WIN_GET_DEBUG_CONSOLE
getConsole();
#endif
#endif
if ( !OpenFlipper::Options::nogui() ) {
// OpenGL check
......@@ -427,10 +398,10 @@ int main(int argc, char **argv)
delete w;
return 1;
}
#ifdef WIN32
#ifndef WIN_GET_DEBUG_CONSOLE //only attach to parent console if no separate debug console is requested
//attach a console if necessary
attachConsole();
#endif
#endif
QString tLang = OpenFlipperSettings().value("Core/Language/Translation","en_US").toString();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment