Merge pull request #84 from unkxTeam/unkx_output_log
fix: output logs on platform Windows
This commit is contained in:
commit
99588df3a7
@ -91,7 +91,12 @@ endif()
|
|||||||
|
|
||||||
# Define LVGL configuration as a simple include
|
# Define LVGL configuration as a simple include
|
||||||
target_compile_definitions(main PRIVATE LV_CONF_INCLUDE_SIMPLE)
|
target_compile_definitions(main PRIVATE LV_CONF_INCLUDE_SIMPLE)
|
||||||
target_link_libraries(main lvgl lvgl::examples lvgl::demos lvgl::thorvg ${SDL2_LIBRARIES} m pthread)
|
|
||||||
|
if(MSVC)
|
||||||
|
target_link_libraries(main lvgl lvgl::examples lvgl::demos lvgl::thorvg ${SDL2_LIBRARIES})
|
||||||
|
else()
|
||||||
|
target_link_libraries(main lvgl lvgl::examples lvgl::demos lvgl::thorvg ${SDL2_LIBRARIES} m pthread)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Only link freertos_config if the FreeRTOS directory exists
|
# Only link freertos_config if the FreeRTOS directory exists
|
||||||
if(USE_FREERTOS)
|
if(USE_FREERTOS)
|
||||||
@ -135,6 +140,16 @@ if(LV_USE_FREETYPE)
|
|||||||
target_link_libraries(main ${FREETYPE_LIBRARIES})
|
target_link_libraries(main ${FREETYPE_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# On Windows, GUI applications do not show a console by default,
|
||||||
|
# which hides log output. This ensures a console is available for logging.
|
||||||
|
if (WIN32)
|
||||||
|
if (MSVC)
|
||||||
|
target_link_options(main PRIVATE "/SUBSYSTEM:CONSOLE")
|
||||||
|
else()
|
||||||
|
target_link_options(main PRIVATE "-mconsole")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
# Apply additional compile options if the build type is Debug
|
# Apply additional compile options if the build type is Debug
|
||||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
message(STATUS "Debug mode enabled")
|
message(STATUS "Debug mode enabled")
|
||||||
@ -176,4 +191,4 @@ if (ASAN)
|
|||||||
else()
|
else()
|
||||||
message(STATUS "AddressSanitizer disabled")
|
message(STATUS "AddressSanitizer disabled")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
@ -7,11 +7,18 @@
|
|||||||
/*********************
|
/*********************
|
||||||
* INCLUDES
|
* INCLUDES
|
||||||
*********************/
|
*********************/
|
||||||
#define _DEFAULT_SOURCE /* needed for usleep() */
|
#ifndef _DEFAULT_SOURCE
|
||||||
|
#define _DEFAULT_SOURCE /* needed for usleep() */
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#ifdef _MSC_VER
|
||||||
#include <pthread.h>
|
#include <Windows.h>
|
||||||
|
#else
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <pthread.h>
|
||||||
|
#endif
|
||||||
#include "lvgl/lvgl.h"
|
#include "lvgl/lvgl.h"
|
||||||
#include "lvgl/examples/lv_examples.h"
|
#include "lvgl/examples/lv_examples.h"
|
||||||
#include "lvgl/demos/lv_demos.h"
|
#include "lvgl/demos/lv_demos.h"
|
||||||
@ -88,7 +95,11 @@ int main(int argc, char **argv)
|
|||||||
/* Periodically call the lv_task handler.
|
/* Periodically call the lv_task handler.
|
||||||
* It could be done in a timer interrupt or an OS task too.*/
|
* It could be done in a timer interrupt or an OS task too.*/
|
||||||
lv_timer_handler();
|
lv_timer_handler();
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
Sleep(5);
|
||||||
|
#else
|
||||||
usleep(5 * 1000);
|
usleep(5 * 1000);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif LV_USE_OS == LV_OS_FREERTOS
|
#elif LV_USE_OS == LV_OS_FREERTOS
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user